Skip to content

fix(fabric): stop a failed agent runtime before starting another - #14587

Merged
cv merged 2 commits into
v1from
cv/stop-failed-runtime
Nov 18, 2026
Merged

cv merged 2 commits into
v1from
cv/stop-failed-runtime

Conversation

@cv

@cv cv commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Apply now stops a Fabric agent's failed runtime before it starts another in the same sandbox, so an agent recovers on the next apply after provider errors instead of failing every apply until someone stops the runtime by hand or replaces the sandbox.

Problem

After provider errors, such as a model endpoint that answers 500, Fabric can mark a runtime failed while its adapter host and native processes keep running (NVIDIA/NeMo-Fabric#670).
Refresh then finds the runtime not running, and the plan gives fabric_agent an unknown runtime_id.
Apply received no runtime ID, skipped fabric-agent-ctl stop, and started another runtime beside the failed one, which Fabric refused:

  • With runtime.keep_state, the failed runtime still held the agent's state lock: start (state_in_use) on every apply until someone ran fabric-agent-ctl stop.
  • Without kept state, OpenClaw's Gateway still held its ports: start (start_failed), with unknown effects, after which Fabric refused every start until the sandbox was replaced.

The comment in configuration::ensure said a stopped runtime is stopped in Fabric first, and the provider reference and usage guide said the same, but only the backend tests passed a runtime ID that a real plan never carries.

Change

  • fabric_agent's backend implements update: when the planned runtime_id is unknown, it takes the prior state's ID, so ensure stops that runtime before it starts another. Stopping a runtime Fabric no longer has already counts as stopped. If the stop fails, apply keeps the prior state, and the next apply stops the runtime again.
  • The fabric provider's backend passes update through to it; before, the trait's default dropped the prior state.
  • The fake gateway can mark a runtime failed (fail_agent_runtime) as Fabric at the pinned revision does: checks and invokes find it unavailable, a stop ends it, and until then a start in its sandbox fails with state_in_use when the agent keeps state, or start_failed with unknown effects otherwise.
  • Tests: the failed_runtime contract scenario applies through OpenTofu after the runtime fails without kept state, and a backend test covers kept state. The existing restart backend test now passes the row a real plan produces. Each new test failed before the fix.
  • Docs: the provider reference, the state_in_use troubleshooting row, and the release notes.

Stopping the failed runtime is the caller's step under Fabric's current contract; #670 asks whether Fabric should stop the host itself. This change stays correct either way, since a stop of a runtime that's already gone succeeds.

Beyond CI

The provider-500 case isn't verified live with this change. #670 records the failure live, with kept state on the pending Fabric pin bump and without kept state at Fabric 135147a0. A rerun on this branch, with OpenClaw at 135147a0 and no kept state, didn't reach it: six invocations against a model stub that answered 500 or hung each returned a failed result, and Fabric kept the runtime active, so apply had nothing to recover.

After provider errors, Fabric marks a runtime failed but leaves its
processes running. Refresh then finds the runtime not running, and the
plan gives the agent an unknown runtime_id, so apply had no ID to stop
and started another runtime next to the failed one. Fabric refused that
start: state_in_use while the failed runtime held the agent's kept
state, or start_failed while OpenClaw's Gateway still held its ports,
after which Fabric refused every start until the sandbox was replaced.

Apply now takes the stopped runtime's ID from the prior state and stops
it before starting another in the same sandbox. Stopping a runtime that
Fabric no longer has still succeeds. If the stop fails, the agent keeps
the old ID and the next apply stops it again.

Signed-off-by: Carlos Villela <[email protected]>
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@cv

cv commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness recorded Pi 1.5.2 with the Pit TypeScript tool Install path in the session's system prompt
Skills recorded write-tests (complete read); test-driven-development (complete read); nemoclaw-contributor-create-pr (complete read) Tool results in the session record
Instruction files recorded AGENTS.md (injected); WRITING.md (complete read); .github/PULL_REQUEST_TEMPLATE.md (complete read); .github/SESSION_REPORT_TEMPLATE.md (complete read) Startup injection and tool results
Tool calls partial typescript: 84 Wrapper calls to 08:45Z, including failed ones; the shell, git, and workspace calls nested in each are not counted
Tokens partial input: 12856916; cached input: 12630599; output: 65671 Sum of assistant message usage to 08:45Z; two assistant entries report zero output, which the record doesn't confirm
Session window recorded 2026-11-18T08:01Z to 2026-11-18T08:45Z; 44 min First entry to the cutoff, including idle time
Compactions recorded 0 Complete record to the cutoff; two context elisions, which aren't compactions
Models recorded azure/anthropic/claude-opus-5-5 Model change entries; no changes
Reasoning levels recorded high Thinking-level entries; no changes

@cv
cv merged commit 1257bc4 into v1 Nov 18, 2026
79 of 80 checks passed
@cv
cv deleted the cv/stop-failed-runtime branch November 18, 2026 09:22
@cv cv added the v1 NemoClaw v1 branch label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant