Skip to content

feat(studio): complete chat approvals, plan review, and Escape flow - #1975

Merged
kantord merged 17 commits into
mainfrom
impl/studio-chat-approvals-review-escape-completion
Oct 7, 2026
Merged

kantord merged 17 commits into
mainfrom
impl/studio-chat-approvals-review-escape-completion

Conversation

@samuv

@samuv samuv commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Note

Update (2026-10-06, while Samu is on leave): I merged origin/main into this branch instead of rebasing, so the original history is preserved. There was one conflict: docs/acceptance/studio-chat-approvals-review-escape.md stays deleted, because #2105 removed acceptance plans, ADRs, and the Plan / Interface process. References below to "Stage", #1888, and ADR 0366 are historical. The merged branch also picks up #2133 (Studio on Node 26, image smoke test, and Grype in the studio CI job). Compared with main, the PR now changes apps/, the studio CI job (Playwright moves after the integration step), and the Studio user docs.

Verified locally before pushing (Node 26 and pnpm 12.4.2 for Studio):

  • Studio gates: lint, typecheck, generated-check, and audit all pass. Tests: server 173, web 593, and integration 8. Playwright with mecated: 46.
  • Image: it builds, the smoke test passes, and Grype finds no fixable critical vulnerabilities.
  • Other checks: task docs, task site:build, the SDK suites, and actionlint with shellcheck all pass.

Closes #1848
Relates to #1776

Stage and approved contract

Stage: Implementation. This completes the Studio approval, plan review, and Escape behavior in the merged Plan / Interface PR #1888, approved at merge commit 98dfad2e1bed66809f68b104c4f207df2d2b1dda. The exact daemon and SDK controls from merged #1909 are already on main. The browser uses the published @stacklok-oss/mecatl-sdk@0.4.0 (staged integrity sha512-Ii03oT378bVhwntthEcteyKgoM8QCYL5XBprpEX/+GjNgBlTxCkU8byG54c7JkAOYeAoRl8dlKpQ4K7tP2VT9w==) with released mecated v0.0.41.

Interfaces match approved contract: Yes. No implementation deviation in this completion slice required another plan or ADR amendment. The earlier directing-human amendments to ADR 0366, protobuf fields, call correlation, and lease-loss handling were incorporated into #1888 and #1909 before their merges.

Behavior

  • Ordinary permission asks appear beside a tool row only when the event's non-empty callId matches a row in the same run. Unmatched child and older-server asks remain separate inline cards. Cards show scrubbed arguments and a bounded Edit/Write diff when parseable; malformed or missing arguments fail closed. Allow once, Always allow, and Deny retain the event's immutable session/run/ask tuple and reconcile uncertain submissions from activity.
  • PresentPlan has an inline plan card in main chat and side threads. It shows the plan, optional note, and raw arguments, with Approve & run, Auto-accept edits, and Iterate. The two approving controls require valid plan text. The BFF uses only the published SDK's exact run-and-ask plan control. After allow, Studio follows durable activity and reattaches transcript and controls to the observed execution run; a matching continuation failure or bounded uncertainty is reported honestly.
  • Escape consumes one layer per press. A focused dialog or menu closes first and restores its trigger. Subsequent presses handle selection, an explicit ask Deny/Iterate, the side panel, a live run, then a guarded unsent draft. The draft clears only on a released second non-repeat press within 500 ms. Main chat and the independent side-thread chat each own their focused controls.
  • Developer steer trace displays only observed IDs, event kind, and outcome metadata. The Studio guide and shortcut reference now describe the browser workflow and hints.

Verification

  • task studio:check passed on the assembled candidate, including web/server tests, lint, typechecks, and generated client check.
  • The named Studio chat: inline approvals, plan review, and Escape behavior #1848 Playwright journey passed on desktop and mobile. It covers ordinary allow/deny, plan approve/iterate, reload and second-tab stale/duplicate handling, overlay-first Escape, ask denial, and guarded draft clear. Its authority proof obtains real Write and PresentPlan asks from a test-owned mecated --mock-script; accepted browser verdicts and consumed-ask 409s traverse the real Hono BFF and published SDK. No live provider or external network is used. CI now runs the browser step after the daemon build.
  • CGO_ENABLED=0 task docs, task site:build, and task ac-trace-strict passed. Strict tracing resolves all 13 Studio chat: inline approvals, plan review, and Escape behavior #1848 ACs. Native local docs/build encountered this macOS host's linker incompatibility; the CGO-free docs/build passed.
  • Keyboard, screen-reader, and light/dark responsive inspection passed at 320, 500, and 1280 px. The checks cover visible focus return, hint eligibility, readable card order, and diff addition/removal labels without color alone; screenshots are retained in the run-local inspection artifacts.
  • Panel review: 0 ship blockers, 1 important nonblocking suggestion, 0 advisories, 0 reviewer failures. Spec, test adequacy, and architecture findings were repaired and revalidated. The remaining suggestion is to centralize repeated plan/ordinary card presentation across chat surfaces; verdict submission remains surface-specific because their session lifecycles differ.

Per the directing human's request, PR CI is the broad validation gate for repository-wide lint, tests, race checks, build, and the full Studio/browser flow. This PR is for review; it has not been merged or deployed.

@samuv samuv self-assigned this Sep 29, 2026
samuv and others added 15 commits September 29, 2026 11:42
Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: Codex <codex@openai.com>
Pin SDK 0.4.0, route plan verdicts through its exact run and ask control,
and follow durable activity before reporting execution or uncertainty.

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: Codex <codex@openai.com>
Capture session, run, and ask IDs from the permission delivery and reject
stale cards before submission. Block duplicate clicks during acknowledgement.

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: Codex <codex@openai.com>
Place ordinary asks by exact same-run call IDs in the main chat and side thread. Render bounded inert diffs with raw arguments, and bind verdicts to the captured run and ask. Keep ambiguous outcomes visible until activity resolves them.

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Exercise allow, deny, plan review, stale two-tab verdicts, and Escape through the offline browser harness. Reuse the published SDK and mock daemon for the stale control boundary, and run the browser gate after CI builds the daemon.

Co-Authored-By: Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Restore the Chat options trigger after menu close and retain its session-scoped Escape ownership across the brief body-focus gap. Pin focus restoration and exact ask denial in the offline browser journey.

Co-Authored-By: OpenAI Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Signed-off-by: Samuele Verzi <samu@stacklok.com>
Transfer the observed execution run and durable replay checkpoint to each chat surface's activity reader. Keep the previous reader aborted and preserve exact run controls while inventory catches up.

Co-Authored-By: Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
Drive actual Write and PresentPlan asks from an isolated mock-script daemon through browser verdicts, the Hono BFF, and published SDK 0.4.0. A second tab must receive an exact duplicate 409 while the ordinary run is still active.

Co-Authored-By: Codex <codex@openai.com>
Signed-off-by: Samuele Verzi <samu@stacklok.com>
Co-Authored-By: Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
@samuv
samuv force-pushed the impl/studio-chat-approvals-review-escape-completion branch from c6d5539 to 2bd9d10 Compare September 29, 2026 08:43
Co-Authored-By: Codex <codex@openai.com>

Signed-off-by: Samuele Verzi <samu@stacklok.com>
…etion

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@kantord kantord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving. A multi-axis review (spec, standards, test adequacy, security, architecture, CI, reuse) found no blockers. The non-blocking findings and nitpicks are tracked in #2142.

Fully or partially written by an AI agent.

@kantord
kantord merged commit bea47ca into main Oct 7, 2026
38 checks passed
@kantord
kantord deleted the impl/studio-chat-approvals-review-escape-completion branch October 7, 2026 08:56
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 7, 2026
2 tasks

This branch was successfully deployed

1 active deployment
Preview — 3e7a9390 Deployed Oct 6, 2026 by vercel[bot]
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.

Studio chat: inline approvals, plan review, and Escape behavior

3 participants