Skip to content

refactor: resume running sessions after graceful restarts - #185730

Merged
steipete merged 67 commits into
mainfrom
codex/simple-restart-resume
Oct 28, 2026
Merged

steipete merged 67 commits into
mainfrom
codex/simple-restart-resume

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Graceful Gateway restarts can wait on busy agent work for tens of seconds, then reconstruct execution through competing recovery owners and hold new user input behind recovered runs.

The motivating incident had 15 restarts in one day, each draining roughly 170–185 operations including about 20 agent runs. Restart recovery occupied approximately 290 non-test files / 57k lines across a dozen owners, following roughly 200 restart-fix commits in 30 days. One new prompt waited 14m15s in admission behind recovered work. Shutdown also failed on retained plugin resources and stalled for about 80 seconds in lifetime sidecar cleanup.

User Impact

A graceful restart records which root sessions are running, promptly aborts their work, then sends each one ordinary input asking it to inspect current state and continue. Captured queued user messages follow in FIFO order under each sender's current authority. New messages use ordinary steering and queueing. The Control UI shows the conversation and normal composer, without recovery banners, interrupted-input notices, or bulk dismissal.

Accepted loss: a crash or SIGKILL records no shutdown marker, so nothing automatically resumes. The transcript remains available and a new user message works. Background processes do not survive a replacement process. When the shutdown snapshot saw running background exec, the same single resume input also says exactly: “Background exec processes were stopped; rerun them if still needed.” There is no exactly-once guarantee for external effects, child task adoption, or startup orphan reconstruction.

Refused or unavailable stores are skipped and logged, so one refused agent cannot hold healthy agents’ chat admission closed. If inventory discovery itself fails, automatic resume is skipped with a warning and fresh input remains available for healthy sessions.

Markers are cleared before admission. A crash or admission failure in that startup window can lose the automatic resume; no effect or input exactly-once machinery is added. The transcript and a fresh user input remain the recovery path.

Old recovery fields and inference-only queued rows remain readable but inert. Their text is preserved; normal retention may reclaim data previously pinned only by dead recovery state. There is no schema migration, Doctor migration, new config option, dependency change, or protocol version bump. sessions.recover is retired: repository-wide client inspection found only Control UI callers, with no shipped native client contract to preserve.

Why This Change Was Made

Peter's direction:

for restart recovery, can we redesign this? IMO this should be WAY easier. if a session runs (meaning, agent loop OR subagent OR process running) the resume just sends a "system restarted, resume your work" and that's it. this should not be so complicated!

we should grossly simplify restart recovery. session should have some indicator if it runs [agent loop OR subagent OR process running], and if it's slightly lossy that's okay. we usually can rely on gateway being properly shut down, so suspend has a chance to write that state, don't paranoid write it all the time. delete a lot of code

and yes we need e2e test for that.

One new owner, src/gateway/session-restart-resume.ts, snapshots the existing live run, subagent requester ancestry, and background-process owners after admission closes and before aborting them. It stores resumeAfterRestart: { queuedInputIds, hadBackgroundExec?: true } in the existing session_nodes.entry_json, with one replacement batch per physical session store. Nothing is checkpointed per turn or tool for restart recovery. Startup clears each marker and admits the standard resume input through the existing session-event path, preserving current admission, tool authority, routing, and reply delivery.

Short cleanup cutoffs apply only to existing exitAfterClose:true process hosts; embedded GatewayServer.close() joins owned cleanup. Startup rollback receives no inferred intent. The shutdown/supervisor owner src/cli/gateway-cli/run-loop-cleanup.ts owns bounded cleanup joins and exit classification. Bounded-grace leftovers are logged; lifecycle sets process.exitCode and returns naturally. Retained resources prohibit reusing the runtime for an in-process restart. The already-armed native hard-exit watchdog is the sole backstop for leaked handles; a watchdog signal/nonzero exit in that case is accepted. Real required-write/finalizer failures remain failures. Healthy global retirement measured 2327ms, so resource cleanup gets 5s headroom; required persistence has a 3s bound. The existing owned-process supervisor receives its normal 5s TERM policy plus 1s extinction headroom before shared-state retirement. No line-cap or test-budget limits were raised.

The coordinated cutover decisions are:

  1. Resolve the recorded owner principal's current authority and session access; refuse revoked, inaccessible, archived/deleted, or foreign sessions. Current Gateway-owner authority applies only to that same owner profile; role-bearing profiles receive current role scopes. Never decode saved requester/operator authority for restart. Sessions without a human profile use ordinary system-event authority, whose missing capabilities are an accepted limitation.
  2. Mark root sessions only. Running children lead to their top-level requester; shutdown terminates them quietly without completion announcements. The parent's resume input covers inspecting/replacing child work.
  3. Retire the Control-UI-only sessions.recover method, schema, validators, and manual recovery UI.
  4. Preserve reversible suspend/freeze semantics. Drain preparation waits for persistence, not agent idleness; only committed stop/restart snapshots and aborts work.
  5. Keep the required persistence bounds. Apply short cleanup cutoffs only when existing exitAfterClose:true is set; embedded close joins owned cleanup. Log leftover sidecars/plugin resources and exit rather than reuse an unsafe runtime. Bounded leftovers alone set exit code 0 and return naturally; leaked handles may require the existing native watchdog. Never reuse a retained runtime in-process.
  6. Exclude cron occurrences and ACP/external-harness sessions; their existing owners retain scheduling/catch-up and harness lifecycle.
  7. Remove remote provisioning turn/claim reconstruction. Preserve lease/resource release, staged results, file/move journals, and orphan integrity cleanup. Cancel in-flight provisioning and let the resumed turn request it again.
  8. Keep outbound delivery of already-produced bytes/media and the passive update-outcome notice. Delete queue/sentinel paths launching model turns. Legacy inference rows stay inert.
  9. Admit exactly one new standard resume input per marker. Later provider requests may contain that input in history.
  10. Leave legacy interrupted/ownerless rows inert, out of active counts/notices/history pins, without deleting their text. Normal retention applies.
  11. Capture exact queued input IDs in the shutdown marker. After the resume admission, process only those IDs FIFO using each recorded sender's current authority. An unresolvable sender receives one ordinary failed-send state. Crash-left rows are not swept into later resume work.

Live agent-tool caller context is preserved through resumed gateway tools and forced preflight compaction. Ordinary dispatch-error persistence, explicit completion reply obligations, quiet child completion, automation yield, and live FIFO reservation release from related fixes are retained. Restart reconstruction versions of those paths are deleted.

Evidence and current CI

Ready for coordinator admin merge at tested head 921837281c640928bda5f15cfb9af233fd88cdba, integrated main e85b3c8ddf64f463bf12b5abed67e55253f6a739. The coordinator owns landing; no merge attempt, new CI wait, or all-green CI claim.

Final-head invocation (nice -n5, tests --maxWorkers=8) Result Wall time
Acceptance e2e PASS 1/1; every final assertion reached 429.91s
Five gateway files: cleanup + both earlier RPC timeouts PASS 5 files / 54 tests 120.47s
Seven native UI e2e files 4 passed / 3 inherited-failure files; 50 passed / 9 failed tests 119.49s
Tooltip browser + unit consumers, Chromium/WebKit PASS 7 project files / 151 tests 15.21s
types-core PASS 4.7s
types-gateway PASS 5.42s
types-ui PASS 299.75s
types-ui-e2e PASS 269.3s
[restart-resume-proof] SIGTERM markerAndAbortMs=28.0 shutdownMs=9044
[restart-resume-proof] managed markerAndAbortMs=59.7 shutdownMs=3746
Failed b740 CI job Repair / final local result Main evidence / disposition
checks-ui (1/3), job 123088787847 Tooltip overlap passes Chromium and WebKit Original CI overlap signature did not reproduce locally; preserve uncertainty. Related fresh-hover owner defect repaired.
checks-ui (3/3), job 123088787868 Markdown delayed-clipboard reopen passes OURS: exact failure red twice locally, same file passed main, eight net-line owner repair green.
checks-ui-e2e (1/7), job 123088788520 Provider-policy file passes Main passes; no causal fix or inherited claim for unreproduced CI failure.
checks-ui-e2e (2/7), job 123088788627 Six ownership heading failures Same six signatures on exact integrated main; inherited.
checks-ui-e2e (3/7), job 123088788783 Code-block file passes Main passes; CI timeout remains an unreproduced observation.
checks-ui-e2e (5/7), job 123088788637 Mobile media gutters file passes Main passes; CI missing-video failure remains an unreproduced observation.
checks-ui-e2e (6/7), job 123088788648 Sidebar interaction one + rail geometry two failures Same three signatures on exact integrated main; inherited.

All requested 55 gateway/agent files reached assertions (775 passed / 2 RPC-timeout failures). Both timeout files pass final-head proof; the earlier failures remain investigated intermittent observations, not proven fixed/inherited. Exact current-main comparison reproduces only the 9 listed UI failures. No assertion loosening or timeout/retry/budget increase.

Acceptance is one isolated real Gateway with a mock provider and parallel sessions: running stream/tool/root-child/background work; idle exclusion; current authority and active caller context; gateway-backed tool and forced preflight compaction; ordinary steering; exact shutdown-captured FIFO and crash-left exclusion; final replies/history; graceful managed/SIGTERM shutdown and documented SIGKILL loss. All final assertions reached. Explicit PR e2e routing is retained.

Original installed base proof was semantically red: resume count 0/no final reply; SIGTERM20,542/20,543ms against unchanged10,000ms. Steering/FIFO passed on base and are not claimed red. Dedicated worktree removed, lease stopped. Embedded held-reset regression is separately red on b740/green with the boundary fix. Tooltip delayed reopen is red twice before repair/green after. Earlier slow Darwin shutdown and RPC observations remain unresolved; passing replays do not diagnose them.

Core, gateway-server, UI and UI-e2e-chat targeted types, matching type-aware lint, format, line-cap ratchet and diff checks pass. Gateway-other/UI-components proof is reused with unchanged inputs. Fresh isolated Codex P1 repair and conflict reviews are scoped-clean; author pr-simplify completed. 65 of 67 rebased patches are identical; remaining differences are retained main import context and combined UI readiness fences. Dependencies unchanged.

Original run 40486652848's 70 failed jobs were classified/repaired in prior batches (retired symbols, static cycle, lint, fixtures, ordinary FIFO/delivery/cleanup/current authority). Baseline changes only shrink retired entries. This new repair deletes no test. Main matching signatures for UI inheritance are independently reproduced with the native runner on the exact integrated main, rather than inferred from job names.

Commands use repository wrappers, nice -n5 / maxWorkers=8 and separate module caches. Full per-invocation results and exact commands are in the coordinator report. No live Gateway, production state, real channels/providers, deployment, release or version/config/dependency change.

Change size

1452 files changed, 19667 insertions(+), 124765 deletions(-); net -105,098 LOC.

Category Files Added Deleted Net
production/tooling 618 7970 38133 -30163
tests/fixtures 787 11152 84442 -73290
docs 47 545 2190 -1645

No line-cap, lint, test-budget or ratchet limits were raised.

Deleted tests and retained contracts

Reason Test/support/scenario paths Treatment
Pinned removed restart reconstruction 137 Delete obsolete claims, replay, interrupted-input and adoption expectations.
Replaced by consolidated acceptance e2e 12 Replace per-feature restart processes with one real-process restart-resume fixture.
Duplicate 0 No live contract removed as duplicate.

The deleted inventory contains 149 test/support/scenario paths: 137 pinned removed behavior plus 12 replaced by acceptance; zero duplicates. Six additional test/support paths are renamed/adapted with live behavior retained and counted separately. Rewritten cases moved into focused siblings to obey grandfathered caps; unrelated tests were not trimmed. Removed variants also include restored paused-child reservation reconstruction, operator/requester snapshot custody, recovery aggregate merging and obsolete startup observer modes; ordinary completion/yield, Stop and resource integrity remain.

Exact deleted paths by reason

Pinned removed reconstruction (137)

  • src/config/sessions/recovery-notice.test.ts — tombstone-bound hidden notice settlement, retired by generic resume.

  • src/gateway/server.recovery-notice-history.test.ts — old recoverStore / sessions.recover notice continuation, retired by generic resume.

  • src/infra/outbound/delivery-queue.recovery-notice.test.ts — special restart-notice history custody, retired; ordinary produced-byte replay tests retained.

  • src/sessions/recovery-notice.test-support.ts — sole fixture for deleted special restart-notice tests.

  • src/gateway/server.chat-goal-recovery.test-support.ts — newly landed Goal reconstruction bridge, superseded by the generic resume input.

  • packages/gateway-protocol/src/schema/sessions-recover.test.ts

  • qa/scenarios/runtime/gateway-restart-unclaimed-delivery.yaml

  • src/agents/agent-command-admission-facts.test.ts

  • src/agents/agent-command-recovery-owner.test.ts

  • src/agents/agent-command-restart-recovery.test.ts

  • src/agents/agent-command.harness-compaction-custody.test.ts

  • src/agents/agent-command.recovery-source.test.ts

  • src/agents/agent-command.restart-settlement.test.ts

  • src/agents/agent-harness-completion-ownership.test.ts

  • src/agents/agent-harness-completion.test-support.ts

  • src/agents/agent-tools.restart-safe.test.ts

  • src/agents/bash-tools.exec-notify.test.ts

  • src/agents/code-mode-recovery.integration.test.ts

  • src/agents/interrupted-input-context.integration.test.ts

  • src/agents/main-session-recovery/main-session-harness-completion.test-harness.ts

  • src/agents/main-session-recovery/main-session-parent-recovery.test-harness.ts

  • src/agents/main-session-recovery/main-session-recovery-checkpoint.test.ts

  • src/agents/main-session-recovery/main-session-recovery-empty-aggregate.test.ts

  • src/agents/main-session-recovery/main-session-recovery-replay-boundary.test-harness.ts

  • src/agents/main-session-recovery/main-session-recovery-run-ownership.test.ts

  • src/agents/main-session-recovery/main-session-recovery-runtime.test-support.ts

  • src/agents/main-session-recovery/main-session-recovery-runtime.test.ts

  • src/agents/main-session-recovery/main-session-recovery-saturation.test-harness.ts

  • src/agents/main-session-recovery/main-session-recovery-state.terminal-residue.test.ts

  • src/agents/main-session-recovery/main-session-recovery-state.test-support.ts

  • src/agents/main-session-recovery/main-session-recovery-state.test.ts

  • src/agents/main-session-recovery/main-session-recovery-store.test-support.ts

  • src/agents/main-session-recovery/main-session-recovery-store.test.ts

  • src/agents/main-session-recovery/main-session-recovery-yield.test.ts

  • src/agents/main-session-recovery/main-session-restart-abort.integration.test.ts

  • src/agents/main-session-recovery/main-session-restart-dispatch-start.test.ts

  • src/agents/main-session-recovery/main-session-restart-owner-release.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-admission.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-delivery.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-discovery.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-fixture.test-support.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-marking.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-peer-source.test-support.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-peer-source.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-priority.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-resume-policy.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-retry.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-source-admission.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-terminal.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery-transcript.test-support.ts

  • src/agents/main-session-recovery/main-session-restart-recovery.memory.test.ts

  • src/agents/main-session-recovery/main-session-restart-recovery.test.ts

  • src/agents/main-session-recovery/main-session-terminal-approval-migration.test-support.ts

  • src/agents/main-session-recovery/main-session-terminal-approval.test-harness.ts

  • src/agents/pending-final-recovery-source.test.ts

  • src/agents/subagents/completion/subagent-completion-admission.queue-receipt.test.ts

  • src/agents/subagents/registry/subagent-accepted-recovery.restart-integration.test.ts

  • src/agents/subagents/registry/subagent-detached-recovery.restart-integration.test.ts

  • src/agents/subagents/registry/subagent-orphan-recovery.live-tail.test-support.ts

  • src/agents/subagents/registry/subagent-orphan-recovery.raw-owner.test-support.ts

  • src/agents/subagents/registry/subagent-orphan-recovery.restart-integration.test.ts

  • src/agents/subagents/registry/subagent-parent-recovery.restart-integration.test.ts

  • src/agents/subagents/registry/subagent-plain-spawn.restart-integration.test.ts

  • src/agents/subagents/registry/subagent-registry-queued-recovery.test.ts

  • src/agents/subagents/registry/subagent-registry-restart-recovery.test-support.ts

  • src/agents/subagents/registry/subagent-registry-restart-recovery.test.ts

  • src/agents/subagents/registry/subagent-registry-restore.test-support.ts

  • src/agents/subagents/registry/subagent-registry.persistence.orphan.test-support.ts

  • src/agents/subagents/registry/subagent-registry.persistence.wake.test-support.ts

  • src/agents/subagents/registry/subagent-registry.requester-completion.test-support.ts

  • src/agents/subagents/registry/subagent-registry.restored-settlement.test-support.ts

  • src/agents/subagents/registry/subagent-wake-recovery.restart-integration.test.ts

  • src/agents/subagents/spawn/subagent-spawn.recovery.test-support.ts

  • src/agents/tools/message-tool-retry-delivery.test.ts

  • src/auto-reply/reply/agent-runner.runreplyagent.transcript-claim.cases.ts

  • src/auto-reply/reply/recovery-controller.fixture.test-support.ts

  • src/auto-reply/reply/reply-turn-admission.recovery.test.ts

  • src/auto-reply/reply/restart-recovery-claim.durability.test.ts

  • src/auto-reply/reply/restart-recovery-claim.lifecycle.test.ts

  • src/auto-reply/reply/restart-recovery-claim.pending-input.test.ts

  • src/auto-reply/reply/restart-recovery-claim.successor.test.ts

  • src/auto-reply/reply/restart-recovery-claim.test.ts

  • src/commands/doctor-main-session-recovery.test.ts

  • src/config/sessions/main-session-recovery-fixtures.test-support.ts

  • src/config/sessions/restart-recovery-receipt.test.ts

  • src/config/sessions/restart-recovery-state.test.ts

  • src/config/sessions/session-accessor.recovery.test.ts

  • src/config/sessions/session-entry-recovery.worker.test.ts

  • src/config/sessions/session-transcript.worker.recovery-imports.test.ts

  • src/gateway/agent-input-recovery.test.ts

  • src/gateway/agent-turn/agent-restart-recovery-context.test.ts

  • src/gateway/chat-input-recovery.authority.test.ts

  • src/gateway/chat-input-recovery.test.ts

  • src/gateway/gateway.sessions-send-recovery.diagnostics.test-support.ts

  • src/gateway/gateway.sessions-send-recovery.diagnostics.test.ts

  • src/gateway/gateway.sessions-send-recovery.test.ts

  • src/gateway/operator-run-recovery.requester.test.ts

  • src/gateway/server-instance-runtime.native-restart-recovery.test.ts

  • src/gateway/server-instance-runtime.operator-recovery.test.ts

  • src/gateway/server-methods/agent.restart-recovery.test-support.ts

  • src/gateway/server-methods/chat-restart-recovery.worker.test.ts

  • src/gateway/server-methods/session-recovery-continuation.test.ts

  • src/gateway/server-recovery-runtime.test-support.ts

  • src/gateway/server-restart-sentinel.system-event-owner.test.ts

  • src/gateway/server-rpc-restart-owner.test.ts

  • src/gateway/server-run-shutdown.recovery.test.ts

  • src/gateway/server-startup-observers.test.ts

  • src/gateway/server.chat.orphaned-recovery.test.ts

  • src/gateway/server.recovery-peer-authority.test.ts

  • src/gateway/server.sessions.recover-in-place.test.ts

  • src/gateway/server.sessions.recover.authorization.test.ts

  • src/gateway/server.sessions.recover.test.ts

  • src/gateway/server.sessions.recovery-order.test.ts

  • src/gateway/server.sessions.recovery.test-support.ts

  • src/gateway/server.startup-recovery-boundary.test.ts

  • src/gateway/server.startup-recovery-webchat.test.ts

  • src/gateway/server.startup-recovery.test-support.ts

  • src/gateway/server.subagent-settle-replay-recovery.test-support.ts

  • src/gateway/server.subagent-settle-replay.harness.test.ts

  • src/gateway/server.subagent-settle-replay.test-support.ts

  • src/gateway/session-delivery-clock-jump.integration.test.ts

  • src/gateway/session-lifecycle-state.recovery.test.ts

  • src/gateway/session-send-recovery.authority.test.ts

  • src/gateway/session-send-recovery.delivery.mocks.test-support.ts

  • src/gateway/session-send-recovery.discovery.mocks.test-support.ts

  • src/gateway/session-send-recovery.notice-order.test-support.ts

  • src/gateway/session-send-recovery.quarantine.test.ts

  • src/gateway/session-send-recovery.test-support.ts

  • src/gateway/session-send-recovery.test.ts

  • src/gateway/session-send-recovery.upgrade.test.ts

  • src/gateway/session-startup-run-outcomes.test.ts

  • src/gateway/worker-environments/provider-provisioning.shutdown-replay.test.ts

  • src/infra/outbound/delivery-completion.recovery.integration.test.ts

  • test/gateway-recovered-parent-continuation.live.test.ts

  • test/gateway-subagent-restart.live.test.ts

  • ui/src/e2e/peer-followup-restart.real-gateway.e2e.test.ts

  • ui/src/e2e/sidebar-restart-recovery.e2e.test.ts

Replaced by acceptance e2e (12)

  • src/cli/gateway-cli/run-loop-force.test-support.ts
  • src/cli/gateway-cli/run-loop-shutdown-budget.test-support.ts
  • test/gateway-background-process-restart.e2e.test.ts
  • test/gateway-goal-resume-restart.e2e.test.ts
  • test/gateway-process-shutdown-recovery.e2e.test.ts
  • test/gateway-restart-abort-settlement.e2e.test.ts
  • test/gateway-restored-requester-settle.e2e.test.ts
  • test/gateway-session-resume-restart.e2e.test.ts
  • test/gateway-subagent-authority-restart.e2e.test.ts
  • test/gateway-subagent-restart.e2e.test.ts
  • test/gateway-tool-handoff-restart.e2e.test.ts
  • test/gateway-widget-restart.e2e.test.ts

The failed-completion publication-reconciliation case moves to subagent-completion-admission.store.test.ts; prepared-media promotion/publication ordering moves to session-produced-media-delivery.test.ts; ordinary inference-time permission change moves to gateway-session-permission.e2e.test.ts.

src/gateway/session-delivery-clock-jump.integration.test.ts is deliberately removed because its entire contract replayed queued inference (agentTurn / active system events) after a wall-clock jump. That execution path is retired, so renaming its fixtures would restore the wrong behavior. Clock rollback/jump/released-claim scheduling for already-produced byte delivery remains covered by src/infra/session-delivery-queue-runtime.test.ts (including “recomputes future claim timers after a clock jump” and “drains an eligible entry across a clock rollback”), with prepared-media retries in session-delivery-queue.storage.test.ts and produced-media publication ordering in session-produced-media-delivery.test.ts.

Retained live responsibilities have named tests: current principal grants (operator-run-authority.principal.test.ts), live caller/compaction custody (agent-command.compaction-custody.test.ts and acceptance), reversible suspend (gateway-suspend-coordinator.test.ts), shutdown exit/reuse (run-loop.direct-stop-active-work.process.test.ts, run-loop.test.ts, server-close.test.ts), normal chat admission/errors (server.chat.gateway-server-chat-b.test.ts, chat-send-detached-dispatch.test.ts), ordinary child completion/yield (server.subagent-silent-completion.product.test.ts, requester-settle dispatch/command reply-policy and automation-yield suites), produced outbound/media delivery (outbound delivery queue and session-produced-media-delivery.test.ts), passive sentinel (server-restart-sentinel.test.ts), provisioning/file integrity (worker placement/provider/workspace-result suites), cron authority/catch-up (cron integration and requester cron authority), live harness security (agent-harness/native custody and SDK completion), and pending-input retention/FIFO (session-pending-input-history.test.ts and acceptance). Presence is not a claim that every suite has run on the final head; exact-head CI is the broad verdict.

Control UI

Before: synthetic restart state with the manual Resume banner.

After: the same synthetic conversation with the ordinary composer. Inspected before/after screenshots are attached below.

Before: manual restart Resume banner

After: ordinary chat composer

The focused streaming repair preserves the normal assistant identity while a run has no persisted message yet. These synthetic captures were inspected in full:

Before: streaming response without assistant identity

After: streaming response retains assistant identity

@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T23:11:11.230132Z 9218372 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: qa-lab extensions: codex plugin: file-transfer labels Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 921837281c640928bda5f15cfb9af233fd88cdba
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/bash-tools.exec-approval-followup.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/harness/tool-authority.runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/operator-run-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/agent.caller-authority.test-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/cron-creator-authority-admission.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/request-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/worker-connection.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization-async.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/worker-environments/worker-tool-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/shared/session-method-scopes-base.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: faad203a6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/queued-chat-inputs.ts Resolved
@steipete
steipete force-pushed the codex/simple-restart-resume branch from faad203 to ea480fd Compare October 27, 2026 09:43

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea480fd470

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/server-startup-observers.ts Resolved
@steipete
steipete force-pushed the codex/simple-restart-resume branch 2 times, most recently from a4d8e70 to 0497f26 Compare October 27, 2026 10:12

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0497f26319

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete
steipete force-pushed the codex/simple-restart-resume branch from 0497f26 to 5813756 Compare October 27, 2026 14:19

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5813756cbb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/session-restart-resume.ts Resolved
@steipete
steipete force-pushed the codex/simple-restart-resume branch 2 times, most recently from 76bbf03 to 201ea12 Compare October 27, 2026 15:18
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current head: 201ea12c5069db9785dc8d66fe66ecae1512c86d. The natural-exit repair, stopped-background-process resume text, live authority/FIFO/delivery repairs, and refused-store startup fix are published. P1 autoreview is scoped-clean across the repair and integration deltas; targeted type/lint/cap checks pass. Final acceptance passes 1/1 in 102.904s, with SIGTERM 2605ms and managed shutdown 2672ms. The PR body and grouped deleted-test inventory are current. Exact-head CI run 40529714770 is pending.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 201ea12c50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete
steipete force-pushed the codex/simple-restart-resume branch from 201ea12 to 5862784 Compare October 27, 2026 21:04

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5862784246

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +75 to +79
const client = createSyntheticPluginRuntimeClient({
operatorRoleActor: { kind: "operator", profileId: authority.profileId },
operatorRunAuthority: authority,
scopes: [...authority.scopes],
});

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.

P2 Badge Preserve mention publication for retained queued inputs

When a queued Control UI message contains human mentions and survives a graceful restart, this synthetic client has no authenticatedUserProfile. Although createGatewayChatUserTurnController restores selectedMentions from the retained message, it derives senderProfileId exclusively from client.authenticatedUserProfile and consequently skips installing onOriginalInputCommitted. Staging does not publish mentions, so the message eventually executes without notifying its selected recipients. Derive the mention publication sender from the freshly admitted queued-input principal as well.

Useful? React with 👍 / 👎.

Comment on lines +112 to +115
...(message["__openclaw"]?.suppressCommandInterpretation === true
? { suppressCommandInterpretation: true }
: {}),
queueMode: "followup",

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.

P2 Badge Restore the reply target when readmitting queued messages

When an accepted queued message replies to an earlier transcript message, the retained message preserves __openclaw.replyToId, but this reconstructed chat.send request omits it. createGatewayChatUserTurnController only creates replyContextFieldsPromise from request.p.replyToId, and the dispatch path restores only the approved message text, not its reply metadata. The resumed turn therefore loses the quoted target and sender context, so an input such as “do this instead” can execute without the reference the user selected. Restore the retained reply target during readmission.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: telegram Channel integration: telegram cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: codex extensions: qa-lab gateway Gateway runtime plugin: file-transfer scripts Repository scripts security-sensitive-changed size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant