8000 feat(runner): run one opted-in agent on the PTY runner (#240) by simon-inkie · Pull Request #241 · simon-inkie/inkie-deck · GitHub
[go: up one dir, main page]

Skip to content

feat(runner): run one opted-in agent on the PTY runner (#240) - #241

Merged
simon-inkie merged 22 commits into
mainfrom
pty-slice-2
Nov 22, 2026
Merged

simon-inkie merged 22 commits into
mainfrom
pty-slice-2

Conversation

@simon-inkie
@simon-inkie simon-inkie commented Nov 19, 2026 •
Copy link
Copy Markdown
Owner

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


Devin Review

simon-inkie and others added 10 commits November 19, 2026 15:02
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>
devin-ai-integration[bot]

This comment was marked as resolved.

simon-inkie and others added 2 commits November 19, 2026 16:13
…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>
@simon-inkie
Copy link
Copy Markdown
Owner Author

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.

simon-inkie and others added 9 commits November 19, 2026 17:13
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>
@devin-ai-integration devin-ai-integration Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Devin Review

Comment on lines +172 to +176
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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +103 to +120
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]]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@simon-inkie
Copy link
Copy Markdown
Owner Author

Answering the two new Devin notes on 015c08b.

  1. Restricted procfs (hidepid) aborting leaderless recovery: agreed, and it is the same shape as an unwrapped /proc/<pid>/environ read that a review also found. It fails closed (recovery refuses, the claim stays, nothing is signalled or unlinked), so it cannot cause a second writer, but it can leave a stale lock needing manual removal. Deferred to the locked-state work in PTY lock admission is too blunt: surface a locked state with recovery #244, where I have added it: treat an unreadable or vanished non-member as not ours and continue, while still refusing if a member cannot be verified.
  2. Leaderless recovery lacking kernel coverage: fair. The new tests mock /proc and process.kill, and the launch test checks the session marker on the leader only. A real process-group test (spawn a leader and a descendant, kill the leader, assert recovery verifies the survivor via inherited marker) is the right follow-up. Also tracked on PTY lock admission is too blunt: surface a locked state with recovery #244, since this path is fail-closed and the safety-critical guard-removal checks already exist.

Neither changes the safety property (never a second writer, never unlink while the child runs), so not holding this PR for them.

@simon-inkie
simon-inkie merged commit a3dd1ae into main Nov 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0