Repository navigation
feat(runner): run one opted-in agent on the PTY runner (#240) - #241
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…down cleanup (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…der switch (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…er for opted-in agents (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…rename the SPEC folder (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
|
Fixed in 4af6d74: the PTY child now keeps the inbox push guard working (regression test added), and the SPEC folder is renamed to .specs/240-pty-agent-slice-2. The four SPEC-update commit titles that read 'for #240' cannot be reworded without rewriting pushed history; the squash merge title will carry '(#240)'. Full gates and suite green locally. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…rrors (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
…t-in removal, recovery retried on start (#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
#240) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Simon Dixon <simon-inkie@users.noreply.github.com>
Reread the claim under flock after owner death, refresh cached locked claims before blocking unrelated starts, verify leaderless process groups by session id, bound shutdown test waits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| for (const entry of readdirSync("/proc")) { | ||
| const pid = Number(entry); | ||
| if (!validPid(pid)) continue; | ||
| const member = processInfo(pid); | ||
| if (member?.group !== group || !live(member.state)) continue; |
There was a problem hiding this comment.
🔍 Restricted procfs blocks leaderless recovery
With hidepid=1, verifyGroup reads /proc entries for unrelated users before it can check group membership. One denied read aborts recovery even when every member of the stale PTY group is readable.
Was this helpful? React with 👍 or 👎 to provide feedback.
| vi.mocked(readFileSync).mockImplementation((path, options) => { | ||
| if (path === `/proc/${member}/stat`) return statText(member, group, group, "2"); | ||
| if (path === `/proc/${secondMember}/stat`) return statText(secondMember, group, otherSession ? 1 : group, "3"); | ||
| if (path === `/proc/${member}/environ`) return `DECK_PTY_SESSION_ID=${sessionId}\0`; | ||
| if (path === `/proc/${secondMember}/environ`) return `DECK_PTY_SESSION_ID=${otherToken ? "different" : sessionId}\0`; | ||
| return readFile(path, options); | ||
| }); | ||
| let groupAlive = true; | ||
| const kill = vi.spyOn(process, "kill").mockImplementation((pid, signal) => { | ||
| expect(pid).toBe(-group); | ||
| if (!groupAlive) throw Object.assign(new Error("Group exited"), { code: "ESRCH" }); | ||
| if (signal === "SIGKILL") groupAlive = false; | ||
| return true; | ||
| }); | ||
|
|
||
| if (verified) { | ||
| await expect(recoverRunnerLock(file)).resolves.toBe("recovered"); | ||
| expect(kill.mock.calls).toEqual([[-group, 0], [-group, "SIGKILL"], [-group, 0]]); |
There was a problem hiding this comment.
🔍 Leaderless recovery lacks kernel coverage
The test mocks both /proc and process.kill. The launch test checks the UUID only on the leader, leaving descendant inheritance and real group exit untested.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Answering the two new Devin notes on 015c08b.
Neither changes the safety property (never a second writer, never unlink while the child runs), so not holding this PR for them. |
Second slice of #153. One agent, opted in by an instance flag and a per-agent .runner file, can run on PtyRunner in a fresh Deck-started session; send, inbox push and the thread terminal view go through the runner for that agent only. Every other agent stays on tmux. Linux only, at most one PTY agent per instance.
Steps: runner promoted out of tests; registry, lock, launch environment allowlist and shutdown cleanup; base script guards (boot, workspace, push and provider switch skip or refuse opted-in agents); routes and view with an @xterm/headless screen buffer (new MIT dependency) and fail-closed delivery checks.
Not in this PR: a real Claude run (build step 5, manual try script in the SPEC) and any change to the default runner. Local gates and full suite green (one earlier load-related flake in the runner tests, two clean reruns). SPEC: .specs/153-slice-2-pty-agent/SPEC.md