Skip to content

Draft: CI check #82 S6 on the full stack - #45

Draft
it-baron wants to merge 10 commits into
mainfrom
check-082-s6
Draft

it-baron wants to merge 10 commits into
mainfrom
check-082-s6

Conversation

@it-baron

Copy link
Copy Markdown
Contributor

CI check only. #82 S6 (developer-2, 82-s6.34e97939) on check-082-s5 (S5 7c5f793 and below), plus the CI-only codex_remote step.

Issue: #82

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 app server runs as
`codex --remote unix://`, and the app server, not the client, holds its
thread. Discovery therefore saw the app server's pid, the name never
bound by process, and the session got neither its title nor its role,
root included (#82).

The claim now gets the thread from the bridge itself:
- spawn::runs_remote is the one decision whether a Codex start runs on the
  app server (B-2). run_args' --remote and the claim both use it. Unix
  only: there the app-server calls exist and the launch execs the agent;
  elsewhere a start runs as before.
- claim() reserves the start's name in SessionNames.claimed while the
  pending lock is held, releases the lock, and asks the app server
  (codex_wake::create_thread, S1) to create the thread (cwd, model and
  effort, never approvals) and name it. A 5 s call never blocks other
  starts and claims (B-1).
- On success it binds names.sessions["codex:<thread>"] to the name,
  writes names.json at once, and records the launch with the client's pid.
  The launch resumes that thread with the first prompt
  (Reply::Launch.resume; main.rs already builds `codex resume <run args>
  <thread> <prompt>`).
- On failure it binds nothing, frees the name, and fails the start with
  "The Codex app server did not create the session's thread: <why>. Start
  the session again." (OQ-1).
- A name claimed this way stays taken until its session is listed under
  it, or until the bind window ends, so a start made in between gets the
  next number (B-1).
- spawn and close look the calling session up after a discovery round
  when it is not known yet. A session started a moment ago acts in its
  role on its very first request (B-8).

Register: the REQ-028 and REQ-041 lines (B-9, clarify-1's 82-b9-s3a).
CHANGELOG: a Fixes line.

Tests:
- spawn_tests: the B-1 reservation; B-2 run_args --remote equals
  runs_remote.
- tests/codex_remote.rs, end to end with a stand-in app server and client
  (its codex-hold processes are kept, then killed and reaped at the end):
  - the thread is created and named, the client resumes it with the
    prompt, and the session is listed under its name (AC-1);
  - a start of the same role made while the previous claim waits for its
    thread (the stand-in holds thread/start back for 1 s) gets the next
    name, deterministically (B-1);
  - two roles in one folder get two threads and names (AC-3);
  - root acts on its first request right after the claim, and an unbound
    thread with the same Codex name gets no root (AC-2, B-8).

Issue: #82
…bound

#82 S3c. A product change and its tests.

The change (root's decision on G-1): when the app server made and named a
start's thread but the bridge could not write names.json, the start's
name stays reserved. The thread stays, unbound and without a client
(OQ-3), and discovery lists it under its Codex name, which is the
start's. Releasing the reservation at once (S3a) let a start made before
that listing take the same name, and two sessions would then share it.
Now the reservation ends when the thread is listed under the name, or
when the bind window ends. A failure where the app server made no usable
thread still frees the name at once. Both cases go through
SessionNames::claim_failed with ClaimFailure::NoThread or
ClaimFailure::ThreadMade.

Tests (AC-7, OQ-1, OQ-3):
- spawn_tests a_claim_that_made_a_thread_keeps_its_name_reserved: after
  ThreadMade the next start gets mono-qa-2, and listing the thread under
  the name ends the reservation; after NoThread the name is free at once.
- tests/codex_remote.rs a_failed_thread_creation_binds_nothing. The
  stand-in app server can refuse thread/start, never answer it, or name a
  thread without writing its rollout. In each case the start's window
  says "The Codex app server did not create the session's thread: <why>.
  Start the session again.", no client runs, and the next start gets the
  same name again.
- When names.json cannot be written (a folder stands in its place), the
  window says "Could not record the session's name; start the session
  again", and no client runs. That text differs on purpose: the thread
  was made. The thread is then listed as mono-qa-1 with that name's role
  (qa, never root), the next qa start gets mono-qa-2, and names.json and
  launches.json never bind it.
- The stand-in's state is per test, so the two tests of the file can run
  side by side.

Issue: #82
A Codex session the bridge started on the user's app server shares the
app server's pid, so close refused it, and ending that pid would end
every session in it (#82). Its launch record now keeps its own client's
pid (S2, S4); close uses it:

- The proof (spawn::stop::stoppable) still answers root first, then
  picks the session's live client pid when it has one, else its own pid,
  and says which (is_client). is_shared counts a client as its session's
  own process.
- Close checks, in order: root, caller authority, a shared process, then
  for a plain pid the app-server line as before, and for a client
  launch::is_client_of (B-6 as amended by root): the Codex program first,
  or second after node, sh, bash, zsh, python or python3; the subcommand
  is resume; the first uuid after it is the thread. The client's line is
  not searched for words, since its prompt may name the app server. A
  reused pid or another thread's client is never signalled; a uuid flag
  value before the thread and a path with spaces only refuse.
- Codex then stops the running turn (turn/interrupt); a refusal or error
  refuses the close with nothing signalled. One terminate follows, with
  the proof. A client that leads its own job group is ended with its
  group, so the native Codex child of npm's node shim ends too; never a
  group the process only belongs to.
- A client whose process ended has no client pid from the next round
  (S4), so the app server's pid and its app-server line refuse the close
  as before (B-4).
- Restart refuses a client proof with the app-server text until S6.
- Control keeps the configured Codex program to recognise the client.

Issue: #82
A Codex session the bridge started on the user's app server was never
restartable: its pid is the shared app server's (#82). With its own
client's pid in the launch record (S2, S4) and the client proof (S5),
the restart now ends that client and a new one resumes the same thread:

- restartable: a client proof passes the shared rule (stop::is_shared)
  and its line must be the resume of this thread (is_client_of), else
  "<name> has no Codex client of its own any more; restart it in its
  terminal" (RestartRefusal::NoClient). S5's interim AppServer refusal
  for a client is gone; the plain path keeps its app-server check. The
  preview, the stale check and the exit wait already use the proof's pid.
  The running turn is not stopped: the new client continues it.
- The back check (B-4): a session whose record names a client is back
  only under a live client pid other than the ended one (launch::
  back_pid), never under Session.pid, the app server's, which differs
  from every ended client. A new client that never claims ends as "did
  not come back".
- The listing's restart view counts a client as its session's own
  process, so such a session is offered a restart.

Issue: #82
Not for merge.

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