Skip to content

mecatui: aligned, humanized exit summary with aux usage - #2083

Merged
jbeda merged 4 commits into
mainfrom
mecatui-exit-aux-usage
Oct 5, 2026
Merged

jbeda merged 4 commits into
mainfrom
mecatui-exit-aux-usage

Conversation

@jbeda

@jbeda jbeda commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Embedded mecatui exits now print an aligned, humanized session summary, including auxiliary model usage (title generation, compaction, reflection, routing, reviewers, guardrails, judges) now that fix: return and fence auxiliary usage results #1904 records it.
  • Token counts use the footer's existing humanizer (29.7K, 1.2M); cache read/write stay separately labelled components.
  • The aligned Session ID: line replaces the JSON mecatui: final-session-id= record for embedded exits with a displayable ID.
Session ID:    d55e4682fa6e6ef047cb17eba2e86272
Title:         Humanize session usage output on Mecatui exit
Model calls:   2
Tokens (main): 1.6M input, 16.1K output, 1M cache read, 118.6K cache write
Tokens (aux):  150 input, 48 output
Resume:        mecatui --resume 'd55e4682fa6e6ef047cb17eba2e86272'
               mecatui --resume-latest (may select a different chat)

Development stage

  • Plan / Interface — Bounded/Architectural behavioral and exact-interface contract; no implementation
  • Implementation — based on an approved, merged Plan / Interface PR
  • Combined — compact one-task Bounded/Architectural exception
  • Spike / Routine / Cleanup — acceptance-plan spine exempt; Spike evidence does not ship as-is

Contract linkage

  • Work classification: Routine
  • Classification rationale: Client-only presentation change to mecatui's post-teardown exit text; reads an existing snapshot field (token_usage), no protocol, server, persistence, or engine API change.
  • Decision record: None — presentation tweak; no durable design decision.
  • Human waiver of spine: No
  • Acceptance plan: N/A (Routine). Supersedes the exit-text presentation specified in docs/acceptance/mecatui-exit-handoff.md at the directing human's request; the frozen plan is left unedited.
  • Human decisions resolved and recorded: N/A — Routine; output format directed by the operator in-session.
  • Plan / Interface PR: N/A
  • Approved commit baseline: N/A
  • Combined/exemption rationale: Routine client presentation change.

Interface conformance

  • No runtime/public interface change beyond the human-readable stderr text described below.

Issue relationship

Relates to #1904

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process
  • Other (describe):

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint)
  • Fast offline test suite (task test) — covered by task test:race
  • Pre-review race suite (task test:race) — after rebase onto Implement canonical mecatui status surfaces #2075, only the pre-existing flaky TestMCPAuthorizationGRPCRejectsRepeatedInitialControl fails (10/50 race runs on unmodified origin/main too)
  • Offline demo (go run ./cmd/mecademo)
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: compatibility check (task api:check)
  • Intentional engine API change: task api:update + engine/CHANGELOG.md
  • Landed plan: strict acceptance trace (task ac-trace-strict)
  • Final implementation review: /panel-review

Manually verified by building and exiting a real embedded session.

Changes

File Change
cmd/mecatui/client/session.go SessionSnapshot.AuxiliaryUsage: sum of every non-main token_usage bucket
cmd/mecatui/exit_handoff.go Aligned, humanized summary; embedded safe IDs print Session ID: instead of the JSON record
cmd/mecatui/{ui/ => }internal/renderfmt Hoisted so package main can import the shared token humanizer; ui import paths updated
cmd/mecatui/*_test.go, client/session_test.go Exact aligned-output, aux aggregation, and fallback assertions
user-docs/mecatui/sessions.md Document the new summary and connected-mode record

User-facing change

On a normal embedded exit, mecatui prints an aligned summary with session ID, title, model calls, humanized main and auxiliary token usage, and resume commands. The aux line appears only when auxiliary usage is nonzero.

Special notes for reviewers

  • Contract change: embedded exits no longer emit mecatui: final-session-id="…". The original exit-handoff plan kept it byte-for-byte "for scripts"; nothing in this repo consumes it besides mecatui's own tests, but an external script scraping embedded exit output would break. Connected mode and IDs unsafe to display on one line still emit the JSON record.
  • Rebased onto Implement canonical mecatui status surfaces #2075, which removed ui/footer.go; renderfmt moves from cmd/mecatui/ui/internal/ to cmd/mecatui/internal/ so main can share it (pure move plus import-path updates).
  • Aux usage is one aggregate line, not a per-purpose breakdown.
  • Humanized counts are lossy (1,234,567 → 1.2M); exact values remain available from the session snapshot.

jbeda and others added 4 commits October 4, 2026 17:34
The embedded exit summary now prints a humanized Tokens (main) line and,
when nonzero, a Tokens (aux) line summing every non-main usage bucket.

Co-authored-by: Mecatl <noreply@mecatl.dev>
Print the session ID and every summary field under aligned labels, with
the resume-latest alternative indented beneath the exact resume command.

Co-authored-by: Mecatl <noreply@mecatl.dev>
Embedded exits with a displayable ID now print only the aligned summary.
Connected mode and unsafe IDs keep the JSON-quoted final-session-id record.

Co-authored-by: Mecatl <noreply@mecatl.dev>
Move ui/internal/renderfmt to cmd/mecatui/internal/renderfmt so package
main can import the shared token humanizer, and drop the ui wrapper.

Co-authored-by: Mecatl <noreply@mecatl.dev>
@jbeda
jbeda force-pushed the mecatui-exit-aux-usage branch from bbf35a4 to 3164639 Compare October 5, 2026 02:13
@jbeda
jbeda merged commit 8154675 into main Oct 5, 2026
37 checks passed
@jbeda
jbeda deleted the mecatui-exit-aux-usage branch October 5, 2026 02:25
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