Skip to content

fix(session): harden cross-surface persistence and ACP lifecycle#1621

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/session-continuity-acp-lifecycle
Jul 19, 2026
Merged

fix(session): harden cross-surface persistence and ACP lifecycle#1621
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/session-continuity-acp-lifecycle

Conversation

@limityan

@limityan limityan commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make Core session mutation and persistence paths converge on the same per-session ownership boundary, including mode updates, turn start, restore migrations, metadata RMW, deletion, compression, active-session capacity, and maintenance drain
  • make TUI mode changes non-blocking and recoverable: editing, resize, session switch, new session, and host commands remain usable; the source session cannot submit until persistence settles; exit supports wait-then-exit and explicit force-exit
  • make missing persisted modes visible in TUI without expanding the Runtime SDK: CLI compares the pre/post restore summaries, explains the fallback, and preserves any startup prompt for explicit user confirmation
  • prevent Desktop metadata writers and relay history imports from overwriting or publishing incomplete session facts by using owner-side field masks and a private pending/complete import marker before Core restore
  • complete ACP create/load/close compensation, transition serialization, exact maintenance drain, stable ephemeral MCP ownership, and retryable close errors while preserving persisted history

Product and architecture boundaries

  • no extension capability, HarmonyOS work, remote execution behavior, or new product surface is added
  • no public mode-migration DTO, generic session-settings API, or parallel session owner is introduced; the fallback notice remains CLI-local
  • existing metadata/state multi-file persistence is not presented as crash-atomic or cross-process transactional
  • ACP transition ownership remains scoped to one stdio process; multi-process writes to one persisted session remain unsupported
  • session/close only releases active ACP/Core/MCP resources and retains reloadable history
  • the temporary decomposition plan is not part of this PR; only existing architecture documents are updated with implemented facts

End-to-end behavior

Path Before After
TUI mode save UI could block or diverge from durable state UI commits only after Core success; source-session input is preserved; failure is retryable
TUI exit during mode save no reliable escape/reconciliation path first exit waits and exits only on success; second exit leaves immediately and restores the last durable mode next time
missing persisted mode fallback could run a startup prompt without notice TUI shows old-to-new mode and requires explicit send
Desktop metadata writers full stale snapshots could overwrite independent owners explicit UI field masks merge under the owner lock
relay-imported history partial local turns could be treated as complete pending/complete plus exact count is checked before Core restore; failure stays retryable and fail-closed
ACP close/setup cleanup partial ownership and retry semantics were ambiguous ownership is retained until cleanup completes; stage and recovery action are returned
same-session persistence mode, turn, compression, and deletion could interleave one normalized session mutation/path-lock boundary serializes changed writers

Validation

Independent architecture, product-design, and reliability reviewers adversarially reviewed the final tree. All P0/P1/P2 findings and wording-level follow-ups were addressed before submission.

  • cargo check --workspace
  • cargo test -p bitfun-core - 1211 passed, 1 ignored
  • cargo test -p bitfun-cli - 256 unit tests plus ACP stdio, exec, plugin, product-assembly, and PTY/ConPTY contracts passed
  • cargo test -p bitfun-acp --lib - 101 passed
  • cargo test -p bitfun-desktop - 110 passed
  • cargo test -p bitfun-services-integrations --features mcp - 12 unit and 35 MCP contract tests passed
  • pnpm --dir src/web-ui run test:run - 261 files / 1626 tests passed
  • pnpm run lint:web - 0 errors; 12 unchanged warnings
  • pnpm run type-check:web
  • node scripts/check-core-boundaries.mjs
  • git diff --check gcwing/main --

A prior full cargo test --workspace --no-fail-fast sweep exposed one unchanged Windows extended-path-prefix assertion outside this PR. The affected changed packages and MCP contracts pass in the final isolated runs above.

@limityan
limityan force-pushed the yanzhn/session-continuity-acp-lifecycle branch from 8ca69ae to 5054c6d Compare July 19, 2026 00:42
@limityan limityan changed the title fix(session): make TUI persistence and ACP lifecycle reliable fix(session): harden cross-surface persistence and ACP lifecycle Jul 19, 2026
@limityan
limityan merged commit 9efb339 into GCWing:main Jul 19, 2026
5 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