Skip to content

feat(cli): add TUI session controls and context compaction - #1907

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:fix/tui-session-context-status
Jul 30, 2026
Merged

feat(cli): add TUI session controls and context compaction#1907
limityan merged 1 commit into
GCWing:mainfrom
limityan:fix/tui-session-context-status

Conversation

@limityan

Copy link
Copy Markdown
Collaborator

Summary

  • Align interactive TUI session entry points with OpenCode: add /status, /clear (/new), and session browser aliases /sessions, /resume, /continue, and /history.
  • Add OpenCode-compatible manual context compaction through /compact with /summarize as its only alias. Both Embedded and Shared TUI use the same runtime-owned operation; no new shortcut or BitFun-specific command is introduced.
  • Show a truthful latest-primary-model context snapshot in TUI status instead of presenting it as a whole-session total.

Design and behavior

  • Add one narrow AgentSessionCompactionPort and keep compression policy, prompts, context replacement, persistence, and terminal ownership in Core.
  • Extend the private first-party Shared TUI IPC to protocol v8 with an idle/current-controller CompactSession operation and caller-owned turn identity for disconnect cancellation and unknown outcomes.
  • Admit dialog and maintenance turns atomically. Manual compaction reads context only after it owns the Session, remains cancellable during planning, and ignores late cancellation once atomic commit begins.
  • Persist manual compaction as a transcript-visible but model-invisible maintenance Turn. Live and restored views retain the same compression ID, tool payload, applied fact, and terminal error semantics.
  • Preserve normal user retry from SessionState::Error while keeping maintenance operations idle-only.

Scope

  • No Relay, Server, Peer, ACP, SDK Host, extension, customization, compression-algorithm, or public protocol changes.
  • The IPC version change is limited to the unpublished local first-party TUI protocol; same-version client and runtime are required as before.

Adversarial review

An independent combined-diff review found and closed issues in atomic turn admission, post-commit terminal finalization, persisted transcript restoration, compression identity/payload parity, error-state retry, and cancelled/error transcript parity. The final review found no remaining P1/P2 blockers.

Validation

  • cargo test -p bitfun-runtime-ports
  • cargo test -p bitfun-agent-runtime
  • cargo test -p bitfun-agent-runtime-ipc (45 passed)
  • cargo test -p bitfun-cli (493 unit tests plus integration suites passed)
  • cargo test -p bitfun-core manual_compaction --features product-full -- --nocapture (6 passed)
  • cargo test -p bitfun-core maintenance --features product-full -- --nocapture (5 passed)
  • cargo test -p bitfun-events (20 passed)
  • cargo check -p bitfun-core --features product-full
  • node scripts/check-core-boundaries.mjs
  • changed-file rustfmt --check
  • git diff --check

cargo check --workspace was also attempted. Rust compilation reached the Desktop build script, which stopped because the generated, untracked src/mobile-web/dist directory is absent in this clean worktree. No unrelated generated frontend output is included in this PR.

@limityan
limityan force-pushed the fix/tui-session-context-status branch from 142d326 to 0414733 Compare July 30, 2026 16:15
@limityan
limityan marked this pull request as ready for review July 30, 2026 16:35
@limityan
limityan merged commit d7a4458 into GCWing:main Jul 30, 2026
7 checks passed
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