Skip to content

feat(cli): split portable session state from host config (#1338) - #1349

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1338-state-config-roots
Jul 26, 2026
Merged

Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1338-state-config-roots

Conversation

@Nyvo-io

@Nyvo-io Nyvo-io commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1338

Summary

  • Add explicit stateRoot and configRoot inputs at the CLI runtime bootstrap seam while retaining workspaceRoot as the backward-compatible default.
  • Route sessions, runs, runtime events, shell runs, and artifacts to stateRoot.
  • Route connections, credentials, settings, automations, device identity, prompts, and every skill discovery surface to configRoot.
  • Add a fail-closed Session Bundle export policy for one selected session.
  • Export the selected session through the canonical SQLite metadata transfer seam instead of copying sessions.sqlite.
  • Copy known session-owned runtime entries and reject unknown selected-session entries.
  • Filter artifact metadata and runtime.sqlite by session.
  • Exclude credentials, provider configuration, device identity, storage markers, activation inputs, logs, SQLite sidecars, and other host-owned material.
  • Reject symlinks, path escapes, unknown entries, non-empty destinations, and overlapping roots.

Compression, manifests, activation inputs, and the maka activate control plane remain out of scope.

Validation

  • npm run format:check
  • npm run lint
  • npm run build:test
  • npm run typecheck
  • Session Bundle policy: 8/8 passed
  • Session metadata maintenance: 2/2 passed
  • CLI runtime bootstrap: 21/21 passed in an isolated rerun
  • git diff --check

The three existing background ShellRun timing cases can exceed their 3-second polling deadline when run concurrently with heavy build/review load; the unchanged cases passed immediately when rerun in isolation.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more issue outside the inline comments:

[P2] planSessionBundleExport() only checks session existence if it finds a top-level sessions/ directory. I reproduced an empty stateRoot returning a successful empty plan and export. Please require the requested session before returning the plan and add coverage for an empty root and a root without sessions/.

The branch also conflicts with current main, so the checks need to run again after the rebase and metadata changes.

@Nyvo-io
Nyvo-io force-pushed the feat/1338-state-config-roots branch from f7b0a76 to 8a8f307 Compare July 23, 2026 17:36
@Nyvo-io

Nyvo-io commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and updated in 8a8f307.

The final revision exports selected SQLite session metadata through the existing transfer seam, preserves every missing destination suffix, copies the explicit set of normal session-owned runtime entries, routes every skill surface through configRoot, and still fails closed on unknown selected-session files.

Validation on the rebased tree: format, lint, full workspace build/typecheck, Session Bundle policy 8/8, metadata maintenance 2/2, and isolated CLI runtime bootstrap 21/21.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline finding below.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The implementation uses the existing bootstrap and SQLite transfer seams, keeps the state/config trust boundary explicit, and addresses the previously reported correctness issues. I did not find a blocking implementation problem in the current head.

Non-blocking follow-ups:

  • [P2] Strengthen the bundle round-trip test. The happy-path fixture currently writes schema-invalid run and artifact records and then verifies copied bytes. Please create representative state through the public stores and reopen the exported bundle through those same stores, so the test proves that selected runs, artifacts, shell runs, and runtime events remain consumable.
  • [P2] Exercise device-ID isolation through the real bootstrap path. The current test calls getOrCreateCliClaudeDeviceId(configRoot) directly, so it would still pass if one of the bootstrap call sites regressed to workspaceRoot. Trigger the Claude device-ID path through createMakaCliRuntimeContext, and keep one representative state-root/config-root journey for the other routed stores.
  • [P3] Make execution-phase export failures recoverable. If filtering fails after copying begins—for example, on malformed artifact metadata—the destination is left partially populated and a retry fails with destination_not_empty. Consider exporting into a staging directory and renaming on success, or reliably cleaning the destination on failure.

These do not block the state/config split itself, but they would make the trust-boundary tests and export failure behavior substantially stronger.

@Astro-Han

Copy link
Copy Markdown
Contributor

The two P2 test gaps and the P3 cleanup behavior are worth following up, but none changes the correctness of the state/config split or makes the current implementation unsafe to merge. The current head is approved, and its typecheck, test, and e2e jobs are green. Merging this as-is; the follow-ups can be handled separately.

@Astro-Han
Astro-Han merged commit cc15d04 into apache:main Jul 26, 2026
3 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.

feat(cli): split bundled session state root from injected config root

2 participants