Repository navigation
chore(conn-server): merge train for the audit PRs - #327
Merged
Merged
Conversation
…t3_* names The preview tunnel carries a remote desktop's browser to loopback ports, as apps/server does. gen-upstream now also lists HttpRouter.add routes. Peer calls retry once under the t3_* name when an older peer does not know the conn_* tool. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Claude keeps conn MCP - Expand composer context references (thread chips and the rest) before every provider turn, byte-equal to projectComposerContextForProvider; conn_thread_read and conn_thread_send accept thread_ ids. - End provider-native subagents whose process is gone: cancelled at engine start, interrupted at pump end (not on shutdown). - Bind the listener and give /mcp its address before recovered runs resume, and reconnect the conn MCP server once when Claude reports it unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… only when its process ended Closing a session on a shared Codex app-server (RuntimeShared) still ended its pump, and the pump-end cleanup then interrupted every open native subagent on the thread, a replacement session's included. As upstream writeReleasedSubagentEvents does, the cleanup now runs only for sessions whose background tasks end with the process: from close_session on RuntimeStopped, or at pump end when the session ended on its own and is still the thread's current one. It ends only subagents of that session's provider threads that started before the release. conn_thread_read and conn_thread_send reuse the projection the thread_ id resolver loaded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e settle cleared The engine ignored restoreUnsettledAt, so undoing a settle moved the thread to the top of Active. It now sets unsettledAt to the given time, to null for null, and refuses a time that does not parse, as T3's Orchestrator does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Codex session ended its child turns (subagent interrupted) before it learned that the app-server outlives the close. It now calls remove_session first, and on a shared close the mapper ends only root turns (Mapper::on_close). Run finalization no longer fails an open subagent item whose provider-native subagent is still running; that item ends with its subagent, from the provider or from the orphan cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Effects now commit in the same transaction as their command, as T3's EventSink and EffectOutbox do, and one worker claims and runs them (T3's EffectWorker). A closed socket that aborts a handler after the commit can no longer lose a committed provider start. The in-memory effect lanes are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The restart tests open a second engine on the store while the first engine's tasks still run. The first engine's worker could still claim the new engine's rows, such as the continuation's turn start, and write events with its own stale sequence counter: "UNIQUE constraint failed: events.seq" (1 in 30 runs on Linux, 9 in 120 under load). Dropping the engine now stops its worker and prune loop. The claim checks the flag while it holds the write lock, and the worker checks it again before it runs what it claimed, so a claim in flight at the drop takes nothing the next engine wrote. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tries and wire times - An archived thread refuses thread.unsettle before its anchor is read. - The anchor parses as T3's DateTime.make: a time without a zone is UTC. - A fresh command on a thread already active records thread.unsettled and keeps the anchor and updatedAt; a retry of the same command id records nothing. The shell row keeps its updatedAt, as T3's projection does. - The event envelope carries providerInstanceId, from the updated thread. - Wire times outside years 0000-9999 get toISOString's signed six-digit year, so T3's client decoder reads them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a Stop ends them A session closed on Codex's shared app-server dropped its child turns and their routes, and the engine's pump stopped reading. A child that completed later reached no one. As T3 keeps the child's turn context past a release, the session now keeps the child's route, mapper turn and event sender until the child settles or the process exits. The engine pump reads on until the session drops its events; the run is detached before the close and ends failed. Run finalization skipped every open subagent item whose native row was active, so a confirmed Stop left the run's own subagent running. finish_run_as now takes the reason (RunEnd): a detached session keeps live native subagents, and a run that ends interrupted, failed or cancelled ends its open native subagents with it, record, node, item and child turn together (cascadeTerminalizeRunOwnedSubagents). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h on commit Three gate findings on the effect outbox: - A dropped or replaced engine still wrote: an effect already running committed into the next engine's store with a stale sequence. The engine now takes an engine_epoch lease at open, and every write checks the lease and the drop flag inside its own transaction (Tx::commit, claim, settle, prune). The drop flag at claim and before execution stays. - One failed settlement write held the thread's lane until a restart. As T3's worker does, a settlement retries while the store is locked (100 ms), and any other failure settles the row failed instead, so the lane frees without running the effect again. - A commit published its sequence only when its caller lived, so an aborted caller hid the change from connected clients. Tx::commit now sends it, for every command path, as T3's EventSink publishes after its transaction. Also: pruning lets the store go between 500-row batches, and the lane order test waits on the host's event instead of a 50 ms sleep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al, as T3 Ending any run cancelled every pending runtime request on the thread. So removing queued run B while run A waited on an approval cancelled A's card, and the server refused the answer while the provider still waited. A run's end now cancels only the requests whose node belongs to that run. T3's queued-run cancel writes only the run, its attempt and its root node. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…starts one run, as T3 A question whose provider can no longer take it live (responseCapability `message`, as one imported from T3 after its provider exited) was answered like a live approval. With no live session the delivery failed, the card expired and the answer was lost: no message and no run. The respond command now matches the capability. For `message` it checks the answers against the question as T3 does, resolves the card and its item, and dispatches one user message `async-answer:<requestId>` in the same transaction: a steer of the active run, or a queued or started turn. Like T3, it refuses the answer when the thread's provider is disabled for its project. Live requests keep their adapter delivery. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… wake, as T3 A failed turn held every queued run. A buffered provider notification replays output the CLI already produced, so T3 starts it while it holds the user's messages. Here it stayed held with them. The failure hold now leaves a queued run free when its message is a buffered provider notification (agent, provider source, a notification, no delegated completion), and the normal queue starts it. Stop and other holds are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ups get their own task, as T3 Four task-lifecycle gaps against T3, all through delegatedTaskProgress: - A child whose own turn ended while its delegate still ran reported its result to the parent at once. The engine now publishes a task only once its work settled (finalizeAppOwnedSubagent, Orchestrator.ts:14777), and task_status answers waiting_for_children until then (readTask, OrchestratorMcpService.ts:1703). - A send to a finished child started a run with no task, and its answer replaced the original task's result. It is now a follow-up task bound to the run (recordSubagentFollowup, Orchestrator.ts:9794); conn_thread_send returns its taskId, and each task reads only its own runs. - A blocking delegate_task returned the result but left its delivery pending, so the parent was woken with it again. readTask acknowledges a terminal result it returns (OrchestratorMcpService.ts:1902). - untilDelegatedWorkSettled held on any background task. Unawaited commands and monitors no longer hold it (backgroundWorkHoldsCompletion, orchestrationV2PendingBackgroundWork.ts:90). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s T3 The engine passed MCP app notes in the turn input, but the Claude session never used them, so the model never saw what an app reported. As T3's withClaudeAppContext, a turn now puts each note the native thread has not seen with its current text before the prompt, as quoted app data (`<external_KEY>text</external_KEY>`). A slash command gets none. What a turn offers enters the history only when the turn completes, so an interrupted turn's notes go again. Compaction, a conversation reset and a rollback clear what the history holds. Steers follow with SteerInput. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…delete, as T3 thread.delete ignored onlyIfUnused, so closing a side chat that held a conversation deleted it. Archiving or deleting a parent left its side chats active and readable. Port T3's Orchestrator.ts (thread.delete, thread.archive/unarchive and liveSideChatIds): onlyIfUnused keeps a thread with a message or a run; archive takes active side chats except one with running delegated tasks; unarchive restores only those archived with or after the parent; delete takes them all. The command's one transaction stands in for T3's side-chat locks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… switch A Conn thread can now move between Claude, Codex, Grok and Antigravity mid-thread, and the new provider gets the conversation, as T3 does. - A run on another instance than the conversation's carries a consumed provider_handoff transfer and a context handoff (prepareProviderHandoff): the whole history for a provider with no native thread yet, else the delta since its thread last took part. A queued run decides when it starts. The turn start delivers it as merge-back does: injected for Codex, inline for the others. - The switch checks the target's context capabilities (ensureContextHandoff) with T3's refusal text. - All four providers now advertise supportsProviderSwitchingViaHandoff, so clients open the model picker to other providers. - Fix: the condensed delivery coverage names the provider thread's app thread, as T3 does. Proof: three engine tests, 9 more T3 handoff cases (90), and a client check of the switch through the client's reducers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lippy in the switch test Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pt, as T3 Settling a thread closed its stopOnSettle terminals but never ran the project's runOnSettle script. T3's cleanUpSettledThread (ThreadSettlementService.ts:700) runs it after closeOnSettle, in the thread's own existing worktree, once per settlement, and skips a delegate that shares its parent's checkout. The host now calls McpService::run_settle_script from the committed settle effect; it reuses the project-script runner, generalised to T3's runForThread trigger (a fresh settle-<id>-<8 hex> terminal). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Codex subagents Round 3 of the #256 gate. - A shared close keeps the route of a child Codex announced but has not started: open_child_threads counts unsettled subagents, not only running child turns. - Root terminals follow emitOrDeferRootTerminal: a failed root with running descendants carries childTurnsContinue (the engine ends its run Detached), and an interrupted root's terminal waits until its descendants settle. - A confirmed Stop follows the run's child links even when the subagent record has already settled. The record keeps its result, and each open node and item settles once. - A refused thread/resume puts the previous route back. The app-server tracks closed sessions that wait on subagents by process generation, so the process exit always releases them. - close_session stores the terminals already received, with a bound, before it detaches the run. A confirmed Stop keeps its status. - A closed session's silent child is checked with Codex (thread/read with turns, as T3's readThreadSnapshot) every child_check_interval, at most 60 times. Then what is still open ends interrupted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd settling closes idle shells, as T3 T3 follows a settle script to its end: the command is wrapped to print a sentinel with a per-run token and the exit code (wrapCommandForCompletion, ProjectSetupScriptRunner.ts:229), and after exit 0 the terminal closes once its shell is idle (closeIdle). T3's closeOnSettle also closes every idle shell of the settled thread (Manager.ts:3922). - conn-terminal: TerminalManager::shell (getShell) and close_idle (closeIdle): only a shell at its prompt closes; a foreground job, an unreadable foreground group, a shell replaced by exec (rootIsCommand) and a terminal that changed while it was checked stay. - conn-mcp: script_completion ports the POSIX, fish, Nushell and PowerShell wrappers, the sentinel and the completion observer; cmd.exe is refused as T3 refuses it. Settle scripts use them. - conn-server: the settle effect closes stopOnSettle terminals, then idle ones, then runs the settle script. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and envelopes - Command times (restoreUnsettledAt, snoozedUntil, visitedAt) parse as T3's DateTime.make: a port of V8's Date.parse, legacy forms included, with Effect's zone rule and the server's zone for local times. Checked against T3's own answers for 1683 strings in five zones (gen-date-cases.mjs). - An archived thread refuses settle, auto-settle, unsettle, snooze, unsnooze, auto-settle set, pin, unpin and both reorders first, as T3. - The thread's updatedAt follows T3's ProjectionStore: a thread event writes its payload's, every other event its own time, in the row and the stored thread (list generated from T3). Pin and settle keep updatedAt as T3 does. - The event envelope names providerInstanceId wherever T3's does, mapped flow by flow; thread-cli-diff compares it with the T3 server. - Command receipts are kept for good and record refusals: a retry gets the recorded refusal, a receipt answers only for its own thread, and an old retry after an undo changes nothing (T3's receipt tests, ported). Co-Authored-By: Claude Opus 5.5 <[email protected]>
An outbox row outlives a server update. Fields a later build adds to CleanupHtmlAttachments take #[serde(default)], so a row stored before them still decodes (audit 6.7 adds one). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rules Gate findings on 4.2 and 4.4: - A held queue is released only by a client send (`sentByUserFromClient`: a user's web or mobile message, not a steer follow-up or scheduled task). The async answer, created by the server, no longer resumes work the user stopped. - The async answer steers only into a provider turn that runs. A run still starting gets the answer as its own later run, instead of the deferred steer that delivered it into the start. - A provider result queued while a held queue waits does not take the hold unless Stop reached the active run (`wakeSkipsHold`), so a second buffered result drains while the user's message stays held. - A usage-limit failure holds everything queued, provider wakes too, as T3 checks `usageLimitHoldsQueue` before a failure starts a wake. T3's worktree-setup condition has no counterpart: this engine records no workspace preparation on runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…runtime Four gate findings on the outbox: - A replaced engine could send a rollback twice: its phase update checked only the command id and took zero changed rows as success. The move from admitted to provider is now one write that checks the engine's lease and the expected phase, and the provider is contacted only when exactly one row moved. Otherwise the rollback stops and writes nothing. - Overlapping opens: engine A's late startup cancel could cancel engine B's committed start. The ownership check and the cancel are one immediate transaction; a stale open gets NOT_OWNER and aborts. - Two failed settlement writes left a row running. The settlement is kept and tried again with backoff (100 ms, doubling, 30 s at most) for as long as the engine owns the store; the effect ran once. - The server opened the store, ran its migrations and recovery on the runtime thread. SqliteEngine::start opens on the blocking pool; the worker starts once recovery committed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… without Git, as T3 - A scheduled run launches its saved strategy, which can outlive its base branch. Its provisioning now falls back as T3's worktreeFallbackBase does: the remote's default branch (fetched), then the checked-out branch, then HEAD. A stale tracking ref is skipped when the fetch finds no branch. An interactive launch that names a missing base still fails. - A worktree strategy for a project whose folder is positively not a Git repository, Scratch included, is saved as root, as T3's upsert does. Runs apply the same rule to tasks saved earlier. A folder Git cannot read keeps its own error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on, proven through the host Gate review on #277: - P3: deduplication used a 512-entry cache, so after enough other threads a repeated settle could run a script again. The engine now tells the host whether a settle is a transition: a settle of an already settled thread emits ThreadClose::SettledAgain, which closes terminals (closeOnSettle) but does not run the settle script. The cache is gone. - P2: the acceptance test now drives the production path. In conn-server, a real engine whose host is the real Host settles a thread in a Git worktree: the script starts from the settle effect, its terminal closes after exit 0, a repeat settle runs nothing, and a failing script keeps its terminal. With the host hook removed the test fails ("the settle effect starts the project's settle script"). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…conciliation, readable search Round 4 of the #256 gate, and audit entry 6.5. - Stop: past the deadline, a root Codex already ended no longer waits for silent descendants; the rest of the lineage settles (T3 deferToActiveRoots). - A confirmed Stop follows the run's owned threads recursively, nested native subagents with no run included, and settles each open record, node, item and provider turn on its own (T3 ownedThreadIds; ports its nested regression test). - A resume of a thread another session owns takes nothing over until Codex accepts it, so a completion sent before a refusal reaches the owner. - A closed session's child checks go through the session inbox, so the driver applies and publishes each result in order. A failed read other than a missing thread is retried. At the bound, each open child turn gets turn/interrupt and is read once more before anything ends interrupted. - A process exit ends a child announced before its first turn. - The pump detaches a closing session's run only after it stored the events received before the close. A stopped session drains what is queued; no timeout decides the run's status. - At most one deferred root terminal per native root thread, published in order. - Thread search indexes each message as it reads (T3 readableSearchText): a citation as its text and comment, not its hidden link. Schema step 5 re-indexes existing messages and keeps their stored text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and replay follow T3 - Receipts name their owner (owner_kind thread or project, owner_id), chosen by command type as T3's commandThreadId: a fork's and a merge-back's is the target thread. Migration 5 names older receipts' owners from their own events; one nothing proves is kept and refused, never run twice. A project receipt never answers for a thread. - A replayed queue.resume or queued-run.start checks the queue again and answers the recorded sequence. A command that writes nothing answers its own thread's latest sequence. Thread setters record their event even when nothing changes (a re-pin keeps updatedAt). - thread.auto-settle refuses a thread set active or changed after its snapshot, then settles with the archive guard first. - thread.visit keeps the later visit, compared as times, and records thread.visit-recorded. - The first message after a merge-back names its instance on the handoff and transfer events. - The receipts' high-water mark reads an index. Opening the engine off the runtime thread is #261's. - thread-cli-diff excuses only the expired question after its session's release, row by row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cel queued follow-ups, as T3 Gate review on #275, each with a consumer test that fails on e2af431: - A running follow-up woke its parent when the parent's turn ended. Delivery now requires a terminal task status (Orchestrator.ts:2113). - A task held by an awaited command never settled when the command ended after the turn. The runner now finalizes a child's tasks in the write of a roster update that drops a holding task, or of a subagent that stops (Orchestrator.ts:16085). The fake provider can end its bg-1 command. - Claude roster entries carry no run, so a follow-up never counted its own awaited command. The store attributes each task to the run it first appeared under and keeps it across roster updates (ProjectionStore.ts:915). - task_status preferred a later untagged run's text over the task's published result. It returns the published result first (OrchestratorMcpService.ts:1819); the test also reads both tasks after the engine reopens. - task_cancel left a follow-up's queued run for Resume. It now disposes the delivery, stops the child's active run and cancels the task's queued runs (OrchestratorMcpService.ts:2947); a follow-up whose only run was cancelled before it started ends cancelled (delegatedTaskResultRun). - A blocking delegate_task watched only the parent's row after the child's first turn. It follows both threads from before its first read, so a question or approval in the child returns it (OrchestratorMcpService.ts:2090). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ies the conversation, as T3 # Conflicts: # apps/conn-server/crates/conn-engine/src/checkpoint_tests.rs # apps/conn-server/crates/conn-engine/src/commands.rs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…der in use Archiving deletes the thread's session rows and closes only its current session. A session a fresh scheduled run moved aside still runs, but open_session_cwds read its folder from those rows, so cleanup could remove the worktree under it. The live session now keeps its folder in memory, and detached sessions report it from there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gent held A delegated child whose run completed while a provider-native subagent still worked keeps its task open. A restart cancels that subagent, but ran finalize_tasks only for threads with unfinished runs, so the parent never got the result. Recovery now also finalizes the tasks of every thread whose orphaned subagents it cancelled, in the same write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ades the wake A worktree delegate's dispatch runs on its own task, through the setup script. A caller that disconnected meanwhile was gone before the wake upgrade was armed, so the child committed with settled_only and could finish without waking a parent still at work. The dispatch task now holds the armed upgrade and hands it back; a call that went away leaves it to that task, which drops it after the child committed. Restores #275's test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
a_close_keeps_a_stop_the_provider_already_confirmed raced interrupt and close_session with join!(biased), then read the run before the pump had stored anything. Under load it saw `running` (CI on #327). The engine is right: the pump stores what the session sent before the close in order. The test now interrupts to completion, holds the pump at a new cfg(test) pause point (pump.event) with the confirmed events received but not stored, closes the session, resumes the pump, and waits for the run's end. A close that detached the run would leave it `failed`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
Merged
Merged
nckrtl
added a commit
that referenced
this pull request
Nov 24, 2026
Conflicts kept both sides: - message.dispatch keeps `idleCompaction` beside main's `target_capabilities`, worktree-missing check and provider-switch handoff item. - The close hook keeps main's SettledUnnamed and its awaited archive/delete cleanup; the idle compaction timer cancel moves into that Archived/Deleted arm. - clean_up_settled takes main's optional settlement; its body runs in an inner block so the settlement sweep still wakes on main's early returns. - serve.rs: main's start_agent_tools call, then the settlement and compaction start; shutdown stops them before main's worktree cleanup. - Host keeps settlement_wake, idle_compaction and main's worktree_cleanup in every initializer. - Store, fake provider, families, Cargo.lock, status.md and engine_tests take main's code plus #311's additions. Migrations stay at main's user_version 5. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seventeen approved Conn Server PRs touch the same
conn-enginefiles and kept breaking each other when they merged one by one. This train merges 16 of them ontomainin one branch, one merge commit per PR, and leaves #309 out (reason below). It also fixes #310's review blocker and makesmain's ownconn-enginetests compile again.Included, in merge order
Left out
async: falsescript exits, and fails the delegate (removing the worktree) on a non-zero exit, with tests for that. fix(conn-server): a worktree delegate waits for its synchronous setup script, as T3 #309 instead creates the child with apreparingrun and runs the same script fromdelegate_taskafterwards (T3'sscheduleRunPreparation, closer to the TypeScript server). Merged together, the script runs twice. Taking fix(conn-server): a worktree delegate waits for its synchronous setup script, as T3 #309 means turning off fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's setup for delegates, porting fix(conn-server): a worktree delegate waits for its synchronous setup script, as T3 #309 onto fix(conn-server): a worktree launch runs the project's setup script, as T3 #314'sstart_project_script/ObserveAPI, and changing fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's tested delegate behaviour. That picks one approved design over another, so it needs your call. fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 already keeps the agent from starting before a synchronous script succeeds; fix(conn-server): a worktree delegate waits for its synchronous setup script, as T3 #309 would add a non-blockingdelegate_taskand a visiblepreparingchild.Worth a review
hold_effects/start_effects, and one fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256 test is dropped (log below).restart.rs's Stop check still follows only a delegated child's original task, not a follow-up task.Resolution log
Resolution log
conn-engine/src/engine_tests.rs,effect_worker.rs: main's fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276 tests usedreserve_effect/ReservedEffect, removed by feat(conn-server): commit effects with their command in an outbox #261, so main's conn-engine tests did not compile. Portedgate()to the outbox: it enqueues aCloseSessionrow in t1's thread lane and registers it (before commit) in a new#[cfg(test)]TestHooks::gatesmap; the worker holds a gated row until its release drops, then settles it without running — the oldReservedEffectlikewise ran nothing on drop. Two gates keep their order, as two outbox rows in one lane. All 11 callers pass; a throwaway probe showed a held thread staysstartingand runs once released.conn-engine/src/engine.rs(Inner fields): kept main's outbox fields (effects_wake,effect_worker,engine_dropped,store_lock,commit_pause,worker_hooks) and added fix(conn-server): launch saves a new thread and its first message in one transaction #262'slaunchesand testpauses; dropped fix(conn-server): launch saves a new thread and its first message in one transaction #262's base-sideeffect_lanes/effect_seq, which feat(conn-server): commit effects with their command in an outbox #261 removed. fix(conn-server): launch saves a new thread and its first message in one transaction #262's launch commits throughdispatch_value, so its effects use the outbox.conn-engine/src/engine_tests.rs(an_aborted_launch_still_starts_its_committed_run, from feat(conn-server): commit effects with their command in an outbox #261): it paused theA:initial-messagecommit, which fix(conn-server): launch saves a new thread and its first message in one transaction #262 folds into the launch's ownthread.create(A), so the pause never came and the test hung. It now pausesA; still checks one session and a completed run.abort_inside_commitnow fails after 30 s instead of hanging. conn-engine: 352 passed.conn-engine/src/engine.rs(launch): fix(conn-server): launch saves a new thread and its first message in one transaction #262 keeps the made worktree (provisioned: Option<DelegatedWorktree>) for its cleanup; fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 needs only a flag forlaunch_committed. Kept theOptionand derivedmade_worktreefrom it before the cleanup consumes it.launch_committedruns before fix(conn-server): launch saves a new thread and its first message in one transaction #262'slaunch.before-projectiontest pause.conn-engine/src/engine.rs(provision_worktree): git placed fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's newproject_id/link_originon fix(conn-server): launch saves a new thread and its first message in one transaction #262'sDelegatedWorktree; moved them into theWorktreeRequest, where fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 has them.conn-server/src/host.rs: kept both newEngineHostmethods (fix(conn-server): launch saves a new thread and its first message in one transaction #262'scancel_preparation, fix(conn-server): a worktree launch runs the project's setup script, as T3 #314'slaunch_committed). Indiscard_worktree, kept fix(conn-server): launch saves a new thread and its first message in one transaction #262'sworktree::discard(reports what it left) and added fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's discard of a refused command's setup terminal.conn-vcs/src/setup.rs: kept fix(conn-server): launch saves a new thread and its first message in one transaction #262'sworktree::Claimcleanup and its "could not be removed" report, and added fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's runnerdiscardof a started terminal and itsstartedslot. Took fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's removal of thesh -crunner (no production caller); fix(conn-server): launch saves a new thread and its first message in one transaction #262 had only changed its group kill.conn-vcs/Cargo.toml: fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 droppedrustix, but fix(conn-server): launch saves a new thread and its first message in one transaction #262'sprocess.rsuses it forGroupKill; kept it with an updated comment.conn-vcs/tests/repos.rs,old_git.rs: kept both sides' new tests. fix(conn-server): launch saves a new thread and its first message in one transaction #262's tests used the removedsetup_script:Nonebecamesetup: None; the locked-cleanup test now uses a smallSetupRunnerthat locks the worktree and exits 3, as its script did. Restored thealive/survivorshelpers that fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 removed with its runner tests.conn-engine/src/engine_tests.rs: both sides appended tests at the end; kept both, and renamed fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's test hostLaunchHosttoHandoffHost, since fix(conn-server): launch saves a new thread and its first message in one transaction #262 has aLaunchHost.ef32b38bd3as base gave the same two conflicts),conn-engine/src/checkpoint.rs: feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268 writes the run's end once (first+record_run_end); main's fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276 releases unattended holds when the run completed. Moved fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276's release inside feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268'sfirstbranch, so a capture replayed after a restart does it once, in the same write.conn-engine/src/commands.rs(run cancel): kept feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268's skip for a queued run and main's filter that cancels only the run's own pending requests.effect_worker.rs: the base commit's test gate callssettle_ran(id, None), feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268's new signature.effect_worker.rsTestHooks: kept the base commit'sgatesand refactor(conn-server): keep the rollback phase in its outbox row #269'srollback_committed/rollback_result_faults.conn-engine/src/engine.rs: fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256 patchedrecover_runs, which feat(conn-server): commit effects with their command in an outbox #261 replaced with recovery insideopen. Took main'sstart/open, and moved fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256's orphaned-native-subagent end intoopen's recovery write: only whenrecover_runsis on, after the rollbacks and before the run restart, in fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256's order.serve.rs/engine_tests.rs: fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256'shold_recovery+resume_recovered()(resumed sessions get/mcp's real address) is superseded by feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268'shold_effects+start_effects(), which serve.rs calls after/mcplistens. Dropped fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256'sa_held_recovery_waits_for_resume: it needs the removed hook, and under feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268 an unaccepted user prompt is held, not resent. feat(conn-server): reconcile the effect outbox after a process loss, as T3 #268'sheld_effects_wait_for_the_hostchecks the same thing. fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256's ClaudereconnectMcpServersafety net stays.lib.rs,runner.rs: kept both modules (composer_context,effect_worker) and both imports (Held,hold_queued,RunEnd).conn-provider-claude/src/interrupt_tests.rs: kept both appended tests.gen-upstream.mjsauto-merged;node tools/gen-upstream.mjs --checkis current.MESSAGE_SEARCH_FOLDis 4,user_versionstays 5.conn-engine/src/commands.rs(thread_delete): main already had theonlyIfUnusedcheck (is_used, viaTx::has). Took fix(conn-server): side chats follow their parent through archive and delete, as T3 #290's version (thelive_threadguard,delete_one, side chats deleted with their parent) and kept main'sis_used.store.rs: dropped fix(conn-server): side chats follow their parent through archive and delete, as T3 #290'sTx::exists, a copy of main'sTx::has.t3_import/tests.rs: kept both appended tests.engine_tests.rs: kept both appended tests. fix(conn-server): Find searches a fork's inherited messages and the text Markdown shows, as T3 #295 computes Find's text at read time, so no new search-fold mark;MESSAGE_SEARCH_FOLDstays 4.Cargo.lockauto-merged;cargo metadataleft it unchanged.conn-engine/src/lib.rs,engine.rs: fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 already addedWorktreeRequest.project_idand passes it on both paths; took the train's side in all four blocks. Git again placed fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313'sproject_idline onDelegatedWorktree; removed it there.conn-vcs/src/worktree.rs(create_worktree): kept fix(conn-server): launch saves a new thread and its first message in one transaction #262's--lock --reasonduringworktree addand fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313's--no-checkout+ sparse checkout. The unlock now runs after the sparse checkout (the files land then) and before fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313's forced removal of a failed sparse worktree, since a locked worktree resists--force.conn-vcs/src/setup.rs: took fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313'ssubmodule_mode/update_submodulesstep. The train had only moved the.gitmodulescheck off the runtime thread; fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313's check runs throughgit.conn-server/src/host.rs: reads the submodule setting beforerequest.project_idmoves into the setup runner (borrow error). Tests: addedsubmodules: Noneto fix(conn-server): launch saves a new thread and its first message in one transaction #262's and fix(conn-server): a worktree launch runs the project's setup script, as T3 #314'sProvisionRequests.conn-server/src/settings.rs: kept fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313'sworktree_submodulesand fix(conn-server): status refresh follows the fetch interval and defaultAutoPull, as T3 #315'sautomatic_git_fetch_interval.methods/vcs.rs,conn-vcs/tests/repos.rs: kept both sides' new tests (one marker-like string in a merge test was restored after a first pass mangled it).conn-vcs/src/worktree.rs: kept fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313'st3.json/sparse/submodule helpers and fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300'srestore_missing_worktree, independent additions at the same spot.checkpoint_tests.rs,conn-vcs/tests/repos.rs: kept both sides' new tests.conn-engine/src/engine.rs(launch_thread_with): kept fix(conn-server): launch saves a new thread and its first message in one transaction #262's spawned launch task and its in-write provider check; dropped fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 #286's base-side pre-launch provider check (per the train's rule). fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 #286'smissing_basenow flows through the spawned task intoInner::launch,provision_worktreeand theWorktreeRequest(fix(conn-server): launch saves a new thread and its first message in one transaction #262/fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 build it there now); the return stays fix(conn-server): launch saves a new thread and its first message in one transaction #262'sDelegatedWorktree.conn-vcs/src/setup.rs:ProvisionRequesthas fix(conn-server): new worktrees honour sparse patterns and worktreeSubmodules, as T3 #313'ssubmodulesand fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 #286'smissing_base, both added to fix(conn-server): launch saves a new thread and its first message in one transaction #262's manualDebug; fix(conn-server): launch saves a new thread and its first message in one transaction #262'screate_worktree_claimingtakes fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 #286'sbase_name.host.rs,delegate_worktree.rs: kept both fields. Tests: kept both sides' new tests; fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 #286's fallback test now usessetup: Noneandsubmodules: None; older requests gotmissing_base: Fail.engine_tests.rs: kept both sides' appended tests.conn-engine/src/engine.rs: fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275 addedrecoverDelegatedTasks(finalize_tasksper recovered thread) torecover_runs, which feat(conn-server): commit effects with their command in an outbox #261 removed; moved it intoopen's recovery write, after the run restarts, as fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275 ordered it.families.rs: fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275 replacedparent_taskwithdelegated_parent, but main's fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276restart.rs(stop_requested) callsparent_task. Kept main'sparent_task(the original task) beside fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275'sdelegated_parent, and removed a duplicatework_active. Worth a look: with fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275's follow-up tasks, a restart's Stop check still follows only the child's original task.fake.rs: kept both scripts (fail-usage-limit,report-fail); fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275's background roster task now takes the sender through main'sevents()accessor.conn-mcp/src/tools/tasks.rs: fix(conn-server): a worktree launch runs the project's setup script, as T3 #314 removed the delegate's separate setup run (provisioning runs it before the task exists). Kept fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275'sWakeUpgrade::armright after the dispatch, dropped the setup call and itspark_at("setup")hook, and dropped fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275'sa_blocking_worktree_delegate_dropped_during_setup_upgrades_the_wake, whose drop point no longer exists.a_wait_dropped_while_it_upgrades_the_wake_still_upgradesstill covers a drop after the task exists.conn-mcp/src/tests.rs(store lock):reopenforgot the first fixture, so its engine kept the store and five fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275 restart tests failed withstore in use.Fixturegainedkeep_dir;reopensets it and drops the old fixture, so the first engine closes before the second opens. The five tests pass.conn-server/src/methods/terminal.rs: fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300 and fix(conn-server): worktree cleanup rules remove managed worktrees, as T3 #310 both put terminal starts under the checkout's workspace lease, and both leases are the engine's checkpointWorkspaceLocks, so taking both would deadlock. Kept fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300's lease on the thread's worktree root, held across the open, the restore of a missing worktree and the retry; a terminal outside a thread worktree now takes fix(conn-server): worktree cleanup rules remove managed worktrees, as T3 #310's lease on its own folder (openLocked). At attach, only an attach that starts a shell leases, as both PRs had it.host.rs: both addedmanaged_worktree_dirs; kept fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300's copy (the same function plusis_managed_worktree_path). On a thread delete, fix(conn-server): worktree cleanup rules remove managed worktrees, as T3 #310's cleanup wake runs before fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300's terminal and device teardown. Addedworktree_cleanupto fix(conn-server): a worktree launch runs the project's setup script, as T3 #314's testHost.settings.rs: both added the sameremember_worktrees_directoryand its call; kept one. Kept fix(conn-server): terminals take their provider instance, restore a missing worktree, and keep T3 scrollback, as T3 #300's test and fix(conn-server): worktree cleanup rules remove managed worktrees, as T3 #310's under a new name (a_moved_and_cleared_worktrees_directory_stays_remembered), since only fix(conn-server): worktree cleanup rules remove managed worktrees, as T3 #310's checks a cleared folder.docs/status.md: kept both paragraphs.commands.rs(message dispatch): kept fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275's continued-task stamp (delegatedTaskId) and fix(conn-server): a provider switch or portable fork carries the conversation, as T3 #318's provider-switch records; independent.checkpoint_tests.rs: kept both sides' tests.git merge-tree --merge-base=0148c3f68eandgit commit-tree(parents: the train and fix(conn-server): Pass 4 steer app notes and PR watch merge wakes, as T3 #280's head), since its old fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276 commits are in main as squashccd733ed95. No conflicts. Its own diff has noreserve_effect; the tests at about lines 9598/9692 were fix(conn-server): Pass 4 approval, async answers, failure wakes and Claude app notes, as T3 #276's and are ported in the base commit.gen-upstream.mjschanged;node tools/gen-upstream.mjs --checkis current.#310 blocker fix
#310 review blocker, fixed in the train (f245bea).
detached. When the replacement session exits,open_session_cwds()(conn-engine/src/engine.rs) dropped the thread, because it read onlylive, so a cleanup sweep could remove the worktree before Claude woke. The TypeScript server checks liveness per provider session (apps/server/src/storageCleanup.ts:1374).open_session_cwds()reads the threads inliveanddetached. The pump now wakes cleanup (session_released) when a session leaves either collection;release()already woke it for the reaper and thread-close paths.engine_tests::a_detached_session_keeps_its_folder_in_use_until_it_exits. Before the fix it failed on both checks: the folder list was empty after the replacement closed (left: [],right: ["/tmp/conn-engine-project"]), and with only the first half fixed, cleanup never heard the detached session end (timeout). It passes with the fix.#276/#280 test port
main'sconn-enginetests did not compile: #276 (squashccd733ed95) added tests that usereserve_effect/ReservedEffect, which #261's outbox removed. These are the tests the brief placed in #280; #280's own diff has none. The train's first commit, before any merge, ports them to the outbox's test hooks:gate()enqueues aCloseSessionrow in t1's thread lane and registers it, before the commit, in a new#[cfg(test)]TestHooks::gatesmap.ReservedEffectalso ran nothing when dropped.startingand completes once released; with the hold disabled it completes at once.Review fixes (head 6fda097)
The review of 35d95c6 found three defects. Each fix is its own commit, with a test that failed first.
Cleanup could remove a worktree a detached session still used (
d318f5480e). Archiving deletes the thread's session rows and closes only the current session, butopen_session_cwds()read a detached session's folder from those rows. The live session now keeps its folder in memory (LiveThread::cwd), and detached sessions report it from there.engine_tests::an_archived_threads_detached_session_keeps_its_folder_in_use. Before: failed,left: [],right: ["/tmp/conn-engine-project"]. After: passes.A restart could leave a finished delegated task marked running (
f656ae1640). Recovery cancelled the child's orphaned native subagent but ranfinalize_tasksonly for threads with unfinished runs. It now also runs it for every thread whose orphaned subagents it cancelled, in the same write.engine_tests::a_restart_publishes_a_task_its_orphaned_native_subagent_held. Before: failed after the restart, the task stillrunning. After: passes; the task iscompletedwith the child's result.A blocking delegate call dropped during setup lost the parent's wake (
f2db3c9157). The worktree dispatch runs on its own task through setup, and the wake upgrade was armed only after it returned. The dispatch task now holds the armed upgrade and hands it back; if the caller is gone, the task drops it after the child commits, and the upgrade lands. This restores fix(conn-server): delegated tasks settle with their children, follow-ups get their own task, as T3 #275's test, which the train had dropped.tests::delegate_worktree::a_blocking_worktree_delegate_dropped_during_setup_upgrades_the_wake(setup held by the test's setup stub, the call dropped, then setup released). Before: failed, the task stayedcompletionWake: settled_only. After: passes.CI flake in fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256's
a_close_keeps_a_stop_the_provider_already_confirmed(6fda097089). Test timing, not an engine defect. The test racedinterruptandclose_sessionwithtokio::join!(biased; …)and read the run status right after, before the event pump had stored anything; under load it sawrunning. The interrupt here runs inline, not through the outbox. The engine keeps fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256's behaviour: the pump stores what the session sent before the close, in order.#[cfg(test)]pause point (pump.event) with those events received but not stored, closes the session, resumes the pump, and waits for the run's end. It still assertsinterrupted, plusrunningbefore the close.--test-threads=1. A mutation that detaches every interrupted terminal makes it fail (failedvsinterrupted).Checks after the fixes:
cargo fmt --checkandcargo clippy --workspace --all-targets -D warningsclean. conn-engine 451 passed, 1 ignored (again after fix 4); conn-mcp 155 passed, 2 ignored; conn-server 466 passed. In the first combined run,methods::terminal::tests::a_provider_instance_terminal_gets_its_environmentfailed once under load (it waits up to 15 s on a real shell); it passed 5/5 alone, and the conn-server suite then passed in full.Tests
cargo fmt --all(--checkclean) andcargo clippy --workspace --all-targets -- -D warnings: clean.node tools/gen-upstream.mjs --check: upstream tables are current.cargo test --workspace --features conn-support/test-util(apps/conn-server): 1,924 passed, 16 ignored, 2 failed. The 2 failures are the knownconn-terminalparallel-load flake (finds_terminals_by_id_and_respects_resume,clears_and_reports_the_foreground_command);conn-terminalalone passes 32/32, in parallel and with--test-threads=1.commit_all_commits_thousands_of_conflicts_resolved_to_ourspassed.a_close_keeps_a_stop_the_provider_already_confirmedfailed once under parallel load; review fix 4 makes it deterministic.cargo check --workspace --all-targets, and the tests of the crates that merge touched.The original PRs stay open; close them after this merges.
Opus 5.5, Claude Code
🤖 Generated with Claude Code