Repository navigation
fix: recover Markdown attachment file links through Files - #187662
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRelative file links in Markdown attachments offer explicit selection through Files while retaining the conversation and attachment. Example: Open index.md and activate Read dependency report.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current attachment-navigation bug through the existing Files owner; no actionable introduced defect was found, and required CI remains in progress. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI attachment reader renders sanitized Markdown, intercepts authored relative references, and hands presentation back to the Files catalog; the existing selected-row path continues to own file reads. flowchart LR
A[Markdown attachment] --> B[Shared Markdown parser]
B --> C[Relative reference action]
C --> D[Browse files or Cancel]
D --> E[Existing Files catalog]
E --> F[Explicit row selection]
F --> G[Existing session file reader]
Technical reviewBest possible solution: Use attachment-local recovery controls to reach the existing Files catalog, leaving target selection and authorized reads with their current owners. Do we have a high-confidence way to reproduce the issue? The linked report supplies an exact attachment fixture and failing route, and fetched-main source confirms the undecorated relative anchor; this review ran no target code. Is this the best way to solve the issue? The patch fixes the violated navigation invariant at the attachment boundary, reuses the shared decorator and catalog, and preserves the intentionally different source-bound reader contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6c672d42f2de. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +119, Tests +79, Docs +6, Other +2. Total +206 across 17 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 29, 2026, 10:24 AM ET / 14:24 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: Markdown attachment file links now offer Files selection while preserving the conversation and original attachment. |
…87662) Recover relative links in Markdown attachments through explicit Files selection while retaining the conversation and original attachment. Fixes openclaw#187647.
Fixes #187647.
What Problem This Solves
Following a relative file link in a Markdown attachment can leave the current conversation and open a missing-chat page. For example, an attachment containing
[Read dependency report](snapshot-2/dependencies-v2.csv)navigated to/chat/main/snapshot-2/dependencies-v2.csvinstead of opening a file or helping the user find it.User Impact
Relative file links in a chat attachment now offer Browse files. The user chooses an accessible file from the existing Files catalog, while the conversation, original attachment tab and unsent message remain available. Cancel returns to the reference. Keyboard activation moves through the recovery controls into Files, and ordinary search can distinguish files with the same basename.
This is explicit file selection. The attachment does not acquire an inferred source folder or bundle relationship, and the current workspace file is not asserted to contain the bytes that existed when the attachment was sent. Existing source-bound workspace links, external URLs, fragment links and Download retain their behavior. There is no new file grant, storage representation or Gateway API.
Why This Change Was Made
Detached attachment previews have media identity but no authoritative source directory. Leaving their authored relative links as browser hrefs resolves them against the chat URL. The existing Markdown decorator now supports authored document links independently of prose scanning, allowing this reader to present a file action without guessing a target. Its explicit selection mode also accepts query-bearing relative URLs; source-bound readers retain their existing query behavior.
A narrow callback takes the user to the existing Files catalog. The catalog owner retains its previews and owns focus after the transition; its normal selected-row path and current session read authority still govern the eventual read. The attachment renderer holds only a temporary reference cue. Canonical chat documentation explains this distinction.
Evidence
The actual guest attachment-card Open route reproduced the missing-conversation navigation on the baseline. The owner regression failed specifically because the original anchor retained its relative href; the other 33 tests in that file passed. A real source-browser card/reader scenario also reproduced navigation for a relative URL with
?download=1; the corrected tree now keeps the query-free control and query-bearing destinations, including literal and encoded URLs inside query values, in the conversation and offers recovery.The candidate live journey reached the existing Files catalog, explicitly selected the intended CSV, displayed its expected contents, and returned to the retained attachment without changing the conversation URL. Search showed two same-named CSVs separately, and deliberately selecting the other row displayed that row’s different contents. Cancel and an unmatched search issued no file read and retained the unsent message. External, fragment and original-download controls also passed.
Remote changed-file formatting, lint, English-copy verification and affected production/test types passed on the exact committed tree. All 25 related test files passed: 452 unit tests and 126 browser tests, including attachment recovery, catalog focus, source-bound links and existing read-failure/draft-retention controls. The runtime batch took 29.53 seconds. The regression allocation covers 79 net added test lines without changing the shared ceiling.
The committed-head live recording below exercises the recovery controls, catalog focus, explicit selection, expected CSV contents and return to the original attachment. It asserts that the conversation URL and unsent text survive and that only the selected row causes a file read. Query-specific behavior is additionally covered by the actual attachment-card/reader/router scenario.
Visual evidence
Keyboard recovery, explicit file selection and return to the retained attachment
proof.mp4
Visual verification
4a97fec5aac26f3c4741da2255ad9fa8097f72a5