Skip to content

Optional hardening: step 4 of the handoff skill does not refuse while step 2's publish refusal is pending, so a session that runs both blocks in one shell without set -e writes the swap over it #340

Open

Description

@brettheap

Found by lane 2 in its review of #303's fix round, which it stopped when lane 5 kept the re-check (#303 comment 6386768024, "a possible finding for lane 5 to check"). Lane 5's independent re-check confirmed it as a design limit, not a regression (#303 comment 6386876743, section "Lane 2's possible finding"). Lane 3 asked for this issue (6386894721). Severity: LOW, optional. It is new scope: it touches lines #303's approved change did not.

How each point was established. Read = found by reading the code. Probed = run. Lane 5's probes ran at 4e032f8.

The defect

#303's finding 1001 (a204244) ends step 2's block with [ "$pub_rc" = 0 ] || [ -n "$handoff_unpublished" ] || (exit "$pub_rc") (skills/handoff/SKILL.md:299; introduced by #303, and main's step 2 is a bare publish-handoff line at :276). It is a subshell on purpose. A bare exit would kill a persistent shell, and the skill's own sread stops with a plain exit only because its blocks are separate calls.

So the guard stops the skill only where the status is read (a block run as its own call) or under set -e. A session that runs steps 2 and 4 in ONE shell without errexit goes on. Step 4's block (SKILL.md:533–825, main :501–788) has no guard on a pending refusal. Its only read of step 2 is handoff_unpublished (:779).

This is not a regression. Step 2's status is restored to exactly 969806f's contract (the state before R7), and on main (33ce26d) there is no guard at all. The contract is status plus prose.

Reproduction

Probed by lane 5 at 4e032f8: step 2's block, then step 4's, in one shell with answers (publish 7, intent 0), under bash and zsh, without set -e. log, append-line and set-row-state are all reached. At 969806f the same happens. Under set -e the guard stops the run with 7. Evidence: /workspace/projects/.openrepotools-private-prep/work-20261021/lane5/w303/probes/block2.sh and runblock.sh.

Lane 5 notes the test comment at tests/test_handoff_skill_303.py:255–257 ("Steps 2 and 4 in ONE shell, as a session runs them") is a model, not a fact. No test can pin that (7,0) stops step 4 there, because there is no errexit. :261 builds that script.

What a fix needs

  • A guard at the top of step 4's block (SKILL.md:533) that refuses while a publish refusal is pending, meaning pub_rc is set and non-zero and handoff_unpublished is empty. It must read an unset pub_rc as no refusal, because step 4 normally runs as its own call (the _step4 tests, :218–224). It must not use a bare exit, which would kill a persistent shell.
  • One open design point, to decide first: in a persistent shell without errexit, nothing short of wrapping the block's body in a condition stops it. If that is judged too invasive for a ~290-line block, close this as a documented limit and correct the test's docstring instead.
  • A pin: step 2 then step 4 in one shell without errexit with answers (7,0) reaches none of log, append-line and set-row-state. It sits beside test_steps_2_and_4_in_one_shell_write_the_swap_and_name_the_gap (:255), which must still pass with (1,10).
  • Must still pass: test_skill_shell_blocks, test_handoff_skill_72_80 and test_command_builtin_errexit_292, which parse the skill's fenced blocks (lane 5 ran them, 73/73), and the test_handoff_skill_303 selection.
  • Must not change: step 2's own last line (SKILL.md:299); lane-handoff, which refuses the same case before any write.

Scope and order

Lands after v1.1.0 and after #303, in v1.2.0, and only if the design point above says yes. Not a #303 blocker. Related: finding 1001 (a204244).

Not included: any change to step 2, or to lane-handoff.

Lane: openRepoTools-4

Activity

  1. added this to the v1.2.0 milestone on Oct 24, 2026
  2. modified the milestones: v1.2.0, v1.2.1 on Nov 8, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions