Skip to content

Tracker: CODESTYLE.md > Shell #4218

Closed

Description

@ptr727

Per-unit tracker for findings raised against this canonical unit by a carrying repository's review, per pr-review-conduct Merge Gate item 3.

Findings

  • State that a script started in the background by a non-interactive Bash caller inherits an ignored SIGINT. Raised by CodeRabbit on Resync the Instruction Set and Skills Tree with the Hub and Bump the Hub Pins PhotoCleaner#270, against the carried CODESTYLE.md "Interrupts in Shell" bullet on the INT and TERM traps, carried at the hub's main 80c5ece0. Bash ignores SIGINT for an asynchronous command when job control is off, and a signal ignored on entry cannot be trapped. So a directed SIGINT never runs the cleanup the rule requires. The reviewer asks the rule to name a launch constraint that restores the disposition, or to state the limitation.

    • Not judged here. The carrier declined it under outcome 2, since the text is the hub's to change.
  • State how a directed SIGTERM reaches a script waiting on a foreground launcher. Raised by CodeRabbit on Resync the Instruction Set and Skills Tree with the Hub and Bump the Hub Pins PhotoCleaner#270, against the carried CODESTYLE.md "Interrupts in Shell" bullet on running a long-running external command, the foreground-launcher paragraph, carried at 80c5ece0. Bash defers the trap until the foreground launcher exits. A SIGTERM sent to the script's PID alone does not reach the launcher, so the trap and any lock the script holds wait until the launcher ends. The reviewer asks the rule to require that the supervisor signal the process group, or to name another stop path.

    • Not judged here. The carrier declined it under outcome 2, since the text is the hub's to change.

🤖 Generated with Claude Code

Activity

  1. ptr727 commented on Nov 20, 2026

    @ptr727
    OwnerAuthor

    Decision triage, 2026-11-19. Should the two CodeRabbit findings against CODESTYLE.md "Interrupts in Shell" from ptr727/PhotoCleaner#270 become rule text, a stated limitation, or be declined: a script started in the background with SIGINT ignored, and a SIGTERM sent to a script waiting on a foreground launcher?

    Both findings describe real Bash behaviour that no script can change. A script started with SIGINT ignored cannot trap it. A script waiting on a foreground command runs its TERM trap only once that command returns. PhotoCleaner declined both under outcome 2, since the text is the hub's. These answers are kept consistent with the three Python findings on #4100. The proposed test: a gap no script can close is stated in one sentence where it changes what the sender of a signal does, and is not turned into a new requirement.

    Finding 1: a background script inherits an ignored SIGINT

    1. State it once, in the general "Interrupts" section, for both languages (recommended). One sentence: a script started with SIGINT ignored, as a non-interactive shell starts a background child, keeps it ignored, so a stop meant to reach it sends SIGTERM. Bash leaves it no choice. The hub's Python scripts keep the ignore by choice, and Tracker: CODESTYLE.md > Python #4100 finding 2 recommends that the rule say so. The Shell trap bullet already sends SIGTERM to a child "because a background child ignores SIGINT". This sentence states the receiving side of that same fact, so a reader stopping such a script by hand knows which signal works.
    2. Decline. The sending side is already covered, and a directed SIGINT that is ignored leaves nothing behind, since the script runs on to its normal exit. This saves a sentence, but a reader whose kill -INT does nothing gets no explanation.

    Finding 2: a SIGTERM sent to the script alone waits for a foreground launcher

    1. State it in the launcher paragraph and name the process group as the stop path (recommended). One or two sentences: a script waiting on a foreground command runs its TERM trap only once that command returns, so a SIGTERM sent to the script alone stops it when the command ends. A stop that must be prompt signals the process group, as a service manager's control-group stop does. The rule's own pieces can produce this case. A parent script's trap sends SIGTERM to $! alone. If that child is a script waiting on uv run in the foreground, the tool never sees a signal, because it inherited SIGINT ignored. The rule already states a similar delay for a script that runs as PID 1 before its exec.
    2. Decline under GOVERNANCE.md "Trust Boundaries and Hardening Effort". The stop is delayed, not lost. The trap still runs and releases what the script holds once the launcher returns.
    3. Add a requirement that such a script start its launcher under setsid and that a trap signal the group. This closes the gap, but it reverses the foreground-launcher design that Describe sh Hooks and Launchers in the Shell Interrupt Rule and Correct Four Carried Rules #4149 and Name uv pip install as a Foreground Launcher in Interrupts in Shell #4252 settled, and it adds a process group to manage in every script that uses a launcher.

    Evidence:

    Effect on work in flight: None. No open pull request touches the section. Both sentences can ride in the same pull request as the #4146 and #4100 changes, which also regenerates .agents/skills/shell-codestyle/SKILL.md and .agents/skills/python-codestyle/SKILL.md through scripts/build_dist.py. No existing script needs editing under either recommended option.

  2. added
    decision
    on Nov 20, 2026
  3. ptr727 commented on Nov 20, 2026

    @ptr727
    OwnerAuthor

    Maintainer's answer, 2026-11-19 (decision triage): option 1 on both findings. Each finding becomes a one-sentence fact with no new requirement. Finding 1 goes once in the general "Interrupts" section: a script started with SIGINT ignored keeps it ignored, so a stop meant to reach it sends SIGTERM. Finding 2 goes in the launcher paragraph: the TERM trap waits for the foreground command, so a stop that must be prompt signals the process group. This is now work, in the same pull request as #4146 and #4100.

  4. removed
    decision
    on Nov 20, 2026
  5. ptr727 commented on Nov 20, 2026

    @ptr727
    OwnerAuthor

    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.md
    • host-setup/agent-safety/global_rules.py
    • tests/test_global_rules.py
    • scripts/docker_lint.py
    • tests/test_docker_lint.py

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions