Skip to content

mecatui: /agent command and picker for session-scoped agent definitions - #2055

Draft
kantord wants to merge 4 commits into
impl/session-scoped-agent-identityfrom
impl/session-scoped-agent-identity-mecatui
Draft

kantord wants to merge 4 commits into
impl/session-scoped-agent-identityfrom
impl/session-scoped-agent-identity-mecatui

Conversation

@kantord

@kantord kantord commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary and stack

Adds the TUI entrypoint for the agent-bound session API in #2003: /agent <name> creates a named-definition session; bare /agent opens a filterable picker. /agents remains the definition-details view.

Stack: main → #2003, backend → this PR. The current diff against the backend is only cmd/mecatui/: 15 files, +653/−4. The backend fixes and test cleanup were placed in #2003, then merged into this branch without rewriting published history. There were no additional TUI code changes in that backend repair pass.

Design provenance and review scope

The underlying root-session semantics come from the design-only #1783, including the human approval, and the reviewed/merged Plan / Interface #1815. The ADR was renumbered to 0353 in #1812. Permanent references: ADR snapshot and merged acceptance criteria/resolved decisions. #2105 removed that process scaffolding from main.

Those checkpoints accepted the backend design, not this implementation or every command/picker UX choice. This PR still needs its own client/UX review. Main has continued to move; the current implementation and integration checks, not the retired task list, are the evidence for review.

Behavior

  • /agent <name> sends agent_definition_name through the existing client/session interface.
  • Bare /agent, including from the slash palette, lists definitions, filters by text, and creates the selected definition on Enter. Submitting the command closes the slash palette.
  • The request carries the operator's active provider/model selection. Under the agreed backend precedence, an explicit request pair wins over the definition's pair. Thus the command can override a definition's model pin; changing that UI choice is a separate decision, not an unspecified server rule.
  • An unknown name produces a nonfatal status message rather than a terminal connection screen. The operator can enter another command.
  • The picker supports keyboard selection and wheel scrolling; mouse-click row selection is not implemented.

Verification — October 15, 2026

Automated checks

The integrated backend-plus-TUI tree passed local task lint, the full task --concurrency 1 test and task --concurrency 1 test:race suites, and the offline demo's tool → permission ask → approval → result flow. The full suites include cmd/mecatui and its subpackages. Docs, generated-contract/API checks, SDK typecheck/discovery tests, and the site build also passed during the implementation pass.

The full suites were serialized, with a short temporary root and an isolated loopback namespace to avoid host fixture conflicts; setup capabilities were dropped before testing. No tests were disabled. After the stack was rearranged, head c704ae874 was verified tree-identical to the tested working tree. These results do not certify an untested future integration with newer main, and do not replace CI.

Client/UI coverage is in agent request tests and command/picker tests. The detailed backend alias, authority, persistence, ownership, and transport regression evidence is in #2003, rather than duplicated here.

Separate manual smoke report

The operator supplied an additional agent-assisted manual report using locally built mecated and mecatui, the offline mock provider, loopback with authentication disabled, and temporary HOME/XDG/workspace directories. No operator credentials or paid providers were used. This working-tree run was not pinned to an immutable final commit.

Reported TUI observations:

  • The picker listed the configured definitions and filtered them by text.
  • Choosing reviewer created a bound session with server-enforced plan mode.
  • /agent nope produced a recoverable status message.

The same manual pass drove HTTP/SSE and gRPC creation, exact binding echoes, mode/limit clamps, runtime turn limits, restricted tool calls, aliases, rejection paths, fork/clear, and a persistent-server restart. #2003 records those observations and their limitations. In particular, the mock smoke does not prove real-model behavior, authenticated deployed ownership isolation, or mixed-version client safety.

API compatibility and remaining client review items

No new wire fields are introduced by this TUI-only diff; it consumes #2003's additive API-major-1 contract. That backend now advertises session_agent_definitions; the previous description saying no feature identifier existed is obsolete.

This PR is still a draft. The following client gaps are not fixed by the backend changes or by a passing happy-path smoke:

  1. Mixed-version safety: CreateSessionWithAgent currently sends the field without requiring session_agent_definitions, and the shared create helper does not validate resolved_agent_definition_name. An older server can ignore the field and create an ordinary session. Require support and validate the echo before treating the session as bound. See client request and response handling.
  2. Failed handoff: the command resets the local session state and closes the old session before the replacement create succeeds. A nonfatal error message does not mean the previous session/view was preserved. Review and test failure-safe handoff. See handoff implementation.
  3. Effective state and error presentation: the ready message carries the requested mode, while the server may clamp it; all InvalidArgument create errors are labeled as an unknown definition, including unavailable-provider errors. Verify/refetch the enforced mode and preserve the actual error cause. The manual server-side plan-mode observation does not independently establish correct UI mode display.

These are implementation review items, not reasons to reopen the already accepted root-session design. Review/merge #2003 first, keep this PR based on its updated head, and finish these client checks before declaring the TUI ready.

What the local checks do not establish

No manual live-provider run, authenticated multi-owner deployment, Unix-socket-only test of the inner client-MCP guard, live TypeScript SDK journey, or deployed mecak8s/Redis/remote-driver/TLS/mTLS/microVM/execution-template qualification was performed in the reported smoke pass. Those require appropriate fixtures or environments and can be performed before merge; they are not inherently post-merge-only checks.

Main integration update: #2003 now includes main at ce0f816e0 through c4b5b1fe0. Its sole textual conflict was resolved by retaining both independent changelog entries, and full local lint/docs/offline/race/demo checks passed on the merged backend. This PR incorporates that backend in 62cdfcb8c; the TUI package race suite and scoped lint passed again, and the diff remains 15 TUI-only files. Both PRs are conflict-free at this update. The manual smoke observations above were not rerun during conflict resolution. Latest CI and the outstanding client items above remain required; merging main did not fix those client issues.

@kantord
kantord force-pushed the impl/session-scoped-agent-identity branch from 595be9f to e114ac1 Compare October 8, 2026 11:41
@kantord
kantord force-pushed the impl/session-scoped-agent-identity-mecatui branch from cda6eee to 4b1871c Compare October 8, 2026 11:41
@kantord
kantord marked this pull request as draft October 13, 2026 11:05
@kantord
kantord force-pushed the impl/session-scoped-agent-identity branch 2 times, most recently from c23734a to 6065a11 Compare October 13, 2026 11:13
kantord and others added 2 commits October 13, 2026 13:13
… definition

Gives a developer an end-to-end way to exercise ADR 0353 from the TUI. An
unknown name fails loudly and recoverably. The create carries the operator's
active model selection like every other create path; sending none made a def
without its own model fall to the server default.

Bare /agent only points at /agents; a filterable picker is not built yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ions

Bare /agent (typed or from the palette) now opens a modal picker listing the
server's definitions by name; Enter starts a session bound to the highlighted
one, using the same create path as /agent <name>. Submitting /agent also
closes the slash-command palette, which previously stayed open.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kantord
kantord force-pushed the impl/session-scoped-agent-identity-mecatui branch from 4b1871c to 61b1fba Compare October 13, 2026 11:16
Keep PR #2055 based on the updated backend from PR #2003 without rewriting published history. No additional TUI changes.

Co-authored-by: Mecatl <noreply@mecatl.dev>
Bring in the backend's main integration while keeping PR #2055's diff limited to its original 15 TUI files. TUI race tests and scoped lint pass.

Co-authored-by: Mecatl <noreply@mecatl.dev>

This branch was successfully deployed

1 active deployment
Preview — 62cdfcb8 Deployed Oct 15, 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.

1 participant