Skip to content

fix(ios): assistant files are not downloadable in chat - #155195

Merged
roboclaw-bot merged 5 commits into
mainfrom
openclaw/ios-chat-file-downloads
Sep 22, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
openclaw/ios-chat-file-downloads

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #155189

What Problem This Solves

Fixes: assistant-generated documents appear as inert attachments instead of downloadable files in native iOS chat, even when the same conversation works on the web.

User Impact

Users can tap Download file, then use the system share sheet to Save to Files or send the file to another app. The shared macOS native chat uses its save panel. Existing image, audio, and video presentation remains separate.

Validation: real native red/green and inspected screenshots are complete, including original-chat delivery. Exact-head CI and native landing checks passed. Squash-merged to main as 65821c2c48692648d3006cc08293c2918318b7eb on 2026-09-22 at 10:01 UTC; issue #155189 closed. No release or deployment was performed.

Why This Change Was Made

The Gateway already supplies managed documents in a nested attachment envelope. Native decoding discarded that envelope's file metadata, and the renderer only offered actions for image/audio/video attachments.

Decode the existing envelope and extend the existing scoped artifact download owner for files. Preserve ticket renewal, Gateway-route checks, custom ingress headers, TLS pinning, and bounded transfers (the existing Gateway document limit is 100 MiB). Never open assistant-supplied local paths or arbitrary URLs. Reuse one system file-sharing view for attachments, transcripts, and workspace files; uniquely owned temporary copies are removed when export releases them. Added production code owns the previously missing download control and export lifecycle, not a competing network or authorization implementation. No protocol, schema, or credential changes.

Evidence

  • Actual native proof: inspected before/after, system share, and expiry captures. All four images are embedded in that comment and their rendering on GitHub was verified. The originating conversation also received the representative Before/After images; delivery receipts were sent and settled.
  • On run 35673180468, the iOS job passed. The actual baseline decoder failed specifically on lost filename metadata, and its real UI failed on the missing download action after history loaded. The candidate passed 29 focused native tests and the actual download/share/relaunch/expiry UI flow. The loopback Gateway alone is synthetic; no hand-built before card or injected production UI state was used.
  • Proof provenance: head 823c597170fff80b93dae568f2af7dbddd4cac9d, tested merge tree e25fc1f4c686c3d8ce25fdc0b80cf78603048f82, baseline 46375679b7cc9ef787f50fe21af345db0f665ca4, iPhone 18 Pro / iOS 27.0. Raw lifecycle artifact 10673697996 retains logs, all four xcresult summaries/bundles, exported images, and fixture digest.
  • Measured candidate test runtime: decode/cache 0.010 s, loader/typography Swift tests 4.197 s, real UI flow 95.757 s. Complete historical baseline/candidate proof took 54m03s including builds/startup/failure diagnostics. Accordingly, the long UI flow remains registered in full-manual native validation; fast decoder/loader/typography regressions join the existing mandatory PR smoke invocation. No existing voice, lifecycle, Watch, logging, or artifact checks were removed.
  • The old overall run failed separately: fixture import ordering and the artifact-contract expectation were reproduced and fixed, then verified locally. Android callback override compiler errors originated in its main-branch merge input (fix(android): keep gateway discovery current after service changes #155038); two unchanged Control UI E2E cases also failed, with their root causes not established by this task. No unrelated Android/UI source was modified.
  • The exact seven-suite smoke execution assertion was also repaired, preserving all original suites, one invocation, and normal Debug signing. Focused follow-up validation passed 16 selected tests across the three native workflow-contract files (3.16 s wrapper wall); unrelated cases were excluded. The broader guard-file attempt hit a 180 s local tool timeout and is not counted as a full-suite pass.
  • Local follow-up checks passed: focused artifact-contract tests (3 tests, 1.42 s wrapper wall), scoped fixture lint/wire check, formatting/whitespace, workflow actionlint/zizmor and repository guards, plus fresh P0–P2 autoreview after each substantive correction.
  • Current head: aa6d4bf32014e3d3b64ee543593674fa0526ea0d; CI 35680541911 passed. Follow-up commits change only CI/test wiring and fixture import placement; production Swift and captured UI code are unchanged. Current-head CI completed successfully; screenshot inspection, PR rendering, and original-chat delivery are complete.

Review disposition / coverage limit: macOS compilation and package/shared temporary-file byte-lifecycle tests passed, but interactive NSSavePanel and bytes written to a user-selected destination were not exercised. The scoped iOS defect has actual native red/green proof and independent source review with no correctness or security findings. We are retaining this explicit gap rather than expanding this repair into a separate macOS UI-proof harness; no macOS interactive proof is claimed. The fixture scripts produce named test artifacts only and introduce no runtime database, schema, or protocol migration.

Worked on by

  • @Takhoffman — reported the issue and requested this fix.

Work sessions


View the OpenClaw team session

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios app: macos App: macos size: M maintainer Maintainer-authored PR labels Sep 21, 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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 21, 2026, 10:56 PM ET / September 22, 2026, 02:56 UTC (Revision 7).

ClawSweeper review

What this changes

The PR makes managed document attachments downloadable in native chat, adds iOS sharing and macOS saving, and covers decoding, downloads, cleanup, and native validation.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This remains a useful, protected fix for a gap still present on main. No introduced correctness defect was found; the iOS evidence resolves the earlier screenshot follow-ups, while macOS export verification remains outstanding.

Priority: P2
Reviewed head: aa6d4bf32014e3d3b64ee543593674fa0526ea0d

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch and convincing iOS proof are useful, but platform coverage remains incomplete for the macOS exporter.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 8 items Introduced change and proof continuity: Reviewed the pinned merge-base-to-head delta. Comparing captured proof head 823c597 with the reviewed head found no changes to production Swift or the captured UI test. The stale test merge was not used to attribute base-branch changes.
Current main still needs the fix: Current main classifies only image, audio, and video attachments; its attachment renderer has no document download branch.
Latest release check: The v2026.9.5 source likewise returns no media kind for documents. The release source was successfully inspected through GitHub after the local historical blob lookup failed.
Findings None None.
Security None None.

How this fits together

Native chat receives attachment metadata from Gateway conversation history and retrieves files through session-scoped artifact downloads. The shared Apple chat interface then hands downloaded documents to the platform’s file exporter.

flowchart TD
  A[Gateway conversation history] --> B[Native attachment decoder]
  B --> C[Document download button]
  C --> D[Session scoped artifact retrieval]
  D --> E[Bounded temporary file]
  E --> F[iOS system share sheet]
  E --> G[macOS save panel]
Loading

Before merge

  • Complete next step (P2) - Complete macOS download/save verification, including matching saved bytes, and link the redacted evidence in the PR body. Remove private paths, endpoints, and credentials; a body update should trigger review, or a maintainer can request @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Tests +23, Docs +1, Config +13, Other +579. Total +616 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 23 0 +23
Docs 1 1 0 +1
Config 1 14 1 +13
Generated 0 0 0 0
Other 19 620 41 +579
Total 23 658 42 +616

Review metrics

Metric Value Why it matters
Production versus validation growth Net production +179 lines; tests/fixtures +227; test support +191 Production growth supplies the missing native export lifecycle while retaining the existing network and authorization owners.
Native validation cost Reported fast native tests: 4.207 seconds; UI flow: 95.757 seconds The expensive UI flow stays outside ordinary PR smoke execution.

Stored data model

Persistent data-model change detected: serialized state: scripts/test-ios-chat-attachments.sh, serialized state: scripts/test-ios-shell-gateway.mjs, unknown-data-model-change: scripts/test-ios-chat-attachments.sh, unknown-data-model-change: scripts/test-ios-shell-gateway.mjs. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #155189
Summary: This PR is the explicit implementation candidate for the open native document-download issue.

Members:

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

Technical review

Best possible solution:

Native chat should export managed documents through the existing scoped download owner, with safe filenames, owned temporary files, and verified platform exporters.

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

Yes: current main drops nested document metadata and lacks a document action, matching the supplied native baseline failure. This review did not execute current main.

Is this the best way to solve the issue?

Yes: extending the existing decoder and scoped artifact loader is a focused repair; the separate macOS exporter still needs its platform result verified.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded native document-access gap with an existing web workaround.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Introduced change and proof continuity: Reviewed the pinned merge-base-to-head delta. Comparing captured proof head 823c597 with the reviewed head found no changes to production Swift or the captured UI test. The stale test merge was not used to attribute base-branch changes. (aa6d4bf32014)
  • Current main still needs the fix: Current main classifies only image, audio, and video attachments; its attachment renderer has no document download branch. (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMessageViews.swift:792, eac221ae78bd)
  • Latest release check: The v2026.9.5 source likewise returns no media kind for documents. The release source was successfully inspected through GitHub after the local historical blob lookup failed. (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatModels.swift:165, ec9c1a13db89)
  • Existing producer and retrieval boundary: The Gateway already emits nested document envelopes. The patch consumes that contract through existing artifact requests, route checks, TLS handling, and bounded downloads; documents are exported rather than rendered. Existing cache fields and encoding remain compatible. (src/gateway/managed-image-attachments.ts:790, aa6d4bf32014)
  • Inspected iOS behavior proof: Inspected all four locally prepared images from the native proof comment: baseline inert attachment, candidate report.csv download control, actual system share sheet with Save to Files, and the expired-file alert. The supplied run records real app decoding, artifact RPC, HTTP loading, sharing, and relaunch against a loopback Gateway. It explicitly does not claim a user-selected destination write. The updated body links the captures and records completed originating-chat delivery. (apps/ios/UITests/OpenClawSnapshotUITests.swift:954, 823c597170ff)
  • Remaining platform proof: The new macOS branch opens NSSavePanel and writes the downloaded bytes to the selected destination. Supplied proof exercises iOS only, so the previous request to verify this separate macOS path and saved bytes remains applicable. (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatFileAttachment.swift:120, aa6d4bf32014)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the previously requested macOS download/save verification and confirm the saved bytes; attach redacted native captures or logs.

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 (6 earlier review cycles)
  • reviewed 2026-09-21T21:16:42.979Z sha d1766a0 :: needs changes before merge. :: none
  • reviewed 2026-09-21T22:21:11.352Z sha d1766a0 :: needs changes before merge. :: none
  • reviewed 2026-09-21T22:33:37.934Z sha d1766a0 :: needs changes before merge. :: none
  • reviewed 2026-09-21T23:27:11.790Z sha 86010be :: blocked before merge. :: none
  • reviewed 2026-09-22T00:54:03.611Z sha 823c597 :: blocked before merge. :: none
  • reviewed 2026-09-22T02:23:14.129Z sha b86a414 :: blocked before merge. :: none

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 21, 2026 22:11
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 21, 2026
Decode managed document envelopes, reuse scoped artifact downloads, and hand files to the native system exporter with owned temporary copies.

Co-authored-by: Takhoffman <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Sep 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 21, 2026
Register baseline-compatible decode and real-app loopback Gateway tests in the existing iOS lifecycle lane. Retain exact-baseline behavioral failures, candidate assertions, simulator screenshots, xcresults, and full logs without changing production renderers or transport owners.

Co-authored-by: Tak Hoffman <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/ios-chat-file-downloads branch from 86010be to 823c597 Compare September 22, 2026 00:44
Keep fixture imports before executable declarations and require the registered attachment proof plus all native evidence paths in the workflow contract test. Both CI failures reproduced locally and now pass without weakening existing assertions.

Co-authored-by: Tak Hoffman <[email protected]>
@roboclaw-bot

roboclaw-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Native document download proof

Inspected real iPhone 18 Pro / iOS 27.0 simulator captures from CI 35673180468, attempt 1. The native iOS job passed. Overall CI failed in separate checks; this is not a landing clearance.

Behavioral red/green: the actual baseline decoder failed on lost report.csv metadata; the baseline app failed on the absent download action after history loaded. The candidate passed 29 focused native tests and the real app download/share/relaunch/expiry UI test. No compile or setup failure is counted as red.

Only the loopback Gateway is synthetic. The app, decoder, transport, HTTP loader, system exporter and alert are real. The composer upgrade warning reflects the minimal fixture's omitted model-selection capability. The system-share check proves the handoff and availability of Save to Files, not a subsequent user-selected destination write.

Before

Before: the real baseline app renders a generic attachment with no download action

After

After: the real candidate app renders report.csv with its download action
System export and expired-file response

System export

Native system share sheet showing report.csv and Save to Files

Expired-file response after relaunch

Native expired-file alert with reconnect and regeneration guidance

Provenance: PR head 823c597170fff80b93dae568f2af7dbddd4cac9d; tested merge tree e25fc1f4c686c3d8ce25fdc0b80cf78603048f82; actual baseline 46375679b7cc9ef787f50fe21af345db0f665ca4. Both use fixture SHA-256 21c7e5c490d20a0f8fd74422eae907f2cc1e669cd4b9caea3ff120f1f46ab7c2. All four PNGs are 1206×2622, inspected and unaltered.

Timing: candidate decode/cache test 0.010 s; 28 loader/typography Swift tests 4.197 s (four document types 0.044 s; denied/missing/expired cases 0.076 s); end-to-end UI case 95.757 s. The complete baseline/candidate proof step, including builds, startup and failure diagnostics, took 54m03s—not an isolated test cost.

Raw logs, four xcresults/summaries, exports, and provenance are retained in artifact 10673697996, ios-lifecycle-tests-e25fc1f4c686c3d8ce25fdc0b80cf78603048f82 (expires 2026-10-06).

roboclaw-bot and others added 2 commits September 22, 2026 02:24
Honor measured native test budgets: keep the 95-second pairing/share UI flow in the existing full-manual tests phase, while adding decoder, loader, and typography regressions to the existing mandatory PR smoke invocation. Preserve all voice/lifecycle/watch checks and retained evidence; contract tests verify both tiers.

Co-authored-by: Tak Hoffman <[email protected]>
Require all seven executed smoke selectors: preserve the original voice cleanup suites and add the approved decoder, document loader, and typography regressions. Keep the single invocation and normal Debug simulator signing assertions.

Co-authored-by: Tak Hoffman <[email protected]>
@roboclaw-bot
roboclaw-bot merged commit 65821c2 into main Sep 22, 2026
175 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/ios-chat-file-downloads branch September 22, 2026 10:01
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '80b9608a25e191a17e1466d750c2f76a38a38507':
  fix(tooling): declare tsx CLI shim exports
  test(gateway): reuse session PR access state fixtures (#155626)
  test(heartbeat): await wake registration before advancing coalescing time
  refactor(status): share plugin health section assembly (#155390)
  fix: CLI and MCP tool completions skip plugin hooks (#155206)
  fix(update): preserve failures and retain running worker code (#153764)
  fix(sqlite): drain idle coordinators at lifecycle teardown
  fix(test): prepare SQLite compile-cache probes before launch
  fix(test): preserve owned compiler caches in Vitest workers
  fix(ios): assistant files are not downloadable in chat (#155195)
  fix(heartbeat): avoid timeouts for busy scheduled polls (#148333)
  test(gateway): hold SSH approval until pending assertions finish
  test(update): cover launcher permission rollback on Linux (#155615)
  fix(edit): avoid duplicate replacements from legacy arguments (#155513)
  feat(browser): support Lightpanda connection-scoped CDP replies (#154342)
  improve(ci): speed up compatible Control UI tests with Bun (#154585)
  test(gateway): prepare remaining approval fixtures before requests (#155589)
  fix(doctor): exclude retained agents from automatic session import
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
* fix(ios): make assistant file attachments downloadable

Decode managed document envelopes, reuse scoped artifact downloads, and hand files to the native system exporter with owned temporary copies.

Co-authored-by: Takhoffman <[email protected]>

* test(ios): prove managed file downloads through native sharing

Register baseline-compatible decode and real-app loopback Gateway tests in the existing iOS lifecycle lane. Retain exact-baseline behavioral failures, candidate assertions, simulator screenshots, xcresults, and full logs without changing production renderers or transport owners.

Co-authored-by: Tak Hoffman <[email protected]>

* test(ios): fix attachment proof CI contracts

Keep fixture imports before executable declarations and require the registered attachment proof plus all native evidence paths in the workflow contract test. Both CI failures reproduced locally and now pass without weakening existing assertions.

Co-authored-by: Tak Hoffman <[email protected]>

* test(ios): keep document UI proof in full validation

Honor measured native test budgets: keep the 95-second pairing/share UI flow in the existing full-manual tests phase, while adding decoder, loader, and typography regressions to the existing mandatory PR smoke invocation. Preserve all voice/lifecycle/watch checks and retained evidence; contract tests verify both tiers.

Co-authored-by: Tak Hoffman <[email protected]>

* test(ios): align executed smoke suite contract

Require all seven executed smoke selectors: preserve the original voice cleanup suites and add the approved decoder, document loader, and typography regressions. Keep the single invocation and normal Debug simulator signing assertions.

Co-authored-by: Tak Hoffman <[email protected]>

---------

Co-authored-by: Takhoffman <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L 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.

[Bug]: iOS chat cannot open or download assistant document attachments that work on the web

1 participant