Skip to content

feat: add draft-aware session inventory - #1491

Merged
jhrozek merged 1 commit into
mainfrom
draft-session
Sep 14, 2026
Merged

jhrozek merged 1 commit into
mainfrom
draft-session

Conversation

@jhrozek

@jhrozek jhrozek commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a content-free draft/active/unknown activity projection to session discovery
metadata so mecatui can separate durable, never-prompted main sessions (a "Drafts" tab) from
ordinary Chats, without changing persistence, deletion, or resume authority. --resume-latest
becomes activity-aware when the server advertises the new feature; exact-ID resume stays
activity-agnostic.

Development stage

  • Implementation — based on an approved, merged Plan / Interface PR

Contract linkage

  • Work classification: Architectural
  • Classification rationale: exported engine/port contracts, durable discovery metadata, public
    and driver protobuf fields, and automatic continuation behavior.
  • Decision record: ADR 0334
  • Human waiver of spine: No
  • Acceptance plan: docs/acceptance/draft-aware-session-inventory.md
  • Human decisions resolved and recorded: Yes — operator selected a locally grouped Drafts tab
  • Plan / Interface PR: docs: plan draft-aware session inventory #1459
  • Approved commit baseline: a8168878eb6627e970867e9edf7f22c683a99e84
  • Combined/exemption rationale: N/A

Interface conformance

Matches approved contract. A 7-agent panel review (Spec/Standards/Test-adequacy/Domain) verified
all 11 acceptance criteria and the exact interface contract (field numbers, open-string typing,
capability negotiation, buf breaking clean) against the plan; the review's mechanical findings
(a field-name collision with the pre-existing ActivityReplayStatus plane, and two duplicated
capability-probe/clamp implementations) are fixed in this commit — see Special notes below.

Issue relationship

Closes #1458

Type of change

  • New feature

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (golangci-lint scoped to touched packages — 0 issues; full-repo task lint skipped locally, RAM-heavy)
  • Offline test suite (go test on all touched packages — all green)
  • 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

Changes

File Change
engine/session/title.go Adds ActivityState/ActivityOf, plus ValidActivity (the one fail-closed clamp, replacing 3 duplicated inline checks)
engine/port/store.go Adds SessionDiscoveryMeta.Activity, SessionActivityProjectionPager, plus SupportsActivityProjection (the one capability-probe helper, replacing 3 duplicated call sites)
engine/adapter/memstore, internal/adapter/store/jsonlstore, internal/adapter/redisstore Project/persist the activity scalar atomically with each Save/Create
internal/adapter/grpcdriver Driver wire: SaveRequest.activity_state, SessionMetadataEntry.activity_state, SessionStoreCapabilitiesResponse.activity_projection
internal/adapter/server Public SessionSummary.activity_state; session_activity_inventory feature gate
cmd/mecatui Locally-grouped Chats/Drafts tabs; activity-aware --resume-latest
contracts/proto/**, contracts/gen/**, sdk/typescript/** Additive wire fields (regenerated, not hand-edited)

User-facing change

mecatui gains a "Drafts" tab listing valid main sessions that were created but never received a
genuine first prompt (shown as New — no messages). They stay out of the ordinary Chats list
and are never selected by --resume-latest, but remain fully resumable by exact ID and
deletable exactly as before.

Special notes for reviewers

This PR includes fixes from a /panel-review pass run after the initial implementation landed
locally (fixed-point ada04f583^, before this commit was amended):

  • Renamed client.SessionListItem.Activity → UsageState to resolve a naming collision with
    the pre-existing, unrelated client.SessionTranscript.Activity (ActivityReplayStatus) —
    both types are bundled together in client.ResumeSelection.
  • Deduplicated the SessionActivityProjectionPager capability probe (previously copy-pasted at
    3 call sites, one of which had already drifted into a redundant double type-assertion) into
    port.SupportsActivityProjection.
  • Deduplicated the activity-clamp/fail-closed rule (previously reimplemented identically in 3
    storage adapters) into session.ValidActivity.

No behavioral change from the approved contract — these are internal-only naming and dedup
fixes, confirmed by the Spec, Standards, Test-adequacy, and 5-agent Domain review all returning
zero ship-blockers.

@jhrozek

jhrozek commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Reopening to retrigger CI — no workflow run registered on the initial open.

@jhrozek jhrozek closed this Sep 14, 2026
@jhrozek jhrozek reopened this Sep 14, 2026
Address panel review findings: rename SessionListItem.Activity to
UsageState to avoid colliding with the unrelated ActivityReplayStatus
plane, dedupe the SessionActivityProjectionPager capability probe into
port.SupportsActivityProjection, and dedupe the activity-clamp rule
into session.ValidActivity across jsonlstore/redisstore/grpcdriver.

Co-Authored-By: OpenAI <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jhrozek
jhrozek merged commit 29841c4 into main Sep 14, 2026
69 of 94 checks passed
@jhrozek
jhrozek deleted the draft-session branch September 14, 2026 18:45
This was referenced Sep 14, 2026

This branch was successfully deployed

1 active deployment
Preview — e94090c8 Deployed Sep 14, 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.

Make empty new chats visible without resuming them as real conversations

1 participant