Repository navigation
Handoff: the command source writes part 2 (HO3) - #775
Conversation
Lens A (safety and bypass), head 481ed66Verdict: SAFE. No blocking or major findings. The command comes only from the person's settings, runs with no shell, and is killed with its whole process group. It fails closed in every failure case I tried to construct. Ran on macOS in my own worktree, one at a time: What holds
Minor
|
Lens BVerdict: NOT SAFE (one blocking item: a new test is red on Linux, and so is CI's "Test Server 3"). The design and the wait-check refactor are right; the fix is small. Reviewed head Blocking
MajorNone. Minor
Wait-check behaviour: unchanged (verified)
Failure rules vs design
Tests fail on old code; spot-checks
State question
|
Under `timeout` (Linux) a missing program is exit 127, not a spawn error, so the reason read "exit code 127". Exit 126/127 now read "its program could not start (exit code N)" on every platform. Also from the review of #775: - stdin is closed (an empty input), so a program that reads it ends instead of waiting 60 s. Optional in the shared runner; wait checks run as before. - Part 2 sits between begin and end lines, so the command's output cannot pass as another part. - A test that the command runs once while the handoff waits for a slot. - Docs: the server's environment is passed, stderr counts toward the cap, a cached failure is kept during a slot wait, point the command outside the repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix round, head 8f06237Blocking (lens B 1): fixed
Lens B minors
Lens A minors
Tests (Linux)
|
With `source: command`, the handoff service runs the program from the person's handoff settings in the project folder, on the runner wait checks use (now `makeSettingsProgramRunner` in waits/WaitJudges.ts, shared): no shell, a 60 s timeout, a 32 KB cap, the thread and project ids in its environment. Its trimmed output is part 2 of the handoff message. A non-zero exit, a timeout (partial output unused), empty output, output over the cap, a program that cannot start or a project that cannot be read is a failure: at the idle trigger the handoff is skipped; at the size backstop it hands off with parts 1, 3 and 4 and says the command failed. It runs after the settle, right before the send; a handoff waiting for a slot keeps its output. Off by default; the agent source is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under `timeout` (Linux) a missing program is exit 127, not a spawn error, so the reason read "exit code 127". Exit 126/127 now read "its program could not start (exit code N)" on every platform. Also from the review of #775: - stdin is closed (an empty input), so a program that reads it ends instead of waiting 60 s. Optional in the shared runner; wait checks run as before. - Part 2 sits between begin and end lines, so the command's output cannot pass as another part. - A test that the command runs once while the handoff waits for a slot. - Docs: the server's environment is passed, stderr counts toward the cap, a cached failure is kept during a slot wait, point the command outside the repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8f06237 to
9c796a3
Compare
What / why
Handoff design row HO3: the
commandsource now writes part 2 of the handoff message.With
handoff.source: "command", the handoff service runs the program inhandoff.command(from the person's settings) in the thread's project folder, right after the settle and before the send. It reuses the wait checks' runner: the process part ofmakeCheckJudgeis nowmakeSettingsProgramRunnerinwaits/WaitJudges.ts, and the check judge and the handoff both call it. The command runs with no shell, a 60 s timeout (the process is killed), a 32 KB cap, andT3CODE_THREAD_ID/T3CODE_PROJECT_IDin its environment. Its trimmed output becomes part 2 ("Handoff from the handoff command:").Failure rules (design 4.3): a non-zero exit, a timeout (partial output unused), empty output, output over 32 KB, a program that cannot start, or a project that cannot be read all count as failure.
A handoff waiting for an agent slot keeps the command's output (keyed by the handoff's ids and the command). It does not run the command again every 5 s.
Off by default and no migration. Mode
offand theagentsource run no command, and theagentmessage is unchanged.State question (design §5, Source: command)
Tests
fork/handoff/handoffCommand.test.ts(new, real processes):;,$(...)and backticks are passed literally and create nothingHandoffService.test.ts, new describe "thecommandsource":offor theagentsource runs no commandcontracts/handoff.test.ts: the command comes only from the person's settings.handoffis inFORK_PERSON_ONLY_KEYS, not agent-writable, and no T3 tool may name it (the HO1 rule checked bypersonOnlySettings.test.ts). A repot3.jsonhas nohandoffand drops one written there.source: commandwithout a command is refused.HandoffService.tsandhandoffMessage.ts. 5 fail; the 2 "runs no command" guards pass on both, as they should.handoffCommand.test.tscannot run on the old code because the module does not exist.returntimedOutlinevp test run src/fork/handoff src/fork/personOnlySettings.test.ts src/waits/WaitJudges.test.tsand the contracts handoff and forkSettings tests all pass. The exception is 2 systemd "unit judge" tests inWaitJudges.test.ts(and 1 inWaitService.checks.test.ts). They also fail on unchanged main on macOS, which has no systemd, and are not touched here.pnpm fmt:check, lint on the changed files, server typecheck andfork-seam-checkall pass.Behavior change for old settings
The HO1 settings already accepted
source: "command"with acommand. A settings file that held one did nothing before; after this PR, that command runs at each handoff. Only the person can write that setting.General vs project
handoff.commandat a read-only script that prints its state file. The design recommendscommandfor orchestrators andagentfor the assistant.Upstream fit
Fork-only: every changed file is a fork file (
fork/handoff/,waits/,docs/fork/,packages/contracts/src/handoff.test.ts). No upstream lines were added, andfork-seam-checkpasses.Handoff design row HO3
🤖 Generated with Claude Code