Skip to content

FW6-CHAT: local chat-transcript overlay for claude panes - #98

Merged
cvsloane merged 11 commits into
mainfrom
refactor/frontend-command-center
Jul 22, 2026
Merged

cvsloane merged 11 commits into
mainfrom
refactor/frontend-command-center

Conversation

@cvsloane

@cvsloane cvsloane commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Device finding 6c: claude panes on remote wheel scrolling stayed slow with viewer-side redraw tearing (delivery itself verified working — the physics can't be tuned away). Owner-locked fix: serve claude-code's own on-disk session history locally.

What changed

  • New additive capture_transcript agent command: agentd retains transcript_path from claude hook events per session (with cwd-derived newest-mtime fallback) and serves newest-first entry pages from the JSONL. Containment is symlink-resolved before comparison and bounded to ~/.claude/projects; non-regular files rejected; entries sanitized (toolUseResult dropped, 32KB per-entry string budget, 8MiB scanner cap); torn mid-append tails tolerated.
  • POST /v1/sessions/:id/transcript (operator role, audited). Old agentd → HTTP 200 ok:false so the dashboard degrades gracefully.
  • The mobile history overlay gains a chat mode: claude panes render the formatted transcript (❯ user, plain assistant, dim tool one-liners) with the same native scrolling, bottom anchoring, and unlimited load-older paging codex panes have. no_transcript falls back to the FW6-ALT wheel path.

Review chain

  • Builder gates green attempt 1 (full chain + Go); firewall clean.
  • Adversarial review SHIP-WITH-NOTES with compiled attack probes against the path boundary (symlink-in-dir, prefix-cousin, hostile cwd slugs, non-regular files — all rejected). AI Lead fixes: torn-tail tolerance (chat mode survived live streaming), entry-wide byte budgets, passthrough source field.
  • Full integration gate green attempt 1: 208 CP tests + dashboard suites, 21/21 smoke, 40 journeys, build, Go.

Rollout

agentd binaries must roll on both hosts after deploy (deploy order is safe by construction).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a local chat transcript overlay for supported Claude sessions.
    • View recent conversation entries and load older messages with paginated scrolling.
    • Transcript formatting supports user messages, assistant responses, and summarized tool activity.
  • Improvements
    • Automatically adapts transcript layout to the available screen width.
    • Preserves existing history behavior for other terminal sessions.
    • Falls back to standard app scrolling when transcripts are unavailable.
  • Bug Fixes
    • Improved handling of incomplete or malformed transcript data without disrupting the overlay.

cvsloane and others added 11 commits July 21, 2026 19:26
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AI Lead integration fixes on FW6-CHAT (adversarial review):
- a mid-append torn tail no longer fails the newest page (count excludes
  it; corrupt interior lines become skipped stubs, indices stay aligned)
- toolUseResult dropped entirely (never rendered; carries Bash stdout and
  Edit diffs); all non-metadata strings now consume a 32KB entry budget,
  scanner token cap lowered 64MiB -> 8MiB
- CP transcript source field is a passthrough string, not an enum, so a
  future agentd value cannot 5xx the route

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…417c)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds end-to-end Claude transcript capture: agentd reads and sanitizes JSONL transcripts, the control plane exposes them through an authenticated endpoint, and the dashboard renders paginated transcript entries in a responsive chat overlay with fallback behavior.

Changes

Transcript command and agent capture

Layer / File(s) Summary
Protocol contracts
packages/ac-schema/*, agents/agentd/internal/*, tests/fixtures/protocol/*
Defines capture_transcript, pagination bounds, transcript result shapes, machine-readable errors, and protocol fixtures.
Agent transcript capture
agents/agentd/cmd/agentd/*
Retains session hook paths, safely resolves Claude project files, paginates JSONL entries, handles torn lines, sanitizes content, and cleans metadata during session cleanup.

Control-plane and dashboard flow

Layer / File(s) Summary
Control-plane endpoint
services/control-plane/src/routes/sessions.ts, services/control-plane/tests/*, apps/dashboard/src/lib/api.ts
Adds the authenticated transcript route, dispatches the agent command, audits reads, validates responses, and exposes the dashboard API client.
Chat overlay rendering
apps/dashboard/src/components/terminal/*, apps/dashboard/src/components/TerminalView.tsx, apps/dashboard/src/hooks/*
Adds chat scroll mode, transcript formatting, responsive paging, dimmed tool lines, and history fallback behavior.
Journey coverage and handoff
tests/journeys/*, tasks/*
Adds mocked transcript responses and mobile journey coverage for loading, pagination, and transcript-error fallback, alongside feature handoff records.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TerminalOverlay
  participant ControlPlane
  participant Agentd
  participant ClaudeTranscript
  TerminalOverlay->>ControlPlane: POST session transcript request
  ControlPlane->>Agentd: dispatch capture_transcript
  Agentd->>ClaudeTranscript: resolve and read JSONL page
  ClaudeTranscript-->>Agentd: sanitized entries
  Agentd-->>ControlPlane: paginated result
  ControlPlane-->>TerminalOverlay: transcript response
  TerminalOverlay->>TerminalOverlay: format and render chat lines
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: a local chat-transcript overlay for Claude panes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/frontend-command-center

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx (1)

120-174: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Silent fallback on chat-fetch failure loses diagnostic signal.

The catch block folds the expected no_transcript case and unexpected failures (network errors, 5xx, auth issues) into the same silent onClose() fallback with no logging. This is consistent with the documented fallback design, but real failures become indistinguishable from "no transcript available," making regressions hard to diagnose in production.

🔍 Proposed fix to add diagnostic logging
         } catch {
           if (generationRef.current !== generation) return;
+          if (process.env.NODE_ENV !== 'production') {
+            console.warn('Chat transcript fetch failed; falling back to app-scroll.');
+          }
           onScrollModeResolved('app-scroll');
           onClose();
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx` around
lines 120 - 174, Update the inner catch around fetchChatPage in loadInitial to
log unexpected chat-fetch failures before applying the existing fallback.
Preserve the silent onClose behavior for the expected no_transcript case, while
emitting diagnostic details for network, server, authentication, and other
unexpected errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx`:
- Around line 120-174: Update the inner catch around fetchChatPage in
loadInitial to log unexpected chat-fetch failures before applying the existing
fallback. Preserve the silent onClose behavior for the expected no_transcript
case, while emitting diagnostic details for network, server, authentication, and
other unexpected errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e62977c-ed4c-487d-b271-37de442fb7b6

📥 Commits

Reviewing files that changed from the base of the PR and between ea86b3e and 3688cb7.

📒 Files selected for processing (27)
  • agents/agentd/cmd/agentd/main.go
  • agents/agentd/cmd/agentd/main_transcript_test.go
  • agents/agentd/cmd/agentd/transcript.go
  • agents/agentd/internal/commands/executor.go
  • agents/agentd/internal/protocol/command.go
  • agents/agentd/internal/ws/protocol_fixtures_test.go
  • apps/dashboard/src/components/TerminalView.tsx
  • apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx
  • apps/dashboard/src/components/terminal/terminalScrollMode.ts
  • apps/dashboard/src/components/terminal/transcriptFormatter.test.ts
  • apps/dashboard/src/components/terminal/transcriptFormatter.ts
  • apps/dashboard/src/hooks/useTerminalTouchScroll.test.ts
  • apps/dashboard/src/lib/api.ts
  • packages/ac-schema/src/command.ts
  • packages/ac-schema/src/enums.ts
  • packages/ac-schema/tests/core-workflows.test.ts
  • packages/ac-schema/tests/protocol-fixtures.test.ts
  • services/control-plane/src/routes/sessions.ts
  • services/control-plane/tests/transcriptRoute.test.ts
  • services/control-plane/tests/transcriptSchema.test.ts
  • tasks/2026-07-21-fw6-chat-brief.md
  • tasks/frontend-ux-handoffs/fw6-chat.md
  • tasks/frontend-ux-log.md
  • tests/fixtures/protocol/commands-dispatch-capture-transcript.json
  • tests/fixtures/protocol/commands-result-capture-transcript.json
  • tests/journeys/controlPlaneMock.ts
  • tests/journeys/fw6-focus.journey.spec.ts

@cvsloane
cvsloane merged commit 7b30df0 into main Jul 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant