Repository navigation
feat(minimald): T44 — Detach from an exec attach with the detach keys - #3341
Conversation
serve_exec_attach now runs the leader and detach state machine of the box's own terminal, with the keys the channel negotiated. A detach ends the channel with status 0 and leaves the exec running (BCLI-068).
min box attach <box> --exec <id> now sends the session keys from the config, as the box attach does, so the daemon detaches on them (BCLI-068).
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Approved: no findings at Nothing to do. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The min box attach --exec path conforms. The daemon detaches with status 0 and keeps the exec running, as architecture.md lines 492 and 498 say. The first attach of min box exec -t still sends no keys. The daemon now gives it the default chord, so a remapped leader or detach key does not apply there. Line 498 says a -t exec re-attaches like a PTY box, and the PTY box uses the configured keys. The PR body names this gap but links no issue. Make the edit in C1, or file the issue and name it as a residual.
Ruled at b1370c2 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
…m-an-exec-attach-with-the-detach-keys
A client that does not read held the detach on the notice write. The writes now wait at most EXIT_NOTICE_BOUND, and the detach goes on.
The first terminal attach of min box exec -t sent no keys, so a remapped leader or detach key did not apply. It now builds its ssh command through exec_attach_ssh, as min box attach --exec does.
|
/revise Head 1. C1: 2. The detach can't stall behind a full window (thread PRRT_kwDOPdfcxM623fwj). Reply on both threads with the commit. Run the whole |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Ctrl-] then d ends Notes from the agent: This round touched crates/minimal/src/cmd/boxes/exec.rs, which is outside the layers. The task's attach.rs note asks that |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to the design. A -t exec now detaches with the detach keys, ends the attach with 0, and runs on, as architecture.md line 498 and line 492 require. The two commits after the earlier head close its gaps. The detach notice cannot hold the detach, and min box exec -t sends the configured keys. The PR body still says min box exec -t sends no keys. Update that paragraph before the PR leaves draft.
Ruled at 9a4287f against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minimald/src/exec.rs:501, minimal-foundry[bot] crates/minimald/src/exec/bridge.rs:2290.
minimal-review — advisory review
Verdict COMMENT — No findings.
Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.
The ssh that min box exec -t's first attach runs now comes from exec_terminal_ssh. A test checks that, with detach = "q" configured, it carries the leader and detach env vars and their SendEnv options.
…m-an-exec-attach-with-the-detach-keys
|
Round 2 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Ctrl-] then d ends Notes from the agent: Revise round 2. Both directive items were already in code from an earlier round: 44b620e bounds the detach notice and bell writes (item 2, thread PRRT_kwDOPdfcxM623fwj), and 9a4287f makes min box exec -t's attach send the session keys (item 1, C1, thread PRRT_kwDOPdfcxM623ehQ). This round adds the C1 test that the directive asks for (commit 4c70bd8). exec.rs gets exec_terminal_ssh, the ssh builder that attach_exec_terminal uses. tests.rs gets box_exec_t_attach_sends_configured_session_keys: with detach = "q" configured, that ssh carries the leader and detach env vars and their SendEnv options. exec.rs is outside layers:, as the directive says. Full suites: |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to the design at this head. Since the last PASS, the PR adds a wrapper that does not change behaviour, a test for the keys on min box exec -t, and a clean merge of main. Line 498 of the architecture says a -t exec is re-attachable and a detach leaves it running. Line 376 says a detach exits 0. The daemon and both clients still do this. The "Not done" note in the PR body is stale. Update it to say that min box exec -t sends the configured keys.
Ruled at b2b8cf4 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
A session-key config that is not valid now ends min box exec -t with no exec started, not with a running exec that has no attach.
|
/revise Head 1. Read the session keys before the exec starts (thread PRRT_kwDOPdfcxM627PtE). 2. Fix the contradicting comment (thread PRRT_kwDOPdfcxM627PtK). Reply on both threads with the commit. Run the whole |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
Round 3 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Ctrl-] then d ends Notes from the agent: Revise round 3. crates/minimal/src/cmd/boxes/exec.rs is outside the task's layers. An earlier round already changed it to send the session keys on |
…m-an-exec-attach-with-the-detach-keys
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The new commit makes min box exec -t resolve the session keys before it starts the exec. A session-key config that is not valid now stops the command before any side effect, so no PTY exec runs without its attach. This is consistent with min box exec (architecture.md line 498) and with the fail-closed rule. The rest of the change keeps the status from the PASS on b2b8cf4e. There are no conditions.
Ruled at d6d59e9 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
…m-an-exec-attach-with-the-detach-keys
|
Round 4 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Ctrl-] then d ends Notes from the agent: Revise round 4. The note names head b2b8cf4, but commit d6d59e9 on the branch already addressed both findings. Finding 1: cmd_box_exec resolves the session keys before the exec starts, and passes them to exec_attach_ssh_with_keys. The test box_exec_t_invalid_session_keys_starts_no_exec pins it. Finding 2: d6d59e9 fixed the doc comment on box_via_ssh. This round fixed only the inline comment in box_via_ssh_with, which still said the exec path 'has no detach'. It now says that the |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms to the design. The compare from the last PASS changes one code comment in box_via_ssh_with, and the comment is correct. The two merges of main contain no conflict edits and do not touch the exec attach path. The exec detach still exits 0 and leaves the exec running, as architecture.md lines 376 and 498 require.
Ruled at a20e183 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
…m-an-exec-attach-with-the-detach-keys
An awaited bell parked the exec attach relay for up to 5 s per leader press behind a client that does not read. The bell now goes only when the client has room for it. The detach notice waits at most the 2 s host probe bound, as the box terminal's detach does.
|
Round 5 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Ctrl-] then d ends Notes from the agent: Revise round 5. The leader bell is now a single non-blocking write (ring_bell, one poll by now_or_never). The detach notice now waits at most DETACH_NOTICE_BOUND, which is HOST_PROBE_TIMEOUT (2 s), the same bound as the box terminal's detach. The comment no longer says the notice never holds the detach. New test serve_exec_attach_detach_key_ends_channel_exec_runs_bell_never_stalls pins this. I did not check that the new test fails on the old code. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The new commit changes only the exec attach relay in bridge.rs. The leader bell no longer waits on a client that does not read. The detach notice now waits at most 2 s. The box terminal does the same thing in box_runtime.rs. A detach still exits 0 and the exec keeps running, as architecture.md line 498 and line 376 require. The earlier PASS stands for the rest of the change. The PR body still says min box exec -t sends no keys. Commit d6d59e95 fixed that, so update the body.
Ruled at 09a572a against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
T44 — Detach from an exec attach with the detach keys
slice: S4
kind: task
covers: BCLI-068
size: M
est: 140 code, 160 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: a detach from an exec attach exits 0, pinned by exec_attach_detach_key_returns_0_exec_keeps_running
observability: none new
layers:
- client:
- crates/minimal/src/cmd/boxes/attach.rs: the exec attach and
min box exec -t's first attach send the session keys, as the box attach does- crates/minimal-client/src/attach.rs:
attach_commandsends the session keys on an ExecAttach channel- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests
test: cargo nextest run -p minimal exec_attach_detach_key_returns_0_exec_keeps_running
- daemon:
- crates/minimald/src/exec/bridge.rs:
serve_exec_attachruns the same leader/detach state machine as the box PTY attach. A detach ends the channel as a detach, with exit 0, and leaves the exec running.test: cargo nextest run -p minimald serve_exec_attach_detach_key_ends_channel_exec_runs
produces: none
consumes: none
proof: Ctrl-] then d ends
min box attach <box> --exec <id>with exit 0, the exec keeps running, and a second attach reaches it.Proof
Ctrl-] then d (or the configured leader and detach keys) ends
min box attach <box> --exec <id>with exit 0. The terminal showsDetached from exec <id>. It keeps running., the exec keeps running,min box showstill lists it, and a secondmin box attach <box> --exec <id>reaches it.Notes from the agent: Out of scope: crates/minimald/src/exec.rs changed in one call site. serve_exec_attach needs the keys the channel negotiated, and only the dispatcher in exec.rs holds the channel's env vars. Without this change the daemon cannot honour a remapped leader or detach key.
Not done:
min box exec -t's first attach is in crates/minimal/src/cmd/boxes/exec.rs (attach_exec_terminal), not in attach.rs, and that path has no config_dir. It still sends no keys. The daemon now gives a channel without keys the default keys, so Ctrl-] d detaches there too, but a remapped chord in config.toml does not apply tomin box exec -t. A follow-up can thread global.config_dir into TtyAttach::Terminal and call exec_attach_ssh.minimal-client/src/attach.rs: attach_command already sent the keys when given Some. Only its doc comments changed, to say an ExecAttach channel sends them.
New printed text, not fixed by the task: the daemon writes
Detached from exec <id>. It keeps running.on the terminal at a detach. The box attach writesDetaching from session.in the same place. The exec detach does not write terminal unwind codes, because the daemon does not track the exec terminal's modes.The minimal test cannot drive a real detach through the in-process harness, because TestServer::list_running_exec registers an exec with no terminal. It checks the keys the attach's ssh sends (default and configured), the 0 ending, the live listing and a second attach. The minimald test drives the detach through attach_terminal_keyed on a live terminal.
Tests
cargo nextest run -p minimal exec_attach_detach_key_returns_0_exec_keeps_runningcargo nextest run -p minimald serve_exec_attach_detach_key_ends_channel_exec_runsVerify
min task run agent-verifytimed out after 1800s, so this PR is a draft.Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimald/src/exec.rsCloses #3331