You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decide Whether the Python Interrupt Rule Routes SIGINT Through the SIGTERM Handler and Passes Over a Later Signal #4146
Should CODESTYLE.md "Interrupts in Python" (and the python-codestyle copy it generates) state that the entry point routes SIGINT through the same handler as SIGTERM, and that the handler passes over any signal after the first?
Background
The section today describes one handler, for SIGTERM. Python's own KeyboardInterrupt carries SIGINT.
Since #4145, .github/actions/prose-gate/prose_lint.py and catalog/snippets/hub_fetch_run.py install one handler for both signals, and that handler passes over any signal after the first, returning without raising. This closes a race. A Ctrl-C reaches the whole process group, and uv run then forwards a SIGTERM to the script it launched. Under the rule as written, that SIGTERM can land while the script is already cleaning up after the SIGINT, and interrupt the cleanup itself.
Writing this into the section is a new requirement for every fleet Python script, rather than a description of an existing one. The two other hub scripts that install a signal handler, scripts/docker_lint.py and host-setup/agent-safety/global_rules.py, install only the SIGTERM handler the section describes. That is why this is a question, and why the backlog-burndown run that found it did not change the rule.
host-setup/agent-safety/global_rules.py still has the race. That file is under host-setup/agent-safety/, so any change to it waits for the maintainer's approval whichever option is chosen.
Options
Recommended: make it the rule for every Python script. The entry point installs one handler for SIGINT and SIGTERM that records the first signal and raises KeyboardInterrupt, and passes over any later one. Reason: uv run is the fleet's standard launcher, so the race reaches every script it launches. A carried rule that describes only the SIGTERM handler hands the race to the next script written from it. The python-codestyle description is at its 1024-character cap, but the change goes in the generated include body, so the description need not grow. Scripts that do not yet follow it, scripts/docker_lint.py and global_rules.py included, become follow-up work.
Allow it as a permitted variant without requiring it. The section names the combined handler as acceptable, so a reviewer does not flag the two scripts, and leaves the single SIGTERM handler as the default. The race stays wherever a script does not opt in.
Leave the rule as it is. The two scripts keep a stricter local pattern that the rule neither states nor forbids.
Filed by the backlog-burndown planner (away mode, round 3) for an unfiled disagreement that the #4145 merge left behind.
Answered by the maintainer, 2026-11-15: option 1, make it the rule.CODESTYLE.md "Interrupts in Python" requires every script's entry point to install one handler for SIGINT and SIGTERM. The handler records the first signal, raises KeyboardInterrupt, and passes over any later one. Bringing scripts/docker_lint.py and host-setup/agent-safety/global_rules.py into line is follow-up work. The global_rules.py change waits for the maintainer's diff read. This is now work.
Decision triage (2026-11-19) found the open question here already answered, so it is not asked:
The maintainer's 2026-11-16 answer (option 1) approves the design of the host-setup/agent-safety/global_rules.py signal-handler change. Only the merge of that edit waits on his diff read. Neither CODESTYLE.md "Interrupts in Python" nor global_rules.py has changed on main yet, so this is ordinary work for an attended run. #4100 is a related open question that edits the same bullets, so its answer should land in the same pull request.
Generated from those: the include regions in .agents/skills/python-codestyle/SKILL.md and .agents/skills/shell-codestyle/SKILL.md, and their .github/skills and .claude-plugin copies and source digests.
Activity
Describe sh Hooks and Launchers in the Shell Interrupt Rule and Corre…
Bound the Review Wait by Its Timeout, End It by SIGTERM With One Line…
ptr727 commentedon Nov 16, 2026
Answered by the maintainer, 2026-11-15: option 1, make it the rule.
CODESTYLE.md"Interrupts in Python" requires every script's entry point to install one handler for SIGINT and SIGTERM. The handler records the first signal, raisesKeyboardInterrupt, and passes over any later one. Bringingscripts/docker_lint.pyandhost-setup/agent-safety/global_rules.pyinto line is follow-up work. Theglobal_rules.pychange waits for the maintainer's diff read. This is now work.ptr727 commentedon Nov 20, 2026
Decision triage (2026-11-19) found the open question here already answered, so it is not asked:
The maintainer's 2026-11-16 answer (option 1) approves the design of the
host-setup/agent-safety/global_rules.pysignal-handler change. Only the merge of that edit waits on his diff read. NeitherCODESTYLE.md"Interrupts in Python" norglobal_rules.pyhas changed onmainyet, so this is ordinary work for an attended run. #4100 is a related open question that edits the same bullets, so its answer should land in the same pull request.ptr727 commentedon Nov 20, 2026
Backlog burndown claim (2026-11-19 attended run, round 1, group 2): branch
burndown/interrupt-signal-rules.Issues: #4146, #4100, #4218.
Predicted file set:
CODESTYLE.mdhost-setup/agent-safety/global_rules.pytests/test_global_rules.pyscripts/docker_lint.pytests/test_docker_lint.pyGenerated from those: the include regions in
.agents/skills/python-codestyle/SKILL.mdand.agents/skills/shell-codestyle/SKILL.md, and their.github/skillsand.claude-plugincopies and source digests.Route SIGINT and SIGTERM Through One Handler, Bound the Child Wait, a…