Skip to content

cmux-tui: add journal session persistence state machines - #9815

Closed
lawrencecchen wants to merge 5 commits into
task-journal-agent-canonical-statefrom
task-journal-session-state-machines
Closed

lawrencecchen wants to merge 5 commits into
task-journal-agent-canonical-statefrom
task-journal-session-state-machines

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Stacked after #9813, which is stacked after #9806 and #9726. Keep this draft blocked until #9726, #9806, and #9813 are reliable, gated, and landed.

Successor:

Scope for this slice:

  • Add journal-derived session lifecycle, runtime attachment, and hibernation policy state tables.
  • Rebuild these projections deterministically from the session journal on open.
  • Keep hibernation default OFF by materializing a disabled policy row when the journal has no trusted policy transition for the session.
  • Accept state-machine updates only from trusted local authority records with role session.persistence.
  • Run the persistence reducer inside the existing journal ingress transaction before the idempotency receipt write.

Out of scope for this slice:

  • No public hibernate command.
  • No recover command.
  • No fork command.
  • No host-loss classifier.
  • No process kill.
  • No automatic Pi launch.

Why the public hibernate operation is deferred:
The operation needs catalog and generated binding updates across public resource surfaces. This PR first lands the durable source boundary and pure reducers so that the later command has one state contract to call into.

Red and green commits:

  • 9201af2 test(tui): require session persistence state machines
  • 6bf2c45 feat(tui): add session persistence state machines

Verification:

  • rustfmt on touched Rust files.
  • git diff --check.
  • sqlite3 schema check accepted the canonical default-off hibernation policy row.
  • sqlite3 schema check rejected a mismatched hibernation policy row.
  • cargo test -p cmux-tui-core session_runtime_and_policy_state_machines_rebuild_from_journal
  • cargo test -p cmux-tui-core default_off_hibernation_policy_and_terminal_close_do_not_hibernate

Blocked broader verification:
A broader registry regression run could not start because another local xcodebuild process took the artifact guard after the focused tests passed. I stopped the waiting cargo process and did not bypass the Xcode guard. The AWS M4 Pro builder path did not answer through tsadmin or direct SSH.

Owner closeout:
Fixed = no durable session persistence state machines -> versioned journal-derived lifecycle/runtime/policy tables with default-off hibernation.
How = pure reducers from trusted local journal records plus SQLite JSON constraints. This is principled because the projection stays rebuildable and cannot be changed by untrusted producer rows.
Risk = public commands, effect dispatch, and host-loss proof are intentionally not implemented here. They belong in successor PRs after this source boundary is reviewed.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 129d11c0-6ab2-41d8-8d19-de76ea7142cf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@blacksmith-sh

blacksmith-sh Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Found 4 test failures on Blacksmith runners:

Failures

Test View Logs
generated protocol coverage matches the canonical v11 IR View Logs
github.com/manaflow-ai/cmux/cmux-tui/bindings/go/raw/
TestGeneratedInventoryHasTypedMethodForEveryCommand
View Logs
test_orchestrator.PythonDevOrchestratorTests/
test_fake_server_emits_canonical_terminal_snapshot
View Logs
test_protocol.GeneratedProtocolTests/test_protocol_inventory_is_exhaustive View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…te' into task-journal-session-state-machines
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Closing this obsolete draft because its dependency stack is dead (#9806 and #9813 are closed, and this chain depends on those predecessors). Any remaining intent should be reintroduced in a fresh PR from current main.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Obsolete stacked draft; see the closing note above.

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