Skip to content

[Bug]: TUI turn admission overwrites explicit Server resume with local journal state #1063

Closed

Description

@XuPeng-SH

Existing issue search

Searched open resume PRs and TUI/resume/journal issues; no matching report found.

Version

Main 13797cce49dce352669c9ccc4f8d28f75712144e, CLI 0.2.11.

Actual behavior and root cause

An explicitly selected authenticated Server CanonicalJournal ResumeBundle wins during apply_restored_session. The existing cloud_only_typed_resume_installs_the_selected_active_conversation test covers local completed turn 20 and Server completed turn 3, and correctly installs Server state/turn 3.

The next normal TUI turn calls acquire_interactive_turn_admission. Whenever a local journal exists, it unconditionally replays the local journal and replaces the selected active conversation, history and state.turn. Thus a successful explicit Server restoration can be silently replaced with older/different local prompt history before the model request.

build_turn_stream_params then sends state.turn + 1 to Server. Local primary journal commits and derived artifacts also use state.turn. Simply preserving the remote value is insufficient when the local canonical clock is ahead: it can regress the local commit; changing it to the local clock sends the wrong remote turn index. A first-turn-only workaround also fails after a local commit replaces the active cursor.

Expected behavior

Preserve explicit authenticated canonical Server prompt authority across admission and consecutive turns, while using the existing local journal owner, execution lease, base/CAS and durability guards. Keep Server request indices and local journal indices correct without a parallel lifecycle, invented Server cursor or unverified counter. Degraded checkpoints must not acquire Server canonical authority.

Reproduction boundary

This report is confirmed from the existing restoration test and the production caller chain, not a live-provider or TUI process reproduction. The missing regression should compose actual restoration, admission, request construction and local settlement for at least two consecutive turns, with both local-ahead and Server-ahead clocks. No privacy flag is required.

Scope

Discovered during #1042 review and intentionally separated from its one-shot privacy settlement fix. No credentials, user transcripts, deployment or provider calls are needed for the deterministic regression.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions