Skip to content

fix(android): keep workspace previews open when sharing fails - #139141

Merged
steipete merged 1 commit into
mainfrom
codex/android-workspace-share-outcome
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/android-workspace-share-outcome

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #127434 — this fixes Android failure handling and unpublished-attempt cleanup only. Successful-share retention policy and iOS remain separate follow-ups; this does not close that issue.

The source branch is in openclaw/openclaw, not a contributor fork.

What Problem This Solves

Fixes an issue where users sharing a previewed workspace file could lose the preview or receive no useful error when Android could not prepare the export or open the share sheet.

Why This Change Was Made

The Workspace Files share action now handles preparation and chooser failures together, removes only the unpublished attempt, and reports “Could not share file.” Previously published copies remain untouched so a failed or later same-name export cannot invalidate earlier URI grants. Successful-share expiry is intentionally unchanged.

User Impact

A failed share leaves the preview available to retry or go back, with a visible error instead of an unexplained outcome. Successful text and image sharing retains its existing behavior.

Evidence

  • Before, installed: from a loaded short-text preview, one Share action with an owned obstruction at the export-cache path was followed by the Android launcher. The negative run remained failed. No fatal stack or process-death evidence was captured, so neither is claimed.
  • After, installed: the same obstruction produced the normal-duration “Could not share file” toast while retaining the preview. Removing the obstruction allowed retry from that preview. Two same-name text exports and a PNG then reached a separately signed, distinct-UID receiver through the real Android share sheet and an isolated real Gateway. The same receiver Activity reread all previously granted URIs on each delivery: histories of one, two, and three files retained their exact bytes and hashes.
  • Regression tests: all 28 focused tests passed across Play and third-party debug flavors, covering the Compose Share action, workspace parsing, and the existing export sibling. Malformed Base64 and chooser exceptions are unit-test coverage, not additional installed scenarios.
  • Both isolated proof lifetimes completed cleanup, including the owned obstruction, native/Gateway processes, and lease stop.

The before APK is qualified against the identical Workspace Files owner preimage for this short-file case—not as whole-APK equivalence or an exact-parent upgrade comparison.

Before: launcher after failed Share After: preview retained with visible error
Launcher after one obstructed workspace Share Workspace preview retained with Could not share file

These are inspected original frames from synthetic-only, isolated API 36 guests.

Production Kotlin is +20/-18 (net +2): one canonical exception/cleanup boundary replaces the duplicate writes and silent Base64 return. The small growth provides the missing user-visible failure outcome. Tests add 459 lines across four real-screen cases; native-source inventory adds one entry and docs add two lines. No new dependency, configuration, permission, schema, migration, retention policy, or public protocol is introduced.

All 15 local changed-file checks passed; Codex P2 review found no actionable findings. The complete current-main Workspace Files owner was byte-identical to the reviewed preimage at 9e75cf16f06b. Exact-head hosted CI33970826355 completed successfully, including both phone-flavor tests, Wear tests, APK builds, Android lint, and the required CI gate.

Review disposition

The exact-head review published at 14:41 UTC reports no introduced correctness or security finding. Its remaining note is reviewer-side DNS preventing source/image downloads. The maintainer directly inspected matching AndroidX Core 1.19.0 FileProvider source and bytecode for cache-root canonicalization, URI generation and file opening, Kotlin write behavior, and the original installed captures. The distinct-UID receiver read all three exports through actual Android grants. Those observations cover the dependency and image checks; no indefinite-grant, fatal-stack, or successful-retention-policy claim is made. The repair remains at the existing Share owner, and #127434 remains separate.

Handle export preparation and chooser failures at the Share action, keep the preview usable, and remove only the failed export attempt. Preserve prior FileProvider grants and report invalid image data instead of silently returning.
@steipete steipete self-assigned this Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 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 app: android App: android size: M maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper status

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper status:

  • Current PR: 139141
  • Branch: codex/android-workspace-share-outcome
  • ClawSweeper PR: no
  • Automerge: not-enabled
  • Automerge job: jobs/openclaw/inbox/automerge-openclaw-openclaw-139141.md
  • Merge state: CLEAN
  • Checks: SUCCESS:98 SKIPPED:26

@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The initial exact-head review generation completed successfully with no findings, but the public review still has only the started/finalizing placeholder. Please complete a fresh review so the normal completed-review gate can be satisfied. Exact-head CI is green; the source and evidence are unchanged.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 10:40 AM ET / 14:40 UTC.

ClawSweeper review

What this changes

The Android workspace browser reports sharing failures, removes the failed export attempt, and preserves the preview, with regression tests and updated documentation.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this remains a useful, focused fix absent from current main and v2026.9.1. No introduced correctness defect was found; successful-share retention remains separate work.

Priority: P2
Reviewed head: 6565da5c3e6c251dcdc04aaf9132b829bfef2fa9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant installed proof, useful regression coverage, and no actionable patch defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.
Evidence reviewed 11 items Reviewed change and merge ownership: The pinned introduction and verified test-merge comparison contain the same focused sharing repair. The test merge’s raw parents are the pinned base followed by the exact PR head; unrelated endpoint drift was excluded.
Entry point and repair owner: The preview’s Share button calls the local export owner directly. Its new exception boundary covers directory creation, decoding, writing, URI preparation, and chooser launch without changing preview state or deleting earlier exports.
Current-main necessity: The complete workspace screen is unchanged between the pinned merge base and fetched main. Main still leaves writes and chooser launch unguarded and silently returns on invalid Base64.
Findings None None.
Security None None.

How this fits together

The Android workspace browser retrieves files from the Gateway and displays previews. Sharing creates a private export copy and passes a read-only content URI to Android’s share sheet.

flowchart TD
  A[Gateway workspace file] --> B[Android preview]
  B --> C[User taps Share]
  C --> D[Prepare unique export]
  D --> E[Android share sheet]
  D -->|Preparation fails| F[Remove failed attempt]
  E -->|Launch fails| F
  F --> G[Show error and retain preview]
  E -->|Launch succeeds| H[Preserve exported bytes]
Loading

Before merge

  • Resolve merge risk (P1) - Reviewer limitation: GitHub DNS failures prevented independently reopening the supplied screenshots and inspecting upstream AndroidX source; installed outcomes are assessed from the captured PR evidence.
Agent review details

Security

None.

PR surface

Tests +459, Docs +2, Other +3. Total +464 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 459 0 +459
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 2 21 18 +3
Total 4 482 18 +464

Review metrics

Metric Value Why it matters
Production versus test growth Production net +2; tests +459; generated inventory +1; docs +2 Production growth provides the missing failure outcome after merging duplicate writes, while tests exercise the existing screen without adding production test hooks.

Root-cause cluster

Relationship: partial_overlap
Canonical: #127434
Summary: This PR addresses Android failed-attempt cleanup and feedback, only part of the broader native export-lifecycle issue.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep recovery in the existing Share owner; consolidated writes leave only two extra production lines for visible failure feedback and failed-attempt cleanup.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep recovery in the existing Share owner; consolidated writes leave only two extra production lines for visible failure feedback and failed-attempt cleanup.

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

Yes: obstructing the export-cache path while sharing a loaded preview reaches unguarded writes on current main. This review established the source path; installed before/after observations come from the supplied evidence.

Is this the best way to solve the issue?

Yes: the Share action owns both preparation and chooser errors, so one local boundary is appropriate. Reusing the bitmap/clipboard exporter or selecting a new retention lifetime would unnecessarily expand this repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bcecb3d1d19a.

Labels

Label changes:

  • add P2: This repairs a bounded Android file-sharing failure while preserving the preview and prior exports.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.

Label justifications:

  • P2: This repairs a bounded Android file-sharing failure while preserving the preview and prior exports.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. Captured installed API 36 evidence exercises the actual workspace Share action under cache obstruction, reports retained preview and visible error after the fix, then successful retry and preserved text/image grants. Linked frames could not be reopened because of reviewer DNS failure; chooser and malformed-Base64 scenarios have supplemental unit coverage.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • WhatsSkiLL: 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 0f54c86 into main Sep 5, 2026
148 checks passed
@steipete
steipete deleted the codex/android-workspace-share-outcome branch September 5, 2026 14:52
@steipete

steipete commented Sep 5, 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 6, 2026
Handle export preparation and chooser failures at the Share action, keep the preview usable, and remove only the failed export attempt. Preserve prior FileProvider grants and report invalid image data instead of silently returning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android docs Improvements or additions to documentation maintainer Maintainer-authored PR 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.

1 participant