stacklok / stacklok/mecatl

refactor(mecatui): standardize local async request tokens

Open
#713 0 comments 0 reactions 1 assignee View on GitHub

@jbeda is already working on this.

Since Aug 20, 2026.

tui
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 requestToken as 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 max reconciliation 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.