Skip to content

fix(webchat): expose inline uploads to file tools - #143753

Merged
obviyus merged 3 commits into
openclaw:mainfrom
harjothkhara:codex/openclaw-103198-2026-09-09
Sep 10, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
harjothkhara:codex/openclaw-103198-2026-09-09

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Refs #103198

What Problem This Solves

Small images uploaded through WebChat reach vision, but the agent cannot use the same upload with file tools because the active turn omits its persisted media entry.

This change passes that entry to the existing validated staging owner and selects the session's execution workspace. It suppresses image hydration from the managed copy, so the model keeps one original user-image input. Configured workspaces for skills and model preparation remain separate from session and subagent execution workspaces.

Evidence

The built Gateway and bundled Control UI reproduced the missing-path failure on pinned main 94a2d79bf934. Real browser validation also found that the initial fix staged a selected-workspace upload in the default workspace, where the file guard correctly rejected it. The completed repair stages the upload in its selected workspace before the actual file read and digest command.

Verified runtime outcomes:

  • Ordinary small-image upload, actual file read, and actual SHA-256 command agree on the uploaded bytes.
  • Mixed image/document uploads remain readable with one image on the current user message.
  • A second workspace receives its own files; its file guard rejects the first workspace.
  • Larger offloaded images retain their original bytes and single vision input.

The small-image digest was 860f57b09f6d8d3e4264ec14ea3ca2157878804e0cd7ae0cd375ea3da62c502e. The distinct mixed/selected-workspace image digest was 86c4823ac6fb1fc20bb1e0cad44a384c1bbbf60e580761caf82baa8c40abd296.

Validation: 125 distinct focused attachment, Gateway, staging, lifecycle, and workspace cases passed across the retained proof; affected staging and skills/cwd cases were rerun after the workspace correction. Durable image claims remain path-free while active media provides the files for staging. New regressions fail on baseline production for the intended reasons. Runtime builds, changed-file formatting, syntax lint, and line/assertion checks pass. Independent runtime validation uses synthetic uploads and fresh judgments for each local provider request.

Scope: this fixes ordinary inline upload access. The existing vision-capable all-offloaded route still supplies no file-tool path, so the broader issue remains linked. File-policy proof is not an OS-container test. AI-assisted.

@clawsweeper

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

@harjothkhara
harjothkhara marked this pull request as ready for review September 10, 2026 06:00
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 12:18 PM ET / 16:18 UTC (Revision 3).

ClawSweeper review

What this changes

Makes inline WebChat image uploads readable by file tools in the session’s execution workspace while preserving one vision input.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded repair: current main and the latest release still omit ordinary inline uploads from staging. No introduced correctness defect was found, and the recorded browser results support the repaired path.

Priority: P2
Reviewed head: 993197f39d5d55df2b94e50d17227e81c870f3b7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant runtime observations and regression coverage; no blocking patch defect was identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.
Evidence reviewed 8 items Current main still needs the repair: Ordinary WebChat still receives an empty managed-media promise because the producer requires explicitOriginTargetsPlugin. Inline images reach reply options without the active media facts needed for staging.
Latest release retains the omission: The same plugin-only managed-media gate is present in v2026.9.3; this is not an already-shipped repair.
Existing staging and execution owners: The patch uses the same persisted-workspace resolver already used by reply execution. The staging owner retains source validation, bounded reads, cancellation checks, safe destination creation, and positional media metadata.
Findings None None.
Security None None.

How this fits together

WebChat sends uploads through Gateway attachment preparation into the agent reply pipeline. That pipeline stages managed files into the execution workspace and supplies attachment references and images to the agent.

flowchart TD
  A[WebChat upload] --> B[Gateway attachment preparation]
  B --> C[Managed media store]
  C --> D[Active attachment facts]
  D --> E[Session workspace staging]
  E --> F[File tools]
  B --> G[Single vision input]
  D --> H[Suppress duplicate hydration]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +47, Tests +291. Total +338 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 57 10 +47
Tests 6 292 1 +291
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 349 11 +338

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +47 net lines; tests +291 net lines Production growth connects existing media and workspace owners; regression coverage targets staging, duplicate hydration, and durable claims.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #103198
Summary: This PR repairs the ordinary inline-upload portion of the canonical report; all-offloaded behavior remains outside its stated scope.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep attachment staging and workspace selection with their existing owners, while retaining the broader offloaded-image work in the linked issue.

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

Yes: current main’s ordinary inline-image route omits active media facts and therefore misses staging; the PR also records a failing baseline browser run. This review did not execute the application.

Is this the best way to solve the issue?

Yes: the repair supplies missing facts to existing staging and workspace-selection owners, preserves durable claims, and suppresses duplicate image hydration without adding configuration or a parallel file-access mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0f68d696c3cc.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Repairs a bounded WebChat upload-to-file workflow while ordinary vision input remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded bundled Control UI and built Gateway runs exercise upload preparation, session-workspace staging, actual file reads, and digest commands, with matching bytes, one vision input, and cross-workspace rejection; the final commit changes only a test assertion.

Evidence

What I checked:

  • Current main still needs the repair: Ordinary WebChat still receives an empty managed-media promise because the producer requires explicitOriginTargetsPlugin. Inline images reach reply options without the active media facts needed for staging. (src/gateway/server-methods/chat-send-user-turn.ts:133, 0f68d696c3cc)
  • Latest release retains the omission: The same plugin-only managed-media gate is present in v2026.9.3; this is not an already-shipped repair. (src/gateway/server-methods/chat-send-user-turn.ts:133, 1391f7cd2d40)
  • Existing staging and execution owners: The patch uses the same persisted-workspace resolver already used by reply execution. The staging owner retains source validation, bounded reads, cancellation checks, safe destination creation, and positional media metadata. (src/auto-reply/reply/stage-sandbox-media.ts:43, 993197f39d5d)
  • Recorded after-fix browser behavior: The supplied PR body records built Gateway and bundled Control UI runs with actual file reads and SHA-256 commands, matching uploaded bytes, mixed uploads with one image input, and rejection of another workspace’s file. It reports baseline failure and the corrected selected-workspace result. The small-image digest is 860f57b09f6d8d3e4264ec14ea3ca2157878804e0cd7ae0cd375ea3da62c502e. These are contributor-recorded runtime observations, not reviewer execution; the proof does not claim OS-container validation. (993197f39d5d)
  • Re-review continuity: Since the previous reviewed head, only the managed-image regression assertion changed. It now expects active paths while retaining the existing path-free durable-claim assertions; production code is unchanged. The prior projection contains no outstanding findings or published rank-up moves. (src/gateway/server-methods/chat.directive-tags.test.ts:6297, 993197f39d5d)
  • Related report and previous workaround: [Bug]: WebChat image attachments not mapped to media store path — image tool receives "image_0" instead of real file path #103198 includes rodja’s production staging observation and byte-identical Docker-sandbox result, supporting the producer-side diagnosis. fix 'WebChat image attachments not mapped to media store path  #103254 closed unmerged and only proposed guidance for image-index strings, so it does not supersede file access. The broader report remains relevant to the explicitly excluded all-offloaded route.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • MasterSwords1: 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 (2 earlier review cycles)
  • reviewed 2026-09-10T06:07:24.740Z sha de2b068 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-10T15:54:51.856Z sha 2e22ed8 :: needs maintainer review before merge. :: none

@obviyus obviyus self-assigned this Sep 10, 2026
@obviyus
obviyus requested review from a team as code owners September 10, 2026 15:45
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser labels Sep 10, 2026
@obviyus

obviyus commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks @harjothkhara!

Proof: real bundled WebChat uploads reached file tools in the selected workspace. Actual image reads and SHA-256 output matched the uploaded bytes, with one current user-image input and correct outside-workspace rejection.

  • Bug: ordinary inline uploads had no staged file path; a selected-workspace upload could also be staged into the default workspace.
  • Fix: pass persisted inline media through the existing staging owner and use the session's execution workspace.
  • Validation: 125 distinct focused cases across the retained proof, affected workspace/skills checks, runtime builds, and independent browser/file-tool acceptance.
Before After
Vision received the image, but file tools had no usable path or rejected the wrong-workspace path. The selected workspace receives the file before actual read and digest tools run.

The broader issue remains open for the existing all-offloaded image path; this landing covers ordinary inline uploads.

Exact-head CI passed after one diagnostic rerun. The first attempt's deadline assertion failure remains recorded; its exact cause was not captured. No red-check exception was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

2 participants