stacklok / stacklok/mecatl

mecatui: allow selecting and copying text from read-only session transcripts

Open
#1,620 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
152
Forks
16
Avg merge
14h 48m
Merged PRs (30d)
536

Description

Problem

Read-only session inspection prevents users from copying conversation content into another chat or application. Read-only should prohibit changing the session, not extracting its text.

Reported while using /sessions in the ToolHive workspace: one session showed a running triangle instead of a completed checkmark and could only be inspected, not continued. The user then could not select/copy its content to paste elsewhere. This removes a practical escape hatch when session continuation is unavailable.

The session's actual runtime ownership and reason for remaining running have not been verified. Recovery is a separate concern; copying an inspectable transcript should work regardless of whether that session can be continued.

Reproduction

  1. Open /sessions in mecatui with the default mouse-enabled UI.
  2. Select a session whose capabilities permit inspection but not public-chat continuation (for example, a session reported as running elsewhere).
  3. Open its read-only transcript.
  4. Attempt to select and copy conversation text for pasting into another chat or application.

Actual: the transcript can be scrolled, but there is no in-app transcript text selection/copy action. The session list's y: copy ID copies only the session ID.

Expected: an inspectable transcript remains easy to select and copy, even when continuation is disabled.

Source findings

  • Read-only inspection is opened in cmd/mecatui/ui/sessions_surface.go:569-580; its transcript viewport and keyboard handling are at lines 401-443.
  • Main-conversation selection rejects open modals in cmd/mecatui/ui/selection.go:105-131; the sessions inspector is a modal, and mouse handling consumes modal clicks before conversation selection (cmd/mecatui/ui/update.go:3937-3991).
  • Existing main-chat selection uses OSC52 plus a clipboard fallback (cmd/mecatui/ui/update.go:4301-4310), but this is not wired into the inspector.
  • y: copy ID is a separate action (cmd/mecatui/ui/sessions_surface.go:500-515).
  • Paste is blocked while a modal is open (cmd/mecatui/ui/update.go:2621-2633). Pasting into a read-only transcript is not required; the desired workflow is copying out and pasting elsewhere.

Line references describe the source inspected when filing and may move.

Acceptance criteria

  • Users can select and copy text from read-only /sessions transcripts without reopening them as writable chats or restarting with different terminal flags.
  • A discoverable keyboard-accessible copy action is available; help text distinguishes transcript copying from session-ID copying.
  • Copied content is usable plain text, preserves relevant line breaks, and excludes UI decorations and ANSI control sequences.
  • Existing clipboard mechanisms are reused where suitable, with honest success/failure feedback rather than silent loss.
  • Copying never starts, resumes, cancels, or otherwise mutates the inspected session, and does not weaken transcript authorization.
  • Scrolling and closing the inspector continue to work, including for long transcripts.
  • Offline regression tests cover the read-only inspector path, not only main-chat selection.

Workaround / scope

Source documents --no-mouse or inline/no-alternate-screen operation as allowing terminal-native selection. Requiring a restart or terminal-mode change is not an adequate normal workflow, and terminal behavior may vary.

Keep this issue focused on copying from read-only inspection. Fixing stale/running session recovery, adding editable inspection, and broader transcript export formats are separate work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the read-only inspector in cmd/mecatui/ui/sessions_surface.go, especially the transcript viewport and keyboard handling, then trace modal selection and mouse handling in selection.go and update.go. Compare the existing OSC52 and clipboard fallback path, add a discoverable transcript-copy flow with plain-text feedback, and cover the read-only inspector with offline regression tests while preserving scrolling, closing, and session immutability.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.