Skip to content

fix(agents): fence restart recovery to gateway lifecycle - #119776

Merged
vincentkoc merged 1 commit into
mainfrom
fix/subagent-recovery-lifecycle-fence
Aug 6, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/subagent-recovery-lifecycle-fence

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where interrupted subagent recovery could continue after the Gateway lifecycle that started it had retired, allowing stale restart work to dispatch through the replacement lifecycle.

Release note: Fixes a race where interrupted subagent recovery could dispatch through a retired Gateway lifecycle after restart.

Why This Change Was Made

The root cause was split across the restart-recovery and run-manager owner boundary: recovery's source-current predicate checked row and session identity but omitted its captured Gateway lifecycle generation, while the durable reserved -> attempted transition accepted a supplied stale generation. That let stale recovery work stamp the replacement generation after an await.

The canonical fix carries the captured lifecycle through recovery admission and into markLaunchAttempted, while the run manager rejects a stale supplied generation before mutating or persisting the at-most-once receipt.

User Impact

When the Gateway lifecycle rotates during transcript recovery, the stale recovery returns as handled without reserving a launch, marking an attempt, or dispatching. The active lifecycle remains responsible for any subsequent recovery.

There are no config, schema, dependency, performance, index, or scheduling changes.

Evidence

  • Exact commit: 67beead1b7f205d6f63ae387c1f6b2bc6a7c8d60

  • Production delta: +3/-1, net +2; tests: +86

  • Restart-recovery focused suite: 27/27

  • Direct run-manager stale-generation contract: 1/1

  • Orphan restart integration suite: 8/8

  • Sibling proof covers both the durable run-manager transition and cold-restart orphan recovery behavior.

  • Exact-head Blacksmith core, coreTests check passed: https://github.com/openclaw/openclaw/actions/runs/31056517970

  • Structured branch autoreview: no P0/P1 findings

  • This PR is AI-assisted.

  • I understand what the code does.

  • I ran autoreview and addressed all actionable findings.

@vincentkoc vincentkoc self-assigned this Aug 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 5, 2026 23:44
@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer lifecycle review complete for exact head 67beead1b7f205d6f63ae387c1f6b2bc6a7c8d60. Exact-head CI is green. The Gateway lifecycle owner fence, at-most-once receipt transition, and reserved-receipt retry semantics were independently reviewed with no findings. This applies ClawSweeper's remaining rank-up move; the maintainer-authorized decision is to land this narrow repair.

@vincentkoc
vincentkoc merged commit a20746e into main Aug 6, 2026
184 checks passed
@vincentkoc
vincentkoc deleted the fix/subagent-recovery-lifecycle-fence branch August 6, 2026 00:05
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 6, 2026
…cope

* origin/main: (24 commits)
  fix(backup): skip transient gateway lock databases (openclaw#119782)
  test(agents): use canonical auth session fixtures (openclaw#119821)
  fix(memory): keep QMD file hints after stale docid misses (issue openclaw#113041) (openclaw#113515)
  test(doctor): align fast-path repair contracts (openclaw#119812)
  perf(agents): index subagent recovery ownership (openclaw#119793)
  fix(gateway): keep chat startup off catalog discovery (openclaw#119742)
  fix(test): keep TUI PTY suites in their owner lane (openclaw#119787)
  docs: correct dashboard auth precedence (openclaw#119785)
  docs: document control ui owner handoff
  fix: grant host-authorized control ui owner access
  fix(worktrees): preserve registered roots during orphan cleanup (openclaw#119709)
  fix(matrix): prevent shared client key collisions (openclaw#119667)
  fix(diagnostics-otel): propagate exported span context (openclaw#112283)
  fix(worker): isolate state observer failures (openclaw#117507)
  fix(qa): attest realized profile executions (openclaw#119761)
  fix(gateway): finish successful sessions after timestamp races (openclaw#119752)
  fix(agents): fence restart recovery lifecycle (openclaw#119776)
  fix(ui): preserve chat history and active run timing (openclaw#119729)
  improve(ollama): reduce inactive startup cost (openclaw#119745)
  improve(gateway): defer inactive plugin runtime imports (openclaw#119733)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant