Skip to content

Draft: 0.8.0 candidate (#106, #95, #82 pre-S7) - #46

Draft
it-baron wants to merge 3 commits into
mainfrom
check-080-rc
Draft

it-baron wants to merge 3 commits into
mainfrom
check-080-rc

Conversation

@it-baron

Copy link
Copy Markdown
Contributor

CI check of the 0.8.0 landing shape on main 593056e: #106 test fix, #95 squash, #82 squash without S7 (82-squash-pre-s7.63c0e018).

Issue: #35

@it-baron
it-baron force-pushed the check-080-rc branch 3 times, most recently from 01a2aae to 7abafc1 Compare November 30, 2026 02:01
The admin_messaging test posts_without_a_mention_go_to_the_root_session
assigned root and only then accepted the stand-in session's inbox. The
assignment delivers the role's instructions (REQ-026) within the call. The
root role's frame (the rendered message, JSON-escaped in the PeerFrame) is
about 8.25 KB since REQ-057 added one sentence to ROOT_PROMPT. That is over
the 8192-byte macOS unix socket buffer (net.local.stream.sendspace), so the
bridge's write waited for a reader that only came after the call. After
write_frame's 5 s timeout the delivery became uncertain, the connection was
dropped mid-frame, and the test read a cut line ("Invalid or oversized
message frame"). Linux buffers are larger, so only macOS failed.

The test now reads while the assignment runs, as a live session does. No
product change: a live Claude reads its inbox at once.

Issue: #106
The bridge never ends the process of a session that holds root (REQ-028:
the session the user gave root, or the one started as root). Close and
restart refuse it on every path, the user included, with one text: "<name>
holds root; the bridge does not close or restart it". To end it, the user
gives it another role first, or ends it in its own terminal.

- spawn::stop (a leaf module): Stoppable has a private pid, and only
  stoppable() can build it. It runs holds_root on the target itself.
  process::terminate takes it by value on unix and on Windows, so no code
  can signal a session without the root check. Its only callers are close
  and restart.
- may_close takes the proof's answer and refuses a root holder first for
  every caller, then checks the caller's authority. CloseRoot is gone.
- restartable refuses after NotLive and Paired and before NoRecord. It
  returns the proof, and the preview shows the proof's pid. No
  "restarting" is sent for a root holder.
- Listing: a root holder's restart view is {"holds_root": true, "refused":
  text}. Control::list sets it from root_holders. MCP list_sessions gets
  the field too (additive).
- Admin page: no Close and no Restart for it, in the Projects row (which
  says why) or the conversation header.
- Agents are told, in the MCP server instructions (mcp::INSTRUCTIONS), in
  the close_session description and in ROOT_PROMPT: "Never end a root
  session's process (no kill, no closing its terminal); the bridge refuses
  to close or restart it."
- Register: REQ-057, plus the REQ-028 and REQ-049 exceptions;
  restart-requirements.md; README sections; CHANGELOG.

REQ-057 supersedes these REQ-028 expectations, which the tests change:
- the user closes a root session (spawn_tests may_close, and the user's
  page close in tests/spawn.rs);
- "Only the user closes a root session" (root closing itself);
- "Only a session with the root role" for a reviewer's close of root (the
  root check now comes first).

Tests (REQ-057):
- pure: the proof and may_close for four callers and two root bindings; a
  name-taker and a renamed session are accepted;
- one text for close and restart; the listing view; AC-5 on all three
  instruction texts;
- end to end with stand-in sessions: restart refused (the pid alive, never
  "restarting") and close refused from the page, the CLI request and
  root's own close_session, with positive controls;
- headless page QA (projects.root).

Issue: #95
A Codex session the bridge starts on the user's Codex app server runs as
`codex --remote unix://`; the app server, not the terminal client, holds
its thread. Discovery saw the app server's pid, so the name bound by
process never matched: the session kept Codex's title, held no role
(root included), and close and restart refused it, since ending that pid
would end every session in the app server (#82).

Start (REQ-028, REQ-041):
- The claim creates and names the thread on the app server itself
  (thread/start with cwd, model and effort, never approvals or sandbox;
  thread/name/set), outside every lock, and gets its id only once the
  rollout exists. It binds names.sessions["codex:<thread>"] and the launch
  record (with the client's pid, unix only) at once, and the launch
  resumes that thread with the first prompt. spawn::runs_remote is the one
  remote decision for run_args and the claim.
- A claimed name stays taken until its session is listed under it or the
  bind window ends; a failure that made no thread frees it at once, and
  one that made a thread but could not write names.json keeps it.
- A failed creation fails the start with "The Codex app server did not
  create the session's thread: <why>. Start the session again." and binds
  nothing.
- spawn and close look a caller that is not known yet up after a
  discovery round, so a new session acts in its role on its first request.

Close (REQ-028):
- Session.client_pid (never on the wire) comes each round from the launch
  record while that process lives; a restart's claim moves the record to
  the new client.
- spawn::stop::stoppable still answers root first, then picks the client
  pid when there is one. Close requires the client's line to be the resume
  of this thread (launch::is_client_of: the Codex program first, or
  second after node, sh, bash, zsh, python or python3; the subcommand
  resume; the first uuid after it is the thread), asks Codex to stop the
  running turn (turn/interrupt), and sends one SIGTERM through the proof;
  a client that leads its own job group gets it with its group, so an
  npm shim's native child ends too. A client that ended is refused by the
  app-server rule, as before.
- A closed session leaves the live set at once (Event::Closed, before the
  signal), so delivery, wake and steer treat it as ended; its record keeps
  closed_at, and it stays hidden while the app server still has its thread
  loaded. Once a real scan (Round::scanned) no longer finds the thread
  the mark ends, so a thread resumed by hand is listed again; a failed
  Codex read, whose kept part lacks every hidden session, ends no mark. A
  failed signal unmarks it.

Restart (REQ-049):
- A client proof restarts by its own client; NoClient refuses a recorded
  pid that is not this thread's client. After the restart the session is
  back only under a new live client pid, never the app server's; a new
  client that never claims ends as "did not come back".
- Such a session is away, not ended: it leaves the live set while the app
  server keeps its thread loaded, and a message to it waits as pending.
  The mark lasts until it is back or a real scan no longer finds its
  thread, never by time. It is not restarted from the page again; its
  messages wait until the thread unloads, then follow the ended-session
  rule.

Words: CHANGELOG Fixes line; README's close and restart sections, the
0.6.5 known issue removed; REQ-028, REQ-041 and REQ-049 register lines.
CI: tests/codex_remote.rs runs in "Store, page and phone tests".

Tests changed outside their own step:
- tests/spawn.rs a_restart_claim_takes_over_the_client_pid (S4's, changed
  in S5): it seeds an ended client pid, since a live one makes the session
  a client, and after the takeover checks that the new client runs and is
  listed instead of reading the preview. The takeover assertion stands.
  The live-client restart is covered by tests/codex_wake.rs
  restart_ends_a_codex_client_and_waits_for_the_new_one (S6).
- tests/codex_remote.rs's stand-in client (S3a) became a /bin/sh script
  in S7, so close's client rule matches it.

Issue: #82
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