refactor(mecatui): standardize local async request tokens
@jbeda is already working on this.
Since Aug 20, 2026.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Problem
The TUI currently uses a mix of Generation, Epoch, Seq, and action-specific names for local asynchronous request correlation. The values are used primarily as opaque request/response tokens, but some names imply ordering or time semantics and the current surface-local increment plus Model-level max handoff is harder to reason about than necessary.
Goal
Standardize local TUI async request correlation around explicit request tokens.
Proposed direction
- Use
requestTokenas the public/internal operation-level name. - Add one Model-lifetime allocator (for example,
nextRequestToken() uint64) that survives modal/surface teardown. - Each in-flight operation stores the token it expects: page, transcript, action, etc.
- Response handlers compare tokens for equality only.
- Remove per-surface counter initialization and Model
maxreconciliation once all operations mint tokens through the shared allocator. - Keep server cursors, server revisions, and protocol-provided generations distinct from local request tokens.
This is a cleanup/refactor. It must preserve the stale-response guarantees added by the /sessions surface migration and should add focused regression coverage for close/reopen and concurrent request classes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.