Skip to content

fix(agent-trust): bound the remaining Codex trust writes a launch waits on - #23380

Merged
nwparker merged 4 commits into
mainfrom
nwparker/bound-remaining-codex-trust-writes
Sep 27, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/bound-remaining-codex-trust-writes

Conversation

@nwparker

@nwparker nwparker commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​245 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​245
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

ELI5

When you start Codex in a folder it has never seen, Orca quietly writes a small "this folder is fine" note so Codex does not stop and ask you first. Writing that note takes a turn in a queue, and if something ahead of it in the queue gets stuck, the note never finishes.

Before this change, three of the places that write the note would wait for it forever. You pressed "start agent" and nothing happened at all — no agent, no error, no prompt.

Now every one of those waits has a 20-second limit, so no single note can hold up its caller forever. That is the whole of what this change promises. It is not the same as "the agent always starts":

  • Starting an agent in a worktree does now finish. That path has nothing left to do after the note, so once it stops waiting, the agent starts.
  • Quick-launching Codex and resuming a Codex session do not. Right after the note, both of them have to do one more piece of setup, and that setup waits in the very same queue. So if the queue is what was stuck, the launch stops waiting on the note and then simply waits on the next step instead. The 20 seconds are no longer spent in silence, but the launch can still stall.

Fixing the queue itself is a separate, larger change. This PR removes the part where a single note write can hang a caller with nothing to show for it, and it says plainly on the reliability gate which launches are still exposed.

What Changed

PR #23148 fixed this hang in two places: the agentTrust:markTrusted IPC handler and the worktree-remote startup path. It added src/main/agent-trust-write-deadline.ts, which waits on a trust write for at most 20 seconds.

Three call sites were still waiting with no limit. This PR routes all three through that same helper:

  • src/main/runtime/runtime-worktree-agent-startup.ts — markLocalWorktreeTrusted, the path orchestration worker-start takes.
  • src/main/startup/codex-launch-preparation.ts — quick-launch preparation, which runs before every recognized Codex spawn.
  • src/main/startup/codex-session-resume-launch.ts — resuming an existing Codex session.

Before, as a user: with the shared config lane wedged (a hook install or an app-server trust grant holding it, or an SSH write stalled on a half-open link), launching or resuming Codex from any of those three paths produced a pane that never started. Nothing timed out, nothing was logged, and the only way out was to quit.

After: no trust write can hold its caller past 20 seconds. Each site logs one named warning and moves on. What that buys differs by site, and the difference matters:

  • runtime-worktree-agent-startup.ts — the launch completes. Its Codex branch has nothing after the trust write, so when the wait is abandoned the startup path finishes and the agent starts. This is the one end-to-end bounded launch here.
  • Quick-launch prep and resume prep — the write is bounded, the launch is not. On both, the very next awaited step re-enters the same unbounded per-config.toml queue the abandoned write is still sitting in. A reviewer should read this as "the wait is now attributable and logged", not "the pane always starts".

Mechanism: each site previously did await markCodexProjectTrusted(path). That write takes runExclusivelyForCodexTrustConfig on the runtime config.toml and then on ~/.codex/config.toml — a FIFO lane per file, shared with hook installs and app-server trust grants (10s native / 30s WSL each), with no cap on how many are already queued. The SSH writer adds a session.resolveHome round trip plus unbounded SFTP calls. The write is not self-bounding, so the caller was not either. The call is now wrapped in awaitAgentTrustWriteWithinDeadline, which races the write against one setTimeout, cleared in a finally, and adopts the write promise so a rejection arriving after the deadline stays handled rather than surfacing unhandled.

Why the two launch paths are still exposed, traced in the modules:

  • In codex-launch-preparation.ts the first awaited step after the write is ensureRealHomeHooksIfSelected. That step is conditional — only when the target is not WSL and runtimeHome.isHostSystemDefaultRealHomeSelected(launchEnv) is true does it call ensureRealHomeCodexHookState, which acquires the lane directly on ~/.codex/config.toml. When the real home is not selected it returns without awaiting the lane, and since prepareForCodexLaunchAsync is synchronous on this non-WSL path, the first re-entry is then codexHookService.prepareRuntimeHomeForLaunch.
  • In codex-session-resume-launch.ts the first awaited step is the hook branch: ensureRealHomeCodexHookState when the resume home is ~/.codex, otherwise installForLaunchPrep or refreshRuntimeUserHooksForLaunchPrep.
  • Each of those reaches the same ~/.codex/config.toml lane, either directly or as the inner acquire of runExclusivelyForRuntimeAndSystemTrustConfig. The abandoned write also keeps its queue slot ahead of that step.

Two properties are deliberately preserved:

  • Trust fails closed. Trust is conferred by the write, so abandoning the wait cannot mean "trusted". At each site, giving up writes nothing, retries nothing, never substitutes another preset's artifact, and never falls back to a local write when the intended target was remote. Tests assert exactly that. The worst outcome is that Codex asks the user — which is the pre-existing behaviour when a trust write fails.
  • Ordering. Abandoning a write does not cancel it, which matches the SSH rule that loss of contact is not a verdict. The await also still sits ahead of the work the spawn depends on: in quick-launch prep it precedes prepareForCodexLaunchAsync (whose return value is the CODEX_HOME the spawn needs), and in resume prep it precedes the hook repair inside the resolver whose return value the PTY waits on. Both orderings have a test.

The reliability gate agent-session.trust-preflight-completion in config/reliability-gates.jsonc is updated to match. Its invariant now states that the deadline bounds the write and not the whole launch. Its knownGaps previously recorded these three sites as unbounded; it now records all five as bounded plus the four things that genuinely remain:

  1. Quick-launch prep and resume prep are still not bounded end to end, naming the first unbounded re-entry on each path and the condition under which it applies.
  2. The new launch-prep tests mock codexHookService and ensureRealHomeCodexHookState wholesale and default the real-home selection to false, so no suite here drives either lane — nothing in this PR is evidence about whether a launch as a whole is bounded.
  3. The ipc/worktree-remote.ts site is bounded but still has no test in these suites.
  4. The preset-agnostic remote write reached through markRemoteWorktreeTrusted is still unbounded, which is out of this change's Codex scope.

Evidence counts were re-measured, not copied.

Why

The problem is a user-visible hang with no error, on the main path for starting and resuming Codex.

Alternatives considered:

  • A second timeout mechanism per site. Rejected: one shared helper keeps the deadline value, the warning text, the timer cleanup and the rejection-adoption behaviour in one place. Three hand-rolled races would drift.
  • Make the write itself self-bounding, or cap the lane's queue depth. This is the fix that would actually bound the two launch paths, and it is the right eventual change. It is not this PR because it changes behaviour for every lane user — hook installs and app-server grants included — and a cancelled or dropped write can leave a half-written config.toml. That needs its own change with its own evidence. The deadline sits in the caller, so it changes only how long a caller is willing to wait, never what gets written.
  • Cancel the write when the deadline passes. Rejected: a 30s WSL grant session is slow, not broken, and cancelling it would throw away a write that was going to succeed. Abandoning the wait while the write runs to completion is the conservative choice.
  • Stop waiting for the write at all (fire and forget). That is what the code did before fix: await queued Codex trust preflight completion #23148, and it is the bug that PR fixed: Codex reached its trust menu before the write landed, and the discarded promise's rejection escaped. Keeping the await and bounding it preserves that fix.

There is no speed gain here. In the normal case the write settles in milliseconds and nothing changes. The win is narrower than "a launch cannot hang": no trust write can hang its caller indefinitely, one launch path is bounded end to end, and for the other two the remaining stall is now written down on the gate instead of being assumed away.

Linked Issue

Follow-up to #23148. No separate issue.

Fixes #

Visual Proof

N/A — there is no UI change. The only user-visible difference appears when a trust write stalls past 20 seconds: on the worktree-startup path, the agent starts and Codex shows its own trust prompt instead of the pane never starting. On quick-launch and resume the pane can still stall on the following hook step, so there is no reliable "after" to record. Reproducing any of it on a real machine needs a wedged config lane, which is why it is covered by unit tests that hold the write open under fake timers rather than by a recording.

Testing

macOS, local. Not run on Linux, Windows, WSL or against a live SSH host; the remote writer is mocked in these suites.

  • ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-trust-presets.test.ts src/main/remote-agent-trust-presets.test.ts tests/e2e/agent-trust-completion.unit.test.ts src/main/codex src/main/startup src/main/runtime/runtime-worktree-agent-startup.test.ts — 2,755 passed, 20 skipped.
  • The gate's own command (now six suites) — 6 files / 53 tests passed, re-run at this head.
  • node config/scripts/check-reliability-gates.mjs — passed for 138 gates.
  • pnpm tc:node, pnpm run check:code-quality:changed, oxlint, oxfmt --check — all clean (including config/reliability-gates.jsonc, formatted with oxfmt, not prettier).

Red-green, to show the new tests have teeth: with the three call sites reverted to a bare unbounded await and the tests unchanged, all three never-settling cases fail by hanging to the 30s vitest timeout (3 fail / 14 pass). Restored, 17 pass in 0.46s. Note that the gate's existing "admits an already-complete write without waiting for any timer" case passes against an unbounded implementation too — it is a timer control, not evidence of bounding.

What the tests do not show: because they mock codexHookService and ensureRealHomeCodexHookState, nothing here exercises the real config.toml lane, so no test in this PR speaks to whether a quick-launch or a resume completes when that lane is wedged.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New tests: src/main/startup/codex-launch-trust-write-deadline.test.ts (5 cases covering both startup prep sites: the bound, the ordering, and a contained rejection) and one case added to src/main/runtime/runtime-worktree-agent-startup.test.ts.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: no change to what is written or to who may request a trust write. Giving up on a wait can only leave a workspace less trusted.
  • Cross-platform: no platform-conditional code added. The helper is plain timers; the 20s cap is deliberately above the 10s native and below-or-equal-to the 30s WSL lane holder, so a legitimately slow WSL grant may land after the caller already moved on — recorded as a known gap on the gate.
  • Remote SSH: an abandoned SSH write is never treated as evidence of anything and never falls back to a local write, per docs/reference/ssh-execution-boundary.md.
  • Mobile / wire compatibility: untouched; nothing crosses the client-host wire.
  • Backwards compatibility: the helper's behaviour is unchanged for its two existing callers.
  • Performance: no new subprocess, poll or retry. One setTimeout per call, cleared on settlement. The cap is per call site, not global, so two launches racing the same wedged lane each wait their own deadline.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Co-Authored-By: Claude [email protected]

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The bound added at the two startup-prep call sites does not actually bound the launch: each one awaits a same-lane hook install right after the bounded write, and that install has no deadline. The ELI5's "starts the agent anyway" and the new gate oracle hold only because the new tests mock the hook service to resolve instantly. Details inline.

Reviewed changes

  • Bound three more Codex trust writes — markLocalWorktreeTrusted, prepareCodexRuntimeHomeForLaunch and prepareCodexSessionResumeForLaunch now route markCodexProjectTrusted through awaitAgentTrustWriteWithinDeadline (20s race, named warning, rejection adoption) instead of a bare await.
  • Reliability gate updated — agent-session.trust-preflight-completion now lists all five bounded call sites, rewrites the invariant/oracle/coverage notes, and adds the new suites to its command, test list and evidence.
  • New tests — src/main/startup/codex-launch-trust-write-deadline.test.ts (5 cases: bound + ordering for quick-launch and resume prep, contained rejection) plus one never-settling bound case in runtime-worktree-agent-startup.test.ts. The never-settling cases have teeth (they hang to the vitest timeout against a bare await).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread config/reliability-gates.jsonc Resolved
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d63a1393-d3fc-49c3-9cda-f1094aaafeef

📥 Commits

Reviewing files that changed from the base of the PR and between 50b8db8 and e40dd8d.

📒 Files selected for processing (1)
  • config/reliability-gates.jsonc
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/reliability-gates.jsonc

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Codex launch preparation, session resume preparation, and local worktree startup now use a deadline-bounded helper for trust writes. New tests cover timeout handling, call ordering, warning behavior, timer cleanup, and resume outcomes. The reliability gate now includes these paths and records six suites with 53 passing tests.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e40dd

This change can proceed after normal checks. It limits the three targeted waits, but does not guarantee that quick launch or resume completes when later hook work stalls.

Architecture Summary

Architecture risk: 🔵 Low · up to ecd26

The change affects 2 systems.

Changed systems: src, config

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 5 changed files map to changed impact.
  • observed — config (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/main/runtime/runtime-worktree-agent-startup.test.ts: Imports the trust-write deadline constant for use in the new timeout test.
  • observed — Modified behavior in src/main/runtime/runtime-worktree-agent-startup.test.ts: Adds a test for a never-settling Codex trust write. It verifies the call remains pending until the configured deadline, then resolves with a warning and no remaining timers; only the Codex writer is called, with no retry or substitution through another agent’s writer. Cleanup restores the warning spy and real timers and releases the pending promise.
  • observed — Modified behavior in src/main/runtime/runtime-worktree-agent-startup.ts: Imports awaitAgentTrustWriteWithinDeadline for use by local worktree trust handling.
  • observed — Modified behavior in src/main/runtime/runtime-worktree-agent-startup.ts: The Codex trust write is now awaited through a deadline-bounded wrapper with the preset and workspace path supplied as context; previously it was awaited directly.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding bounded waits for the remaining Codex trust writes that can block launch.
Description check ✅ Passed The description is complete and closely follows the repository template. It explains the user impact, implementation, limitations, alternatives, testing, compatibility considerations, and checklist st…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 84ab770e-b9a7-4e7d-83f7-35c3e0f7e3a4

📥 Commits

Reviewing files that changed from the base of the PR and between 6504ef0 and ecd26579824e16807b20cd156699f693fbf43a00.

📒 Files selected for processing (1)
  • config/reliability-gates.jsonc

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread config/reliability-gates.jsonc Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — the gate now correctly scopes the 20s deadline to the trust write. One invariant wording point inline.

Reviewed changes

  • Reliability gate stopped claiming a bounded launch — agent-session.trust-preflight-completion's invariant, oracle, coverageNotes, performanceBudget.evidence and knownGaps now state that the deadline bounds the trust write rather than the whole launch, and name the two launch-prep sites whose next same-lane hook step can still stall the launch.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread config/reliability-gates.jsonc Resolved
nwparker and others added 3 commits September 27, 2026 15:22
…ts on

#23148 capped the trust write on the agentTrust:markTrusted IPC handler and the
worktree-remote startup path, but three call sites still awaited
markCodexProjectTrusted with no bound: the main-process worktree startup used by
orchestration worker-start, Codex quick-launch preparation, and Codex session
resume preparation. All three share the per-config.toml lane with hook installs
and app-server trust grants, which has no cap on queue depth, and the SSH writer
adds a resolveHome round trip plus unbounded SFTP over a possibly half-open
link. A wedged lane left the user clicking "start agent" with nothing happening
and no error.

Each site now routes through the existing awaitAgentTrustWriteWithinDeadline
helper with unchanged semantics for its two current callers. Abandoning at the
deadline never cancels the write, writes nothing else, and never substitutes a
local fallback, so the workspace stays untrusted and Codex raises its own trust
prompt. The await still sits ahead of the runtime-home resolution and hook
repair that the PTY spawn waits on, so the ordering #23148 established is kept.

Reliability only; there is no speed gain. The win is that a launch cannot hang.

Verified with 2,755 agent-trust/Codex/startup/runtime tests, the 53-test
reliability-gate command, the gate manifest check, typecheck:node, changed-code
quality, oxlint and oxfmt. Red-green: with the three sites reverted to a bare
await the new bounding tests hang to the 30s vitest timeout (3 fail/14 pass);
restored, 17 pass.

Co-Authored-By: Claude <[email protected]>
…nded launch

The gate's performance budget said a stuck predecessor "degrades to the
agent's own trust prompt instead of an indefinite caller wait." That is false
at two of this branch's three new sites. In startup/codex-launch-preparation.ts
the next awaited call after the abandoned write is
codexHookService.prepareRuntimeHomeForLaunch; in
startup/codex-session-resume-launch.ts it is installForLaunchPrep or
refreshRuntimeUserHooksForLaunchPrep. Both reach
runExclusivelyForRuntimeAndSystemTrustConfig, which takes the same
runExclusivelyForCodexTrustConfig queue - FIFO per config.toml, no depth cap
and no timeout - on the runtime home and on ~/.codex/config.toml that
markCodexProjectTrusted itself takes. A wedged lane still stalls those two
launches one step later, with the abandoned write holding its queue slot ahead
of the hook step. Only markLocalWorktreeTrusted has nothing after its Codex
branch and so is bounded end to end.

The budget, invariant, oracle and coverage notes now say what is true: all five
markCodexProjectTrusted call sites are bounded, so no trust write hangs a
caller indefinitely, but the bound is on the write and not on the launch. A new
knownGaps entry records the residual stall and that the new launch-prep tests
mock codexHookService wholesale, so nothing in these suites can catch it. The
already-complete-write case stays labelled a timer control, not a red.

Wording only; no production code, test or count changed. The cited command
still reports 6 files / 53 tests, and the gate manifest check passes for 138
gates.

Co-Authored-By: Claude <[email protected]>
…ook-service call

The trust-preflight gate cited codexHookService.prepareRuntimeHomeForLaunch as
the immediate next step after the abandoned write in
startup/codex-launch-preparation.ts. Tracing the module, the first awaited step
is ensureRealHomeHooksIfSelected. It is conditional: only when the target is not
WSL and runtimeHome.isHostSystemDefaultRealHomeSelected(launchEnv) is true does
it call ensureRealHomeCodexHookState, which chains behind that module's own
serial ensure promise and then acquires runExclusivelyForCodexTrustConfig
directly on ~/.codex/config.toml - the same lane markCodexProjectTrusted's inner
acquire takes. When the real home is not selected that call returns without
awaiting the lane, runtimeHome.prepareForCodexLaunchAsync is synchronous on the
non-WSL path, and only then is prepareRuntimeHomeForLaunch the first re-entry.
So the gate could miss a launch stall one step earlier than the one it named.

startup/codex-session-resume-launch.ts had the same omission: its hook branch
takes ensureRealHomeCodexHookState when the resume home is ~/.codex, and only
otherwise installForLaunchPrep or refreshRuntimeUserHooksForLaunchPrep. The
coverage notes also understated the mocking - codex-launch-trust-write-deadline
mocks ensureRealHomeCodexHookState as well as codexHookService and defaults the
real-home selection to false, so neither lane is driven by any suite here.

The performance budget, coverage notes and the residual-stall knownGap now name
the first re-entry on each path and say when it applies, rather than only the
later hook-service call.

Wording only; no production code, test or count changed. The cited command
still reports 6 files / 53 tests, and the gate manifest check passes for 138
gates.

Co-Authored-By: Claude <[email protected]>
@nwparker
nwparker force-pushed the nwparker/bound-remaining-codex-trust-writes branch from 8ce3ef4 to 50b8db8 Compare September 27, 2026 22:27
…ocal writes

The invariant claimed every Codex trust write a launch waits on is bounded or
abandoned at a deadline. The entry's own knownGaps contradicted that: the remote
write reached through markRemoteWorktreeTrusted in
runtime/runtime-worktree-agent-startup.ts is awaited with no timer, and it is a
Codex write, not an adjacent one - it reads TUI_AGENT_CONFIG[agent].preflightTrust,
which is 'codex' for the codex agent, and markRemoteAgentWorkspaceTrusted then
branches into markRemoteCodexProjectTrusted. Its one production caller,
markRemoteWorkspaceTrustedForAgent, is reached with a connectionId from seven
launch entry points; five await it directly before the createTerminal that spawns
the agent, and two gate the launch command they hand back for their caller to
spawn. It chains a session.resolveHome round trip plus SFTP realpath/read/mkdir/
write, none with a timeout, over a possibly half-open link - the same hang this
branch bounds locally.

The invariant now claims only the five local markCodexProjectTrusted sites and
names the remote exception inline instead of leaving it to knownGaps. Audited the
rest of the entry against the code in the same pass: performanceBudget said "no
trust write can hold its caller indefinitely" (now scoped to those five); the
"all five awaited Codex trust writes" tally is now "all five awaited local" and
points at the unbounded sixth; the remote gap no longer calls that path merely
"preset-agnostic and out of Codex scope"; oracle and coverageNotes now record
that nothing here drives markRemoteWorktreeTrusted, since the remote-preset
suite only checks what markRemoteAgentWorkspaceTrusted writes, never how long it
may take; and surfaces gains the remote writer that suite actually covers.

Re-verified the rest rather than assuming it: the launch-prep re-entry chain,
the FIFO no-cap no-timeout trust-config queue, the IPC handler capping both its
remote and local writes with no cross-branch fallback, and that
upsertProjectTrustLevel and upsertProjectTrustLevelInContent remain the only
producers of a project trust_level, so no further writer needs covering. The
already-complete-write case stays labelled a timer control, not a red.

Wording only; no production code, test or count changed. The cited command still
reports 6 files / 53 tests, and the gate manifest check passes for 140 gates.

Co-Authored-By: Claude <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Scoped the trust-preflight invariant to local writes — agent-session.trust-preflight-completion now claims only the five local markCodexProjectTrusted call sites, and names the unbounded remote markRemoteWorktreeTrusted write as a second explicit limit alongside the "bounds the write, not the launch" caveat.
  • Recorded the remote gap in the gate — oracle, coverageNotes, performanceBudget.evidence and a new knownGaps entry now state that the remote Codex write fronting an SSH launch is unbounded and unmeasured, and the surfaces list gains remote (SSH) agent workspace trust writer.
  • Verified against source — markRemoteWorktreeTrusted (src/main/runtime/runtime-worktree-agent-startup.ts:221) reads TUI_AGENT_CONFIG[agent].preflightTrust, markRemoteAgentWorkspaceTrusted branches into markRemoteCodexProjectTrusted (src/main/remote-agent-trust-presets.ts:23), and the write is awaited via markRemoteWorkspaceTrustedForAgent (src/main/runtime/orca-runtime-activate-managed-worktree.ts:188), so the invariant's exception is accurate and matches knownGaps.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit b61797d into main Sep 27, 2026
40 checks passed
@nwparker
nwparker deleted the nwparker/bound-remaining-codex-trust-writes branch September 27, 2026 23:30
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