Skip to content

fix: link sessions started from a selection back to their source chat - #206509

Merged
jalehman merged 1 commit into
mainfrom
openclaw/link-new-sessions-to-their-source-session-cc6a63
Nov 28, 2026
Merged

jalehman merged 1 commit into
mainfrom
openclaw/link-new-sessions-to-their-source-session-cc6a63

Conversation

@jalehman

Copy link
Copy Markdown
Contributor

What Problem This Solves

When you highlight text in a chat and choose New session, the new session starts with your selection quoted, but nothing says which chat it came from. You can't jump back to the original conversation, and the agent in the new session can't look at it for context.

User Impact

The first message of a session started from a selection now ends the quote with a From <session> line. Chat already turns a bare session key into a link labeled with that session's title, so the line shows the source chat's name, opens it on click, and gives the agent the key it needs for sessions_history. Quoting from several sessions lists each source once.

Nothing changes in the sidebar: the new session stays a top-level session and does not become a sub-session of the source.

Accepted edge case: with session.scope="global", the source key is global, so the line reads From global as plain text with no link. Making that a link would mean passing the agent ID through the chat props for a rare config, so this PR doesn't.

Why This Change Was Made

The selection already carried its source session key; it was dropped when the quote was turned into message text. Putting the key in the message text reuses the existing session-link rendering. It needs no new session field and no protocol change. A durable "came from" field was considered and declined for now.

Evidence

  • ui/src/e2e/chat-selection-to-main.e2e.test.ts › "starts a new session from the launcher with the selected excerpt attached" now expects From agent:main:main in the sessions.create message and passes locally (pnpm test:ui:e2e … -t 'starts a new session'). Without the fix, the message has no From line and this assertion fails.
  • Rendering: a temporary mocked Control UI E2E (not committed) loaded a new session whose first user message was the old text versus the new text, at 1280×900, with fixture sessions named "Prompt length and context usage" (source) and "Duplicate AGENTS.md check" (new). It asserted that the new text renders a .markdown-session-link titled with the source session, and the old text renders none. Both captures use this branch's build, so "before" shows the old message text, not a build from main.
  • oxfmt --check, oxlint, the pre-commit hook, and git diff --check are clean.
  • Review: local ClawSweeper wasn't available, so an independent autoreview pass on the full diff (base be3c73e2, head d5871ffc) ran at P0–P2. It reported one P2, the session.scope="global" case above, which is accepted as an edge case. No other findings.
  • Not run: full typecheck (left to CI), and a live Gateway run.

Clean comparison

Before After
Before: new session's first message shows only the quote and prompt After: a From line links to the source session by its title

Annotated comparison

Before After
Quote with no source session highlighted Source session link highlighted

Mocked Control UI, 1280×900, fixture data; old and new message text rendered by the same build at d5871ffc.

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 27, 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: XS labels Nov 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR adds source-session links after quoted selections when starting a new session.

Example: Select “Review the deployment checklist.” in agent:main:main and start a session with “Summarize the risks.”

  • Before: The initial message contains the quote and prompt without identifying the source conversation.
  • After: The message includes “From agent:main:main”, which the existing renderer displays as a source-session link.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and appears correct, but mocked rendering and request assertions do not satisfy the required real-behavior proof.
Proof confidence 🧂 unranked krab (1/6) 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.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A session started from selected text gives the user no direct path back to the source conversation.
Reason: This maintainer-authored direction supplies a useful navigation affordance through existing infrastructure, with the global-scope limitation explicitly accepted.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR adds useful source attribution that current main still lacks, with a focused implementation and no discrete correctness findings.

Reviewed head: d5871ffcb8903a4557f6cdc3f8ba88eb814fb0cb

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI carries a selected passage and its source key into launcher attachments, then converts them into the initial sessions.create message; existing Markdown session-link handling supplies titles and navigation.

flowchart LR
  A[Transcript selection] --> B[Launcher attachment]
  B --> C[Draft submission formatter]
  C --> D[Sessions create request]
  D --> E[New session transcript]
  E --> F[Existing session link renderer]
Loading

Technical review

Best possible solution:

Keep source attribution in the existing initial-message formatter and reuse the established session-link renderer without adding persisted lineage state.

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

Current-main source confirms that annotations carry a session key which is omitted when the launcher builds the initial quoted message; no product execution was performed during this read-only review.

Is this the best way to solve the issue?

The change is the smallest complete addition for source navigation: it uses existing annotation data, preserves quote ordering and mention offsets, and introduces no competing state or renderer.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Launcher selection message formatting keeps the original intent (9151ac2: The original feature sent selections as ordinary quoted message text, matching composer behavior while preserving mention offsets and avoiding uploaded files.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +10, Tests 0, Docs 0. Total +10 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 15 5 +10
Tests 1 1 1 0
Docs 1 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 18 8 +10

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Supply the real-Gateway creation and source-navigation evidence described in the proof assessment.

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.

Reviewed November 27, 2026, 3:53 AM ET / 08:53 UTC.

@jalehman
jalehman merged commit ec209d0 into main Nov 28, 2026
96 of 98 checks passed
@jalehman
jalehman deleted the openclaw/link-new-sessions-to-their-source-session-cc6a63 branch November 28, 2026 01:37
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* fix: preserve completed Claude tool calls in chat history

* fix: preserve completed Claude tool calls in chat history

OpenClaw-Publication: d3a267f1-3ba5-4fc9-a4dd-3968148f8eb1
(cherry picked from commit a27b4e6)

Follow-ups: 49492d7 fix: align Control UI tooling and docs with task card removal (#207747) [not selected for this narrow backport]; cebbb78 fix: keep tagged silent replies out of chat (#207738) [not selected for this narrow backport]; d4e1305 fix: hide desktop Details when there is nothing to show (#205093) [not selected for this narrow backport]; 11b2cf0 fix: keep the selected Review file compact when the tree is open (#203825) [not selected for this narrow backport]; 4be636b feat(ui): offer Add to Home agent when Home sidebar is open (#207773) [not selected for this narrow backport]; f766de4 fix: surface favorites and recommended models in picker search (#201450) [not selected for this narrow backport]; 61a7661 improve(ui): remove suggested-task cards from Control UI (#199167) [not selected for this narrow backport]; 48cc039 fix: keep long process names compact above mobile output (#203767) [not selected for this narrow backport]; 9316f05 fix: show the first message when session naming fails (#205607) [not selected for this narrow backport]; aa4a68f fix(ui): show chat completions as activity rows (#201891) [not selected for this narrow backport]; ec209d0 fix(ui): link selection sessions to their source session (#206509) [not selected for this narrow backport]; 3f475cc fix(ui): keep pre-final assistant text visible after a completed turn (#140835) [not selected for this narrow backport]; 05ec989 fix: keep chat photo previews sharp within their byte limits (#206461) [not selected for this narrow backport]; b3bdfb5 feat(ui): preview CSV chat attachments as tables (#206148) [not selected for this narrow backport]; 6b3ccab fix: show Waiting and Resumed for Claude CLI subagent handoffs (#206158) [not selected for this narrow backport]; 762aa00 fix: keep dictation recording when switching tabs or applications [not selected for this narrow backport]; d3f9fca fix: keep similar subagent names distinct in compact rows (#203777) [not selected for this narrow backport]; 864efbb improve: keep composer error cards on one line (#204337) [not selected for this narrow backport]; d7ed2dd fix: stop replaying Claude progress updates in active chats (#203970) [not selected for this narrow backport]; 269f884 fix: show Claude CLI document uploads only once in chat (#203866) [not selected for this narrow backport]; 4708bac fix(ui): show Linear artwork in chat tool activity (#204414) [not selected for this narrow backport]

Co-authored-by: RomneyDa <[email protected]>
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 impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS 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