Skip to content

fix: Markdown heading links open files without leaving the chat - #185080

Open
roboclaw-bot wants to merge 4 commits into
mainfrom
openclaw/nimble-langoustine
Open

roboclaw-bot wants to merge 4 commits into
mainfrom
openclaw/nimble-langoustine

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: clicking a Markdown file link with a heading fragment can leave the file reader and navigate to a nonexistent chat instead.

User Impact

Users can follow document-relative links such as multiplayer-agentic-workflows.md#additional-human-agent-development-records and local #section links in Markdown previews without changing sessions. Existing session links, line links, and literal filename hashes remain supported. No configuration changes or migration are required.

Why This Change Was Made

Authored file destinations now keep path, line, and fragment separate, with percent decoding after fragment parsing. The existing reader supplies the document's path and carries heading requests through its retained-file navigation. Heading targets are document-scoped data attributes, not page-global IDs; the Markdown render cache also includes the document path.

Evidence

Current-main recheck — November 4

Prepared locally; source publication blocked. The PR was integrated with main at 3df082cf325b7105fbf6833faed7f96d04f68bc8. Both retained inventory.csv#totals and notes.txt#totals reproduced a blank source reader before the fix. The local repair routes fragment-driven mode changes through the file-presentation owner and uses one Markdown-preview capability decision for navigation, rendering, and mode selection. CSV/plain-text readers remain visible and retain their existing editor DOM; Markdown heading navigation remains supported.

  • Red → green browser proof: both new non-Markdown cases fail before the fix on the refreshed candidate and pass afterward. All 3 production-build browser cases pass: CSV 1.640 s, plain text 1.068 s, existing document/heading/retained-refresh flow 2.174 s. Total invocation 38.55 s, including 26.04 s build time.
  • 274 tests pass across 7 focused suites in 20.03 s (21.11 s wrapper wall time). UI production typecheck, UI-E2E-chat test typecheck, targeted type-aware lint, formatting, and whitespace checks pass. Independent Auto Review reports no actionable P0–P2 findings on the pinned current-main comparison.
  • Main's newer source-scoped document-relative file-read owner is preserved; authored document targets retain fragments instead of falling back to a second read path. No workflow files differ from the pinned main in the prepared candidate.
  • Tested candidate tree: 905c7b9fe8ec9db5826f5fa068cfaaaa21bffd03. Publication request bbab0c80-a84b-447f-af52-8e34def9cb1c was refused because carrying inherited workflow changes requires the requester's full operator write authority. The refusal explicitly says this is not a GitHub token-scope failure. Saved source is intact; remote PR head remains cdcd432a118878944b547fd46398cd0dece95284. A maintainer with full write access must publish the saved candidate. No merge was attempted.

Follow-up assessment: retained-file refresh

The latest source-only timing finding is not reproduced on the reviewed runtime at 83689dd0. A production-build browser scenario held the sixth sessions.files.get response, kept the same Markdown article mounted, then returned changed content with the requested heading placed 80 paragraphs below the old document end. The existing runtime scrolled to the new heading without changing the chat URL or resolving another session. Temporary tracing confirmed that the view-facing panel still held its previous fragment while the response was pending; its first callback for the new fragment saw the refreshed heading already rendered. The proposed early-consumption precondition was not observed.

The regression covering that delayed response and retained DOM is published at cdcd432a. The final Vitest report passes in 1.838 s (12.88 s invocation, including a 9.23 s production build); the UI-E2E-chat typecheck, targeted lint, formatting, and whitespace checks pass. No production code was changed. The independent authoring review could not complete due to a runner failure. This trivial, test-only update was published on explicit maintainer direction; no independent-review success is claimed.

  • Review findings repaired: heading metadata is restricted to file readers with a document path, so the passive-document corpus is unchanged byte for byte; the sanitizer preserves level-five and level-six heading targets; relative resolution retains UNC roots and Windows separators.
  • Exact-head CI typing error repaired: the browser test now checks the unknown RPC payload through runtime matchers rather than accessing an untyped property. The previously failing UI-E2E typecheck leaf passes locally.
  • 277 tests pass across nine focused suites, including the unchanged transcript corpus, file-link rendering, streaming, audio transcripts, hex colors, and workspace preview/reference/loading behavior. The review regressions reproduced six failures before repair, then all 66 tests in the two direct suites passed.
  • Production-build browser regression passes: sibling-document click, same-document keyboard navigation, and level-five/level-six heading clicks all reach their target in the existing reader, preserve the chat URL, and cause no new session resolution. The case takes 1.824 s; invocation wall time is 29.84 s, including a 24.93 s production build.
  • Prior runtime-head validation (83689dd0): UI typecheck, UI-E2E-chat test typecheck, targeted type-aware lint, formatting, and whitespace checks passed. Independent Auto Review reported no P0–P2 findings for that runtime patch. The nine-suite invocation takes 7.60 s (9.36 s wrapper wall time); the two direct suites take 1.79 s (3.47 s wrapper wall time). Hosted CI timing is pending for the new head.
  • Conflict resolved against main at 3249150425a59cf49a9100685abb2b11e397e6ce, preserving upstream's inlined audio-transcript/hex-color handling. At that runtime head, the published source tree matched the locally tested/reviewed tree.
  • Original bug reproduction: on base 518c1140, clicking the guide link navigates from /chat/main to /chat/multiplayer-agentic-workflows.md#…; the reader fix prevents that navigation.
  • Screenshot access verified: both existing public image URLs now return HTTP 200 with PNG bytes matching the inspected chat-delivered images. The earlier upload-access hold is resolved.

UNC and drive-path checks exercise the rendered-link boundary, not a live Windows filesystem. A previous broader browser-suite attempt stopped during bootstrap and is not relabeled passing. During the expanded proof, native scroll rounding placed a heading at 83.609375 px against an 84 px viewport edge; viewport assertions now compare at CSS-pixel precision. One setup attempt also failed with unpainted text before interaction; the browser flow now awaits font readiness. No product timeout or retry policy was relaxed.

Before

Clicking the heading link exits the reader and navigates to a document-shaped chat route.

Before: file reader lost after the heading link navigates away

After

The sibling document opens at its heading in the existing session.

After: target document and requested heading visible in the file reader

Scope and simplification

The fix reuses existing workspace preview, navigation, and Markdown-island owners; no replacement reader or route-level filename workaround. Net change against refreshed main: +154 production TypeScript/TSX lines, +280 test lines, +6 documentation lines. Added code carries document context and fragment intent and gives rendered headings local targets. The fixture recreates the reported guide/target names with synthetic content; no private guide content or logs are published.

Worked on by

Work sessions

Worked on by:
- @jjjhenriksen

Co-authored-by: jjjhenriksen <[email protected]>
OpenClaw-Publication: fb92dd7a-06de-4171-b1b8-ad86a9b90271
@clawsweeper

clawsweeper Bot commented Oct 26, 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: web-ui App: web-ui size: M labels Oct 26, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 26, 2026 22:06
@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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Resolve Markdown document links relative to the open file and scroll heading fragments inside the existing chat reader.

Example: Follow multiplayer-agentic-workflows.md#additional-human-agent-development-records from guides/faculty-guide.md.

  • Before: The browser navigates to a document-shaped chat route and loses the reader.
  • After: The sibling document opens at the requested heading while the conversation remains selected.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The document-navigation repair has useful browser evidence, but the retained non-Markdown viewer regression prevents a correctness pass.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser screenshots show the sibling Markdown heading displayed in the existing reader; the published production-build browser scenario covers click, keyboard, lower-level headings, and delayed retained-file refresh with modeled Gateway responses.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Following a Markdown document’s local file or heading link can leave the reader and open a nonexistent conversation.
Reason: The navigation failure is concrete, the maintainer-authored direction is established, and the implementation reuses the existing file reader.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR addresses a verified navigation defect, but one P2 regression can blank a retained non-Markdown file reader; the earlier retained-Markdown timing finding is withdrawn.

Priority: P2
Reviewed head: cdcd432a118878944b547fd46398cd0dece95284

Before merge

  • Restrict fragment-triggered preview mode to Markdown files (P2) - Open /workspace/inventory.csv normally, keep its reader tab retained, then follow [Totals](/workspace/inventory.csv#totals) with the file unchanged. The new parser accepts this destination and carries its fragment, so this branch switches the retained CSV reader to preview. CSV has no controls.markdown, and SidebarFile hides its text viewer whenever readingMode is preview, leaving a blank reader. The confirming read preserves the existing content object, so it does not reset the mode. Apply this switch only when the file has a Markdown preview and add a retained non-Markdown browser regression. This is a late discovery: comparison with both earlier reviewed heads confirms these lines were already present and unchanged.

Findings

  • [P2] Restrict fragment-triggered preview mode to Markdown files — ui/src/pages/chat/components/chat-detail-panel.tsx:175-176
Agent review details

How this fits together

The Control UI Markdown renderer classifies file destinations, existing workspace navigation reads the selected file, and the retained reader applies document-local heading navigation.

flowchart LR
 A[Markdown document] --> B[File link parser]
 B --> C[Workspace navigation]
 C --> D[Session file service]
 D --> E[Retained file reader]
 E --> F[Document heading target]
Loading

Technical review

Best possible solution:

Keep the existing parser, workspace, and Markdown-island owners, and restrict fragment-triggered preview switching to files that have a Markdown preview.

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

Current-main source and inspected browser evidence establish the original navigation failure; the newly identified non-Markdown failure is source-reproducible, with no target code executed during this review.

Is this the best way to solve the issue?

The patch uses the appropriate existing owners and preserves document-local heading scope, but its preview-mode transition must respect the target file’s rendering capability.

Full review comments:

  • [P2] Restrict fragment-triggered preview mode to Markdown files — ui/src/pages/chat/components/chat-detail-panel.tsx:175-176
    Open /workspace/inventory.csv normally, keep its reader tab retained, then follow [Totals](/workspace/inventory.csv#totals) with the file unchanged. The new parser accepts this destination and carries its fragment, so this branch switches the retained CSV reader to preview. CSV has no controls.markdown, and SidebarFile hides its text viewer whenever readingMode is preview, leaving a blank reader. The confirming read preserves the existing content object, so it does not reset the mode. Apply this switch only when the file has a Markdown preview and add a retained non-Markdown browser regression. This is a late discovery: comparison with both earlier reviewed heads confirms these lines were already present and unchanged.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Authored file destinations and fragment classification changes intended behavior with a stated reason (9a57a35: Authored destinations received a broader filename grammar while URL/session classification and exact filename spelling remained protected.)
  • Retained-file refresh and navigation keeps the original intent (ecfd906: Explicit opens revalidate clean files while preserving drafts, aliases, newer reads, and saves.)
  • File reading-mode transitions changes intended behavior with a stated reason (9e2c766: Reader controls preserve file identity, edits, selection, and presentation lifecycle; line navigation selects source presentation.)
  • Markdown cache identity keeps the original intent (d04bba0: The renderer retains the established sanitized rendering and cache owner after removing the ineffective incremental pipeline.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/components/markdown-file-links.test.ts
  • pnpm --dir ui test src/pages/chat/components/chat-sidebar.test.ts
  • pnpm test:ui:e2e ui/src/e2e/chat-file-document-links.e2e.test.ts
  • Verify the new retained-CSV assertion fails on cdcd432 and passes with the repair.
  • git diff --check

What I checked:

  • Introduced change: Reviewed the pinned merge-base-to-head diff; document context, fragment parsing, heading metadata, navigation, and browser regressions belong to this PR. (cdcd432a1188)
  • Current main still lacks the repair: Fetched main has neither authored-fragment parsing nor the document base path in file-reader rendering. (ui/src/components/markdown-file-links.ts:151, 08e08b720495)
  • Inspected browser evidence: The downloaded before image shows the reader absent; the after image shows the sibling Markdown document and requested heading in the reader. These support the reported document-navigation repair. (83689dd0c5a7)
  • Prior timing concern withdrawn: The new regression defers the retained file response, preserves the same article node, adds a previously absent heading beyond the old document, and checks scrolling. The existing Files panel awaits the admitted read before presenting its resolved content, explaining why the earlier early-consumption premise was not observed. (ui/src/e2e/chat-file-document-links.e2e.test.ts:136, cdcd432a1188)
  • Non-Markdown reader regression: Fragment navigation unconditionally selects preview mode for unchanged retained content. The file view hides its text editor in that mode, while rendering a Markdown replacement only when Markdown controls exist. (ui/src/pages/chat/components/chat-detail-panel.tsx:175, cdcd432a1188)
  • Unchanged reads retain content identity: A successful confirming read preserves the existing content object when bytes, hash, draft identity, path, root, and MIME type match; consequently it does not reset the erroneous reading mode. (ui/src/pages/chat/components/chat-session-workspace-preview.ts:312, cdcd432a1188)

Likely related people:

  • Peter Steinberger: Raw commit 9a57a35 adds ui/src/components/markdown-file-links.ts:6 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9a57a35aaf3e; files: ui/src/components/markdown-file-links.ts)
  • Vyctor H. Brzezowski: Raw commit 9e2c766 adds ui/src/pages/chat/components/chat-detail-panel.tsx:178 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9e2c766d84ab; files: ui/src/pages/chat/components/chat-detail-panel.tsx)

PR surface

Source +154, Tests +280, Docs +6. Total +440 across 16 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 13 174 20 +154
Tests 2 283 3 +280
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 463 23 +440

Review metrics

Metric Value Why it matters
Production versus test growth Production +174/-20; tests +283/-3 Document context and heading navigation explain the production growth; browser coverage exercises retained DOM and delayed refresh rather than adding another reader.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Document navigation is broken but recoverable through Files; the introduced blank-reader case has a focused repair.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-26T22:22:27.884Z sha 3e850ef :: needs changes before merge. :: [P2] [P2] Reconcile heading metadata with the passive-document corpus | [P2] [P2] Preserve level-five and level-six heading targets | [P2] [P2] Preserve UNC roots when resolving document-relative links
  • reviewed 2026-10-26T22:48:38.346Z sha 83689dd :: needs changes before merge. :: [P2] Preserve fragment navigation until refreshed content is rendered

Reviewed October 28, 2026, 5:06 PM ET / 21:06 UTC (Revision 3).

roboclaw-bot and others added 2 commits October 26, 2026 22:31
Co-authored-by: jjjhenriksen <[email protected]>
Worked on by:
- @jjjhenriksen

Co-authored-by: jjjhenriksen <[email protected]>
OpenClaw-Publication: 1e26efc3-56bc-45c8-bb82-c94e2b18a5a0
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 26, 2026
Worked on by:
- @jjjhenriksen

Co-authored-by: jjjhenriksen <[email protected]>
OpenClaw-Publication: 3f6b125d-8bab-4b5e-875c-5029d0437224
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 28, 2026

This branch has not been deployed

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

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant