Skip to content

fix(setup): prevent false failures after successful model probes - #155407

Merged
RomneyDa merged 1 commit into
mainfrom
fix/setup-inference-probe-cleanup
Sep 22, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/setup-inference-probe-cleanup

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: inference setup can report activation failure after a successful model probe when the probe runtime still retains plugin work during the config reload.

User Impact

User impact: successful provider setup no longer rolls back or shows a false failure while the isolated probe runtime is finishing cleanup.

Why This Change Was Made

The setup probe now owns and drains its tracked asynchronous work before returning to activation. This releases the isolated plugin generation before the Gateway attempts to replace it, and propagates any late cleanup failure instead of treating the probe as ready.

This was discovered while live-testing #155379 but is intentionally split from the Grok 4.7 model-support change.

Evidence

  • Regression test failed on pre-fix main because temporary probe cleanup began while tracked plugin work was still open; it passes after the fix.
  • node scripts/run-vitest.mjs src/system-agent/setup-inference-turn.test.ts --maxWorkers=1 — 5 passed; 18.74s measured wall time.
  • node scripts/run-vitest.mjs src/system-agent/setup-inference-activate.test.ts src/gateway/config-reload.activation.integration.test.ts --maxWorkers=1 — 51 passed; 87.25s measured wall time.
  • pnpm check:changed — passed, including core and test typechecks, formatting, lint, dead-export, line-cap, and import-cycle guards.
  • AutoReview against origin/main — P0/P1 scoped-clean.

@clawsweeper

clawsweeper Bot commented Sep 22, 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.

@RomneyDa
RomneyDa marked this pull request as ready for review September 22, 2026 03:43
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 22, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 4:17 AM ET / 08:17 UTC (Revision 5).

ClawSweeper review

What this changes

Model setup now waits for tracked embedded-probe cleanup before activation and reports cleanup failures, with regression coverage for premature temporary-directory removal.

Merge readiness

✅ Ready for maintainer review

Keep open: the cleanup race remains on the pinned main revision, and this focused fix has no identified blocking defect. The related merged model-support change does not supersede it.

Priority: P2
Reviewed head: bf119a469d713663e5717d2de3260a5d5033c223

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with meaningful ordering coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its regression exercises setup completion against held tracked cleanup; the supplied evidence reports tests, not an observed after-fix live activation. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its regression exercises setup completion against held tracked cleanup; the supplied evidence reports tests, not an observed after-fix live activation. No stored-data contract changes.
Evidence reviewed 8 items Introduced patch: The pinned merge-base-to-head diff adds a probe-owned async work scope, wraps the embedded runner, and adds an ordering regression. Base-only locale and unrelated test changes are outside this PR.
Production cleanup contract: The embedded orchestrator captures its caller's work tracker, resolves the model result before cleanup completes, and subsequently disposes the prepared runtime. The new outer scope joins that existing cleanup owner rather than duplicating disposal.
Current main still needs the fix: The fetched main revision still calls the embedded runner directly; its relevant production difference from the reviewed head is the proposed cleanup wrapper and associated declarations.
Findings None None.
Security None None.

How this fits together

Model setup tests a proposed provider connection through an isolated agent runtime before activating it. The probe must release its plugin runtime before activation reloads the Gateway configuration.

flowchart TD
  A[Proposed model connection] --> B[Isolated model probe]
  B --> C[Model response]
  C --> D[Wait for tracked cleanup]
  D --> E{Cleanup succeeded}
  E -->|Yes| F[Revalidate and activate connection]
  E -->|No| G[Report setup failure]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +35, Tests +53. Total +88 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 47 12 +35
Tests 1 53 0 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 100 12 +88

Review metrics

None.

Technical review

Best possible solution:

Keep probe completion tied to its tracked runtime cleanup, preserving existing activation revalidation and retry behavior.

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

Yes, from source: the runner can return a successful response before tracked runtime disposal finishes, while main lets setup proceed immediately. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes: joining the existing async-work owner at the setup boundary addresses the lifecycle mismatch without changing the runner's general response semantics.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a timing-dependent setup activation failure with an existing retry path and a bounded implementation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its regression exercises setup completion against held tracked cleanup; the supplied evidence reports tests, not an observed after-fix live activation. No stored-data contract changes.

Evidence

What I checked:

  • Introduced patch: The pinned merge-base-to-head diff adds a probe-owned async work scope, wraps the embedded runner, and adds an ordering regression. Base-only locale and unrelated test changes are outside this PR. (src/system-agent/setup-inference-probe-work.ts:21, bf119a469d71)
  • Production cleanup contract: The embedded orchestrator captures its caller's work tracker, resolves the model result before cleanup completes, and subsequently disposes the prepared runtime. The new outer scope joins that existing cleanup owner rather than duplicating disposal. (src/agents/embedded-agent-runner/run-orchestrator.ts:619, bf119a469d71)
  • Current main still needs the fix: The fetched main revision still calls the embedded runner directly; its relevant production difference from the reviewed head is the proposed cleanup wrapper and associated declarations. (src/system-agent/setup-inference-turn.ts:176, 034349f34a42)
  • Latest release comparison: The supplied latest release, v2026.9.5, also invokes the embedded runner without the probe-owned drain. (src/system-agent/setup-inference-turn.ts:176, ec9c1a13db89)
  • Authority and compatibility remain intact: Activation still checks cancellation after the probe and revalidates the current route and execution owner before persistent effects. The patch changes cleanup ordering, not credentials, authorization, stored formats, defaults, or plugin APIs. Its async-work contract is implemented in OpenClaw; the mocked harness name does not establish a Codex dependency contract. (src/system-agent/setup-inference-activate.ts:453, bf119a469d71)
  • Regression and supplied validation: The new test holds tracked cleanup open and checks that setup and temporary-directory removal remain pending until release. The captured PR body reports a pre-fix failure, five focused passing tests, 51 activation/reload passing tests, and changed-file checks; these were not rerun during this read-only review. (src/system-agent/setup-inference-turn.test.ts:58, bf119a469d71)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-22T03:49:41.159Z sha 033aefc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T04:58:24.819Z sha b8d9d54 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T06:06:12.158Z sha 60878ecfad70be2721148128691fe06bc65ad694 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T07:50:48.501Z sha 1491bf561cddf9b3f9a926ed07afe95e91c659ec :: needs maintainer review before merge. :: none

@RomneyDa
RomneyDa force-pushed the fix/setup-inference-probe-cleanup branch 4 times, most recently from 60878ec to 1491bf5 Compare September 22, 2026 07:43
@RomneyDa
RomneyDa force-pushed the fix/setup-inference-probe-cleanup branch from 1491bf5 to bf119a4 Compare September 22, 2026 08:09
@RomneyDa
RomneyDa merged commit 537f8f4 into main Sep 22, 2026
185 checks passed
@RomneyDa
RomneyDa deleted the fix/setup-inference-probe-cleanup branch September 22, 2026 16:19
vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit 'f3327bde3c6052a4ed6d487bb09fbe1e11c0cd35': (25 commits)
  fix(test): pass the fixture lifetime to launcher fixtures (#155825)
  fix(test): prepare history benchmark before child deadlines (#155780)
  refactor(config): derive tool contracts from schemas (#155484)
  chore(deps): update fs-safe to 0.18.1 (#155771)
  fix(doctor): allow repair with retained deleted-agent sessions (#155752)
  fix(setup): await inference probe cleanup (#155407)
  fix(mcp): recover expired SSE sessions and speed up parsing (#155497)
  fix(release): forward the stable soak waiver through the candidate helper (#155798)
  feat: calibrate Gateway plugin resources through retirement (#155792)
  fix: preserve the invoked launcher when restarting Node (#147621)
  fix(sessions): stop repeated failed worker exit cleanup (#154720)
  fix(ui): preserve active replies and tools after failed steering (#155746)
  fix(ci): retain missing-load-path baseline diagnostics (#154861)
  fix(gateway): keep session lists responsive during activity updates (#155767)
  fix: keep plugin queues bound to their selected session (#155714)
  chore(i18n): refresh native locales (#155571)
  fix(ci): wait for reset hook entry and join fixture cleanup (#155770)
  test: move subagent fixtures to module boundaries (#155727)
  fix(gateway): retain question requester authority through settlement (#155335)
  perf(gateway): move progress-card reads off the main thread (#153857)
  ...
MertBasar0 added a commit to MertBasar0/openclaw that referenced this pull request Sep 22, 2026
Keeps setup-inference-turn.ts under its 700-line cap after merging
main's async probe drain (openclaw#155407). The hidden-run registration moves
into setup-inference-probe-work.ts, which already owns the probe's
lifecycle; the clear still runs in the finally block after the drain,
so late probe events stay out of Gateway projection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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