scripts: make metrics gate() thread-safe#14301
Conversation
PR SummaryLow Risk Overview Adds a lock-protected registry of live Replaces the startup Reviewed by Cursor Bugbot for commit a69f19c. Bugbot is set up for automated code reviews on this repo. Configure here. |
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware reviewed 1 file and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on matanl-starkware).
scripts/prod/metrics_lib.py line 168 at r1 (raw file):
with _active_port_forwards_lock: _active_port_forwards.add(pf_process) print("Waiting for forwarding to start")
Should this be changed to print_colored instead so that it doesn't write to the shared stdout?
Suggestion:
print_colored("Waiting for forwarding to start")scripts/prod/metrics_lib.py line 178 at r1 (raw file):
print( f"Forwarding started (from local port {self.local_port} to {self.pod}:{self.metrics_port})" )
Should this be changed to print_colored instead so that it doesn't write to the shared stdout?
Suggestion:
print_colored(
f"Forwarding started (from local port {self.local_port} to {self.pod}:{self.metrics_port})"
)878e911 to
fcc2da4
Compare
893cb64 to
a92e79a
Compare
|
Addressed: both bare |
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware reviewed 1 file and all commit messages, and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on matanl-starkware).
fcc2da4 to
8d5a423
Compare
a92e79a to
04009a0
Compare
8d5a423 to
41e48cc
Compare
04009a0 to
029ce2e
Compare
41e48cc to
699ce08
Compare
029ce2e to
463f2bc
Compare
699ce08 to
32948e4
Compare
a185a20 to
fc6f37a
Compare
32948e4 to
137d975
Compare
fc6f37a to
fdefe46
Compare
137d975 to
0270f55
Compare
0270f55 to
ed98ef3
Compare
fdefe46 to
df94c18
Compare
ed98ef3 to
fc1a2f9
Compare
Guard signal.signal registration to the main thread (it raises ValueError on worker threads), and track live kubectl port-forward processes in a lock-guarded registry exposing terminate_all_port_forwards for best-effort cleanup from a main-thread signal handler. Enables gate() to run under parallel waits. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fc1a2f9 to
a69f19c
Compare
|
@ron-starkware — could you re-approve this one when you get a chance? 🙏 Context: #14300 (bottom of the stack) merged, so I rebased the rest onto I also addressed the new Cursor Bugbot finding on this push: in Heads-up on cadence: because the repo squash-merges and these are separate stacked PRs, each time I merge one and |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a69f19c. Configure here.
ron-starkware
left a comment
There was a problem hiding this comment.
@ron-starkware reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on matanl-starkware).
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on matanl-starkware).


Guard signal.signal registration to the main thread (it raises ValueError on
worker threads), and track live kubectl port-forward processes in a lock-guarded
registry exposing terminate_all_port_forwards for best-effort cleanup from a
main-thread signal handler. Enables gate() to run under parallel waits.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com