Skip to content

feat(cli): preserve prompt continuity across sessions - #1984

Merged
limityan merged 2 commits into
GCWing:mainfrom
limityan:feat/cli-prompt-continuity
Aug 2, 2026
Merged

feat(cli): preserve prompt continuity across sessions#1984
limityan merged 2 commits into
GCWing:mainfrom
limityan:feat/cli-prompt-continuity

Conversation

@limityan

@limityan limityan commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve each inactive CLI Session's unsent rich composer state for the lifetime of the TUI, including text, structured workspace references, image attachments, and Chat/Shell mode.
  • Add OpenCode-compatible command-palette actions named Stash prompt, Stash pop, and Stash list, without inventing slash commands or default key bindings.
  • Add opt-in terminal attention for completed/failed turns, permission requests, and question prompts, with auto, osc9, and bel backends.
  • Stabilize the pre-existing external-source discovery regression test that failed intermittently on the Windows CI runner.

Design and compatibility

  • Keep Runtime Session state authoritative for sessions and turns; unsent drafts, prompt stash, selectors, and terminal effects remain CLI-local UI concerns.
  • Reuse the existing ComposerDraft, Action Registry, popup stack, and ConversationSelectorState instead of adding parallel command or selector systems.
  • Follow OpenCode's stash entrypoints and bounded newest-first lifecycle. The JSONL store reloads under a bounded cross-process lock, uses atomic replacement, fails without rewriting corrupt data, and caps entry/file sizes.
  • Persist workspace identity with structured references. Restoring in another workspace keeps text but detaches references with a visible warning, preventing relative paths from silently binding different files.
  • Reject persistent image stashes explicitly. In-memory Session drafts retain images; the existing local image budget evicts submitted/history metadata first and then rejects new images rather than silently dropping an unsent Session attachment.
  • Follow Codex's notification backend shape: auto chooses OSC 9 for known terminals and otherwise falls back to BEL. Notifications are disabled by default, bounded, control-character sanitized, and tmux-aware.
  • No Runtime API, transport, Shared TUI IPC, GUI, Relay, or workflow behavior is added or duplicated.

Competitor references:

CI failure root cause and fix

  • The failed test used a 25 ms discovery deadline and immediately required a zero-delay spawn_blocking provider to be present in the synchronous snapshot.
  • On the loaded Windows runner, the full Core suite took 23.46 seconds versus 7.98 seconds locally. The healthy worker missed that scheduling window and correctly moved to deferred discovery, but the test asserted before deferred publication.
  • The test now uses a release-gated slow provider, bounded condition-based observation, and the real deferred path. It still strictly asserts that the blocked provider starts exactly once while the healthy sibling refreshes.
  • The release gate disconnects on panic, so a failed assertion cannot strand a blocking worker or consume the process-wide discovery budget.
  • This is test-only; production discovery scheduling and timeout behavior are unchanged.

Validation

  • cargo check -p bitfun-cli — passed after rebasing onto latest main capability profiles.
  • cargo test -p bitfun-cli prompt_stash — 9 passed.
  • cargo test -p bitfun-cli terminal_attention — 3 passed.
  • cargo test -p bitfun-cli composer_input_tests — 19 passed.
  • cargo test -p bitfun-cli — 624 passed, 3 failed. All three are pre-existing Windows Dispatch platform/path failures outside this diff:
    • legacy_sync_failure_without_operation_id_is_reported_then_retryable
    • reported_sync_failure_allows_a_new_operation_to_take_over
    • reprovisioning_a_missing_checkout_never_resets_the_job_branch
  • cargo test -p bitfun-core --lib slow_provider_is_not_respawned_while_healthy_sibling_updates — passed, followed by 100/100 direct iterations.
  • cargo test -p bitfun-core --lib — 1,780 passed, 1 ignored.
  • CI run https://github.com/GCWing/BitFun/actions/runs/30759030603 — all 7 jobs passed on head 8621e5ca8.
  • git diff --check gcwing/main...HEAD — passed.
  • Independent adversarial review found no remaining P0-P2; its P3 notification-reconciliation gap was fixed and regression-tested before submission.

Scope

Two commits, 27 CLI/CLI-documentation/Core-test files, 1,407 insertions and 51 deletions. No production Core behavior, superpowers, Relay, or workflow files are included.

Keep rich unsent drafts scoped to inactive TUI sessions and add OpenCode-compatible prompt stash palette actions. Add bounded opt-in terminal attention for completed turns and input requests.
@limityan
limityan merged commit e6afd83 into GCWing:main Aug 2, 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