Skip to content

fix(media): stop image setup after cancellation - #140149

Merged
steipete merged 1 commit into
mainfrom
codex/130706-image-cancel-20260906
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/130706-image-cancel-20260906

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Related: #130706

What Problem This Solves

Fixes an issue where a canceled or timed-out image description could continue authentication when pending setup work completed. Late setup could also publish a runtime credential after the caller had already received its cancellation error.

Why This Change Was Made

Carry the existing combined caller/timeout signal through image runtime admission and check it after each asynchronous setup stage, before starting the next stage or publishing a runtime credential. The existing owner still releases the prepared runtime when pending work settles.

User Impact

Cancellation prevents further image setup and inference. In-flight operations finish their cleanup without starting a new authentication stage.

Evidence

  • Regression: the original two late-success cases fail before the repair; eight additional cases fail with only the initial model-lookup guard. The final timeout/cancellation table covers admission, model lookup, credential lookup, credential-scoped model lookup, and runtime auth. All 50 focused image tests pass.
  • Required changed gate, independent P2 review, and full pnpm build pass.
  • Thirteen behavioral checks pass with a loaded fixture plugin and synthetic loopback HTTP: ten use the compiled public image SDK; three source-loader OAuth checks additionally observe exact lease counts through credential refresh. Canceled/timed-out requests reject before held work completes, start no subsequent auth or inference, and release their owner after late completion.
  • Build/proof ran before commit on source identical to 7e0589437ae84eae5e2c84196c7afcbf6a91b367. The committed patch hash and 29,248 source/tooling/package hashes match; all 11,131 runtime files stayed unchanged during proof. Original build stamps are retained.

Production: +8 lines for the existing cancellation boundary. Tests: +7 lines, consolidating two narrow cases into ten. This focused extraction participates in the overall production reduction from #130706.

Carry the combined request signal into image runtime admission and check it
after every awaited model or credential preparation stage. Pending setup
keeps responsibility for releasing its lease, while late results cannot
start more auth work or publish runtime credentials after cancellation.

Found while extracting and validating the useful changes from #130706.
@steipete steipete self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 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 size: S maintainer Maintainer-authored PR labels Sep 6, 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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 10:04 AM ET / 14:04 UTC.

ClawSweeper review

What this changes

Stops canceled or timed-out image descriptions from continuing authentication or publishing runtime credentials when pending setup finishes, with regression coverage across five setup stages.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still permits late image setup to continue after cancellation. This focused repair has no identified blocking defect, and the maintainer-authored, protected PR is not eligible for cleanup closure.

Priority: P2
Reviewed head: 7e0589437ae84eae5e2c84196c7afcbf6a91b367

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful cancellation coverage and no identified blocking correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate is exempt for this MEMBER-authored PR. Its captured body reports targeted image SDK and OAuth loopback checks through the changed setup owner, including rejection before late completion and eventual cleanup; those runs were not independently replayed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate is exempt for this MEMBER-authored PR. Its captured body reports targeted image SDK and OAuth loopback checks through the changed setup owner, including rejection before late completion and eventual cleanup; those runs were not independently replayed.
Evidence reviewed 7 items Verified introduced production changes: The pinned merge-base-to-head diff passes the combined cancellation signal into runtime admission and checks it after admission, model lookup, credential lookup, credential-scoped model lookup, and runtime authentication.
Repair remains necessary on main: Both production files are identical between fetched main and the PR merge base. Main therefore still lacks the introduced setup guards; its existing timeout race rejects the caller without preventing subsequent authentication and runtime-key publication.
Admission and cleanup contract: The existing admission owner races pending publication against the signal, releases admission claims on rejection, and returns an idempotent lease release. Image setup retains its finally-based release when preparation throws, while the caller retains cleanup for a late successful resolution.
Findings None None.
Security None None.

How this fits together

Image understanding turns image attachments and prompts into descriptions using configured model providers. Its setup layer acquires a runtime lease, resolves the model and credentials, and hands the prepared request to inference.

flowchart TD
  A[Images and prompt] --> B[Acquire runtime lease]
  B --> C[Resolve model and credentials]
  C --> D{Request still active?}
  D -->|Yes| E[Publish runtime credentials]
  E --> F[Provider inference]
  D -->|No| G[Reject and release lease]
  F --> H[Description and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +8, Tests +7. Total +15 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 25 17 +8
Tests 3 76 69 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 101 86 +15

Review metrics

Metric Value Why it matters
Cancellation boundary coverage 2 termination modes × 5 setup stages The regression table checks that late completion cannot advance authentication or inference and still releases the runtime lease.

Technical review

Best possible solution:

Keep cancellation checks at the image setup owner’s asynchronous boundaries while preserving existing credential protection, provider selection, and lease cleanup.

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

Yes, from source: hold an asynchronous image setup stage, cancel or time out the request, then let that stage finish; current main can continue authentication and publish a runtime key. This review did not execute that scenario.

Is this the best way to solve the issue?

Yes. Reusing the combined request signal and existing admission API repairs the owning boundary without adding another cancellation mechanism or changing successful-request configuration.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded image-request cancellation behavior without evidence of a widespread outage or urgent user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate is exempt for this MEMBER-authored PR. Its captured body reports targeted image SDK and OAuth loopback checks through the changed setup owner, including rejection before late completion and eventual cleanup; those runs were not independently replayed.

Label justifications:

  • P2: This repairs bounded image-request cancellation behavior without evidence of a widespread outage or urgent user-facing regression.
  • 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 ordinary external-contributor proof gate is exempt for this MEMBER-authored PR. Its captured body reports targeted image SDK and OAuth loopback checks through the changed setup owner, including rejection before late completion and eventual cleanup; those runs were not independently replayed.

Evidence

What I checked:

  • Verified introduced production changes: The pinned merge-base-to-head diff passes the combined cancellation signal into runtime admission and checks it after admission, model lookup, credential lookup, credential-scoped model lookup, and runtime authentication. (src/media-understanding/image-model-runtime.ts:137, 7e0589437ae8)
  • Repair remains necessary on main: Both production files are identical between fetched main and the PR merge base. Main therefore still lacks the introduced setup guards; its existing timeout race rejects the caller without preventing subsequent authentication and runtime-key publication. (src/media-understanding/image.ts:431, 62a5920cd420)
  • Admission and cleanup contract: The existing admission owner races pending publication against the signal, releases admission claims on rejection, and returns an idempotent lease release. Image setup retains its finally-based release when preparation throws, while the caller retains cleanup for a late successful resolution. (src/agents/prepared-model-runtime-lease.ts:284, 7e0589437ae8)
  • Regression coverage: The consolidated table exercises timeout and caller cancellation at five setup stages, then releases held work and checks exactly one lease release, no subsequent authentication stage, no runtime-key publication, and no inference. Existing workspace/profile assertions now expect the forwarded signal. These tests were inspected, not executed during this read-only review. (src/media-understanding/image.runtime-timeout.test.ts:611, 7e0589437ae8)
  • Captured validation and related work: The supplied PR body reports 50 focused passing tests, a passing changed gate and build, and 13 behavioral checks using the compiled image SDK or source-loader OAuth path with a fixture plugin and loopback HTTP. It reports rejection before held work completes, no subsequent auth or inference, and eventual owner release. It explicitly identifies this as a focused extraction related to fix: prevent Gateway stalls with multiple workspaces #130706, which remains open and is not a safe supersession target. (7e0589437ae8)
  • Area history and routing: Current-main history includes Peter Steinberger's image setup timeout work and prepared-model reuse work, plus Vincent Koc's recent model-runtime maintenance. Detailed blame and historical patch inspection encountered unavailable objects and network resolution failures, so no source-line introduction attribution is asserted. (src/media-understanding/image-model-runtime.ts, 62a5920cd420)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

@steipete
steipete merged commit 631f407 into main Sep 6, 2026
180 checks passed
@steipete
steipete deleted the codex/130706-image-cancel-20260906 branch September 6, 2026 14:18
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
Carry the combined request signal into image runtime admission and check it
after every awaited model or credential preparation stage. Pending setup
keeps responsibility for releasing its lease, while late results cannot
start more auth work or publish runtime credentials after cancellation.

Found while extracting and validating the useful changes from openclaw#130706.
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