Skip to content

fix: avoid reporting remote worker loss after Gateway restart - #207549

Merged
freeqaz-openai merged 2 commits into
mainfrom
fix/clarify-worker-restart-outcome
Nov 28, 2026
Merged

freeqaz-openai merged 2 commits into
mainfrom
fix/clarify-worker-restart-outcome

Conversation

@freeqaz-openai

@freeqaz-openai freeqaz-openai commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After a restart, the Gateway can lose track of a subagent while a remote worker keeps running. The old error told the parent the run had ended. Repeating a task on that basis can duplicate work.

User Impact

The error says the Gateway could not confirm the result. The guide shows how to check the recorded run in the parent chat and reminds operators to check the remote worker and its effects before trying again.

Why This Change Was Made

This corrects the diagnostic at its source. The registry still records an interruption and uses the existing delivery and cleanup paths. There is no change to execution, permissions, retention or automatic goal continuation.

Evidence

In an isolated development build I stopped the Gateway after a managed worker read a file. A separate Codex app-server finished the turn with the expected answer. After restart, the local registry reported the old interruption error. In a second trial the worker remained active after the replacement Gateway was ready. Both used scripted inference. They demonstrate why the old wording is misleading. This PR contains no experimental recovery code.

Against the original implementation, the revised registry assertion failed on the old notice. With the fix, all 23 registry and Gateway custody cases passed. I ran both suites with pnpm test and --maxWorkers=1 in isolated scratch on main at 2837e846 with the same source for these five files. The two shards took 190.16 seconds including startup. Formatting, type-aware lint and git diff --check passed. I updated the SIGKILL matcher in the separate end-to-end suite and kept its exactly-once assertions. I did not run the full suite locally.

Hosted results at a5818ee8

The restart suite passed the two timer-child cases. The SIGKILL case took 27.64 seconds and the SIGTERM case took 25.81 seconds. Both required one parent notice and one child call.

A separate shell-checkpoint case in the same file failed on the first agent RPC, before shutdown. The Gateway logged a SQLite admission failure. The request returned UNAVAILABLE. This PR leaves the shell case and database admission unchanged. I tested the case in isolation on the same local source described above with the pinned Bun fork and scripted inference. It passed in 32.35 seconds, with ten other cases excluded by the name filter. The hosted failure remains unexplained.

Core lint found a duplicate case for src/shared/assistant-display-content.ts. The same duplicate is present in the main revision I checked. This PR leaves that file unchanged.

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XS labels Nov 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR describes a restarted subagent’s result as unconfirmed and documents checks before repeating remote work.

Example: The Gateway restarts while run restart-interrupted-run has no recorded completion and its external worker may still be active.

  • Before: The parent is told that the run did not survive the restart.
  • After: The parent is told the result is unconfirmed and to inspect the original worker and saved work before retrying.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct diagnostic repair with green current-head CI; proof confidence rests on reported reproduction and automated lifecycle coverage.
Proof confidence 🦐 gold shrimp (3/6) Contributor proof is exempt; reported remote-worker reproduction, registry/custody regression results, and hosted Gateway restart tests support the change, but no independent after-fix runtime capture was inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A parent can mistake an unconfirmed remote outcome for stopped work and repeat a task that is still running or already finished.
Reason: Accurate uncertainty and concrete inspection guidance reduce duplicate-work risk while preserving the established recovery contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it corrects a misleading restart diagnostic at its source, preserves recovery behavior, and has no actionable findings; current-head CI is green.

Reviewed head: b01ead870311d97c24aba51bbc4398089c2ff2d2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The subagent registry settles restored execution records and sends their terminal outcomes through completion delivery to the parent conversation.

flowchart LR
  A[Gateway restart] --> B[Restored subagent records]
  B --> C[Registry settlement]
  C --> D[Completion delivery]
  D --> E[Parent conversation]
  E --> F[Inspect recorded and external work]
Loading

Technical review

Best possible solution:

Keep the existing settlement owner and accurately report uncertainty before operators repeat remote work.

Do we have a high-confidence way to reproduce the issue?

Current-main source emits a definitive loss claim without checking the external outcome; the body additionally reports surviving-worker trials, which this review did not independently execute.

Is this the best way to solve the issue?

The smallest complete diagnostic fix changes the existing producer and its consumers, preserves interruption delivery, and provides usable inspection guidance without adding recovery machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b83f43c1c086.

Provenance checked

  • Restart interruption diagnostic changes intended behavior with a stated reason (3cce42d: Crash-restored children needed a terminal outcome so their requesters would not wait indefinitely.)
  • Terminal reply handling keeps the original intent (78014c9: Settlement must preserve an already recorded reply without waiting for the former Gateway’s executor.)
  • Restart inspection guidance keeps the original intent (f444d3b: Interrupted-child notices require fresh requester custody, and retained work should be inspected before another instruction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 3cce42d adds src/agents/subagents/registry/subagent-registry-sweep-settle.ts:139 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3cce42d18562; files: src/agents/subagents/registry/subagent-registry-sweep-settle.ts)
  • Peter Steinberger: Raw commit f444d3b adds src/agents/subagents/registry/subagent-registry-sweep-settle.ts:152 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f444d3b18c23; files: src/agents/subagents/registry/subagent-registry-sweep-settle.ts)
  • RoboClaw: Raw commit 78014c9 adds src/agents/subagents/registry/subagent-registry-sweep-settle.ts:164 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 78014c961a3c; files: src/agents/subagents/registry/subagent-registry-sweep-settle.ts)

PR surface

Source 0, Tests 0, Docs +4. Total +4 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 3 4 4 0
Docs 1 6 2 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 12 8 +4

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-28T14:21:10.239Z sha a5818ee :: passed. :: none

Reviewed November 28, 2026, 10:54 AM ET / 15:54 UTC (Revision 2).

@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@freeqaz-openai
freeqaz-openai merged commit f1bec5a into main Nov 28, 2026
116 checks passed
@freeqaz-openai
freeqaz-openai deleted the fix/clarify-worker-restart-outcome branch November 28, 2026 15:56
@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant