Skip to content

fix: sandboxed turns lose managed image attachments - #195992

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-native-image-not-staged-regression-20260919
Nov 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-native-image-not-staged-regression-20260919

Conversation

@steipete

@steipete steipete commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native image attachments are rejected as “not staged” when a sandboxed turn replays durable managed-media references, even though the original image is still available. Initial submission can succeed while a fresh attempt loses the image.

User Impact

Sandboxed conversations retain admitted native images across fresh attempts and template reuse. An unavailable original still produces the existing model-visible resend notice. Explicit staged paths and paths written in prompt text retain sandbox containment; this does not grant file tools host-store access.

Why This Change Was Made

Managed attachment references belong to the Gateway media store. Resolve those admitted references through its existing reader and allowlist instead of guessing a legacy sandbox filename. The staging and template owners are unchanged, with no new configuration, cache, or schema. Production delta is +2/-2, net zero lines.

This is an older producer/consumer mismatch: #121980 introduced URI-only durable attachment facts, #132114 moved sandbox copies into private input directories, and #168537 supplied staged paths only during initial hydration. The image-loading owner is byte-identical at c5a52d8 and the tested base 390d069. This PR does not attribute the defect to #195883 or claim a historical end-to-end bisect.

Evidence

  • Real sandbox staging → AgentSession → serialized Responses request: base receives image counts [1,0,0], candidate requires [1,1,0] across initial submission, fresh attempt, and deleted original. The last request must contain the resend notice.
  • Retained-template boundary: prepare three commits, reuse an older generation, stage and verify the image bytes in the returned checkout, then verify image delivery to provider input. Portable copy backend and synthetic dependency installer; no Docker or live vendor claim.
  • Existing staged-copy disappearance and URI traversal controls are retained. No Control UI imports the changed production module.
  • 112 focused tests across 10 files pass, including image replay, staged-copy retry, prefix stability, staging history, and retained templates. The final provider-boundary test also passes after type-narrowing and redundant-spread corrections; its Gateway type graph passes.
  • Codex autoreview: no accepted/actionable P0–P2 findings. Production source is unchanged after review; subsequent mechanical test-only corrections make its image-only input contract explicit and remove a redundant spread.
  • Test growth is 199 lines, allocated explicitly: one regression at the staging/session/provider boundary, an extension of the existing retained-template test, and traversal controls. Original focused wrappers took 108.00 s and 154.48 s; the final single-test wrapper took 29.30 s.
  • pnpm check:changed --base HEAD -- <eight changed files> completed. Its two introduced test diagnostics were corrected, and the affected compiler/lint checks pass. Remaining failures reproduce on exact parent 390d069b8a3777c7a6811f2e10b8115c166cd832: 20 historical changelog attributions, introduced by 266a7aa0fe69 (fix(release): align attribution gate with human credit policy #194364), and the unused authorDisplayName export after cde34f111b4d (Dashboards gallery: Display menu with list view, ordering and grouping #194455) removed its last external consumer. These are existing main validation regressions; neither is masked by this PR. All other scoped gates pass.

Synthetic workload: 62,000 workspace files/1,181,224,000 bytes, 2,000 session identities per arm, five interleaved A/B pairs, separate timing/allocation runs and A/A controls. The owner opens no session database and performs no workspace scan. macOS/APFS, Node 26.12.1; this is not Linux/btrfs or full Gateway performance proof.

Metric per 2,000-session arm, median Before After
Images delivered 0 2,000
Legacy sandbox validations 2,000 0
Owner elapsed 123.52 ms 2,214.10 ms
Request median / p95 0.0492 / 0.1333 ms 0.9534 / 1.5251 ms
CPU 158.06 ms 2,290.94 ms
Sampled allocation 103.61 MB 551.94 MB

The candidate restores decoding that the broken baseline omitted; the increased CPU/allocation is necessary work, not a speedup. Timing A/A totals were 113.64/75.47 ms and allocation A/A was 109.49/105.79 MB. Busy-host timing varied; all correctness/work counts were exact. Rerunnable workload: scripts/perf/native-image-managed-original-measure.ts.

Read admitted managed image originals through the Gateway media owner instead of inferring a legacy sandbox filename. Preserve explicit staged-path containment and the existing resend notice for unavailable originals. Prove fresh-attempt and retained-template delivery at the provider boundary.
@clawsweeper

clawsweeper Bot commented Nov 9, 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 scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling size: M labels Nov 9, 2026
@steipete
steipete marked this pull request as ready for review November 9, 2026 13:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:18:31.769830Z 6e9d61a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@steipete

steipete commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Landing note (maintainer review): Team r302 logged Native image: sandbox validation failed (reason=not-staged, pathClass=managed-media) 10 times in 2026-11-09 12Z (about 1/h before), mostly from restart-resumed and replayed turns. Those images were silently dropped from the model turn. Replayed durable media:// references lose their transient staged sandbox paths and were then resolved through the sandbox boundary, which guessed a filename. Admitted managed originals (media-uri attachments) now load through the existing Gateway media reader confined to the media dir. Prompt-discovered and staged paths keep the sandbox boundary, and missing originals keep the model-visible resend notice. Synthetic fixture: 0 → 2,000 images delivered. Production net 0 (+2/−2); regression fails pre-fix; exact-head CI green.

@steipete
steipete merged commit cbe182f into main Nov 9, 2026
203 of 208 checks passed
@steipete
steipete deleted the steipete/perf-micro-native-image-not-staged-regression-20260919 branch November 9, 2026 13:29
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
Read admitted managed image originals through the Gateway media owner instead of inferring a legacy sandbox filename. Preserve explicit staged-path containment and the existing resend notice for unavailable originals. Prove fresh-attempt and retained-template delivery at the provider boundary.
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
Backport the bounded runtime fix for LOCAL11.8; preserve unrelated baseline behavior.

(cherry picked from commit cbe182f)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 54d304c50214023e6c2c896bef3b86c2444c1a97)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant