Skip to content

feat(studio): add session inspection panels and minimap - #1942

Merged
kantord merged 2 commits into
mainfrom
impl/studio-session-inspection-panels
Oct 8, 2026
Merged

kantord merged 2 commits into
mainfrom
impl/studio-session-inspection-panels

Conversation

@samuv

@samuv samuv commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Tracking: #1850

Stage and baseline

Implementation, stacked on Plan / Interface PR #1939. The implementation starts from proposed plan commit 5068018c2c8d585cb5ade93253bb1abd42eceddc and targets plan/studio-session-inspection-panels. #1939 is open, so no merged approved baseline exists yet. The directing human explicitly requested this early stacked PR. Merge #1939 before this PR.

Current implementation candidate: c41ce33c2c13022457157716a278389c855cc4e1. The plan remains proposed in this stack.

Included

  • Authenticated, no-store BFF reads project the connection's resolved soul and eligible worktrees for an owned source session through the published SDK. Fork and Clear pass the daemon's opaque source-scoped selector only for an explicitly chosen successor; the active session keeps its placement. Picker dismissal and source-session changes evict selectors from the browser query cache.
  • Session inventory and detail include kind and capability reasons. Inspect-only sessions appear in their own read-only group with details and available transcript, no composer or run controls. Temporarily blocked main chats retain their transcript while unavailable mutations remain disabled.
  • The minimap navigates the transcript scrollport. Reply threads remain forked sessions with occurrence-specific local associations; Fork copies the current full source history and the selected message is the UI anchor.
  • One responsive, resizable frame hosts file and tool previews, a browser-local Markdown canvas, forked reply threads, merged delegated-activity content, and merged authorization review content. Selection and an ordinary pending ask take precedence over closing that panel with Escape; activity focus returns to its live opener.
  • The owning Studio user guide describes the new behavior in this PR.

Interface conformance and dependencies

Interfaces match the proposed #1939 contract: Yes. There is no approved contract yet. The branch adds no gRPC/protobuf, exported Go API, tool schema, CLI/config, daemon event, server persistence, trust, or placement decision. Credentials and physical placement paths stay out of BFF-generated public fields and error details.

The directing human explicitly authorized a direct amendment to the older, landed docs/acceptance/studio-chat.md AC1.1 in #1942 on 2026-09-27. That amendment includes inspect-only inventory rows for #1850's separate read-only group, retains the cursor-loop complete: false rule, and points to the existing includes inspect-only sessions and reports an incomplete inventory on a cursor loop proof. It changes no other acceptance criterion or interface. The authorization and direct-route override are recorded in the run record.

#1885 and its implementation #1907 have merged. Their SessionActivityContent is hosted in the shared frame, while the activity-local Escape handler has been removed in favor of the workspace priority. AC4.3's activity seam has been reconciled with mounted and browser proofs. AC4.2 remains provisional: the approved #1848 plan owns layered Escape and approval behavior; merged #1909 supplied authorization review and exact control prerequisites but explicitly left guarded draft clear and other browser interactions for later #1848 work. Final acceptance requires that browser integration and #1939's approval before this PR merges.

Verification

  • Focused BFF inspection tests passed, including anonymous denial, owned-session 404 behavior, no-store responses, and per-request credential context.
  • Focused mounted web tests passed (86/86 before the final test-only commit, then 65/65 across the updated workspace, minimap, and inspection files). The added proofs cover activity Escape with a pending ask, activity-only minimap navigation, and a diagnostic chat kept separate from its inspect-only target even when its public-chat capability is disabled. A CI repair then passed 25/25 focused mounted inspection/activity tests and 6/6 shell/banner tests. task studio:typecheck, scoped Biome, and task studio:generated-check passed.
  • Offline Chromium desktop and mobile journeys passed (6/6 on the rebased candidate and 2/2 after the activity fixture update) for early long-transcript minimap scrolling, mobile keyboard/composer geometry, shared panel layout, and delegated-activity focus. CI repairs then passed 8/8 representative browser journeys; the remaining affected mobile sign-in journey passed on targeted rerun, and both delivery/title journeys passed 4/4 after its fixture was classified as a chat. Inspect-only direct-link browser proofs, task site:build, and user docs checks passed on the prior candidate; the rebased plan passed CGO_ENABLED=0 task docs. Committed diff checks passed.
  • The direct amendment passed the acceptance-plan checker, its regression fixture suite, the focused replacement BFF test, CGO_ENABLED=0 task docs, and git diff --check. Integrated AC1.1 behavior and the amended proof were revalidated.
  • The full repository test, lint, race, demo, and Studio suites were intentionally not run locally at the directing user's request; CI is the final check. Panel review found a selector-cache issue that was repaired and revalidated, plus advisory unused legacy thread-map code. Guarded draft clear remains an AC4.2 ship blocker owned by pending Studio chat: inline approvals, plan review, and Escape behavior #1848 browser work. Final product acceptance requires that interaction work.
  • On the current head, CI passed Studio, doc validation including strict AC trace, lint, race, user docs, performance, Linux KVM, and platform compile/static coverage. The earlier AC1.1 documentation failure is resolved.

Human review and merge remain separate steps.

@samuv
samuv added this pull request to stack #1943 September 25, 2026 16:18
@samuv
samuv marked this pull request as ready for review September 25, 2026 16:20
@samuv
samuv force-pushed the plan/studio-session-inspection-panels branch from 9c0824c to fd79128 Compare September 25, 2026 16:23
@samuv samuv self-assigned this Sep 25, 2026
@samuv
samuv force-pushed the impl/studio-session-inspection-panels branch 2 times, most recently from 5d598cf to 9789340 Compare September 25, 2026 17:21
samuv added a commit that referenced this pull request Sep 27, 2026
Update the landed Studio chat AC1.1 under the directing human’s explicit #1942 authorization. The inventory keeps inspect-only rows for the separate read-only group while preserving cursor-loop incompleteness, and the proof points to the existing test.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
samuv added a commit that referenced this pull request Sep 29, 2026
Update the landed Studio chat AC1.1 under the directing human’s explicit #1942 authorization. The inventory keeps inspect-only rows for the separate read-only group while preserving cursor-loop incompleteness, and the proof points to the existing test.

Co-Authored-By: OpenAI Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the impl/studio-session-inspection-panels branch from c41ce33 to ad35306 Compare September 29, 2026 07:34
@kantord kantord assigned kantord and unassigned samuv Oct 7, 2026
@kantord
kantord force-pushed the impl/studio-session-inspection-panels branch from ad35306 to afad0c2 Compare October 7, 2026 15:20
@kantord
kantord removed this pull request from stack #1943 October 7, 2026 15:28
@kantord
kantord changed the base branch from plan/studio-session-inspection-panels to main October 7, 2026 15:28

@peppescg peppescg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed afad0c2e6 statically across the BFF/contracts, web chat core, tests/e2e, and user docs. The code looks solid, with no code-level blockers. The one blocker is process.

Blocker

CI has never run on the current head. gh pr checks 1942 shows only Vercel. The last CI/perf/Deslop runs are on ad353061a from Sep 29, so the "CI passed Studio, lint, race…" line in the description refers to an older commit. This head is today's rebase onto main, which includes #2143 and touches the same side-thread-panel.tsx / chat-workspace.tsx. It needs a green CI run before merge. An empty push or a close/reopen should trigger it. The branch merges cleanly with main and is 1 commit behind (proto comments only).

Verified OK

  • #2143 survived the rebase. VerdictLedger, the viewedSessionId late-verdict guards, the controlPending reset, messageOwnsApproval/unmatchedApprovals, and the verdict error prefix are all intact. side-thread-panel.tsx only moves its frame into SidePanelShell.
  • BFF inspection routes. They run per request under runWithCredential. Anonymous requests get 401, and foreign or unknown sessions get 404. no-store applies to 200s and to early 401/503s. PlacementMetadata exposes no paths or selectors, error details are fixed strings, and ?root= is rejected. The tests assert all of this.
  • Inspect-only sessions are read-only. They have no composer, run, or verdict controls. Transcript and queue queries are gated on proven chats. Folder, rename, and delete are hidden for them, and they are excluded from keyboard navigation and from the latest-chat pick.
  • Escape priority. Selection and a pending ask take precedence over closing the panel through escapeManagedExternally.
  • Selector cache. It is evicted on view change and on unmount, and a rejected selector triggers a relist.
  • Existing tests. None were weakened. The changes are fixture extensions and the "Close preview" → "Close panel" relabel. The Escape coverage moved to delegation-workspace.test.tsx.
  • User docs. The new studio.md sections match the UI labels.

Should-fix

  1. apps/server/src/routes/chat.ts:873 (successorFailure). When a selector is present, generic invalid_argument is mapped to placement_selector_invalid ("relist worktrees"), and generic failed_precondition to placement_selector_stale. Scenario: a Fork with a selector while a live run owns control, or with an invalid model/effort. The user is told to relist worktrees, which is misleading. Suggest mapping only the explicit placement_selector_* codes and letting the rest fall through to the standard handler.
  2. apps/web/e2e/message-minimap.spec.ts:98-105 is likely flaky. scrollToTranscriptRow uses behavior: "smooth". The poll passes as soon as scrollTop < 200, then the test immediately asserts that row 1 sits within 2px of the scrollport top. That can fail mid-animation, for example at scrollTop 150. Suggest polling for scrollTop <= 2, or setting reducedMotion: "reduce" and honouring it.
  3. The PR description is stale.
    • It says the PR is stacked on #1939 and targets the plan branch, but the base is now main.
    • It cites an amendment to docs/acceptance/studio-chat.md, but that directory no longer exists. The branch touches no docs/ path, so this is fine code-wise.
    • It lists the AC4.2 "guarded draft clear" ship blocker owned by #1848. #1848 is closed and draft clear is on main (chat-escape.ts), so that blocker appears resolved.
    • The Verification section describes older commits.

Nits

  • side-panel-shell.tsx:61-69: the focus effect re-runs when the panel switches between file and activity, which causes a brief focus flicker to the outer opener.
  • thread-map.ts:
    • readThreadAssociations writes storage during a read (the v1 migration). It is bounded, but it is a side effect in a read path.
    • Per-parent keys are never pruned for deleted sessions.
    • void readThreadAssociations(...).then(...) has no .catch.
  • threadKeyForMessage/parseThreadMap aren't dead code, only unused outside the module. Dropping their export would be enough.

I'll approve once CI is green on the head, assuming nothing new shows up.

@peppescg

peppescg commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@kantord you need to push an empty commit to trigger the ci, I don't know this happened honestly

kantord and others added 2 commits October 8, 2026 12:54
Adds capability-gated session inspection (soul, worktree-selected fork and
clear), inspect-only session rows, a message minimap with occurrence-scoped
reply threads, and a shared responsive side-panel frame hosting previews,
canvas, threads, activity, and authorization review.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…imap e2e

Generic invalid_argument/failed_precondition on a selected successor no longer
report placement_selector_* problems, and the picker relists only on a
placement_selector_* code. The minimap e2e now waits for the smooth scroll to
settle, thread-association reads handle rejection, and chat-approval fixtures
carry the proven-chat capability.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@kantord
kantord force-pushed the impl/studio-session-inspection-panels branch from afad0c2 to d65cd9c Compare October 8, 2026 10:55
@kantord

kantord commented Oct 8, 2026

Copy link
Copy Markdown
Member

@peppescg thanks, the push did trigger CI. I rebased onto the latest main (the PR had a conflict), so CI is now running on the new head d65cd9c12. The PR is mergeable again.

Changes since your review:

  • successorFailure: generic invalid_argument / failed_precondition are no longer reported as placement_selector_*. They return successor_rejected (400) and successor_unavailable (409) with fixed text. The picker now relists only on a placement_selector_* code. Both have tests.
  • Minimap e2e: it waits for the smooth scroll to settle before asserting, and passes on desktop and mobile.
  • thread-map.ts: added the missing .catch on the association read.
  • chat-approval.spec.ts: its fixtures now carry the proven-chat capability.

Locally, Biome, typecheck, the server and web unit tests (182 and 651), the generated-contract drift check and the full Playwright suite all pass.

I left the focus-flicker and storage-in-read nits as follow-ups. Could you review again and approve if CI is green? 🙏

Fully or partially written by an AI agent.

@kantord
kantord merged commit b041d4a into main Oct 8, 2026
31 checks passed
@kantord
kantord deleted the impl/studio-session-inspection-panels branch October 8, 2026 11:05
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 13, 2026
2 tasks
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.

3 participants