feat(subagents): allow embedders to isolate runtime state roots - #5252
feat(subagents): allow embedders to isolate runtime state roots#5252cacdcaecawae wants to merge 1 commit into
Conversation
Separate delegated-agent persistence and coordination state from the execution workspace while retaining the legacy default. Keep child cwd and file authority unchanged, and cover isolated ledgers, transcripts, locks, and resume reads. Refs Hmbown#4416 (partial). Signed-off-by: liuyang <3078108050@qq.com>
|
Thanks @cacdcaecawae for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
Harvested from PR #5252 by @cacdcaecawae Adds an optional `EngineConfig::subagent_state_root` so an embedding host can own delegated-agent lifecycle storage instead of sharing `<workspace>/.codewhale/state` with every other conversation bound to the same project. The worker ledger, transcript artifacts, coordination lock, cleanup, and `resume_from` reads move behind the selected root; child execution cwd, file authority, and receipts are unchanged. Unset leaves the legacy default byte-for-byte, so nothing changes for anyone who does not opt in. The PR is explicit that it is a partial building block for #4416 and deliberately does not implement durable session ownership, cross-session history union, or write arbitration — and therefore does not close it. It also documents that distinct state roots are distinct coordination domains and do not arbitrate writes to a shared execution workspace, which is the limitation most likely to be misread as isolation. Co-authored-by: cacdcaecawae <109055297+cacdcaecawae@users.noreply.github.com>
|
Thanks @cacdcaecawae — your contribution landed in
Closing this PR now that the code is on If you want to land more work and would prefer your future PRs merge cleanly without a harvest step, the |
Summary
EngineConfig::subagent_state_rootfor embedding hosts that need session-owned delegated-agent stateworkspace/.codewhale/statedefault unchangedresume_fromtranscript reads behind the selected state rootThis is a partial building block for #4416. It intentionally does not implement durable session ownership, cross-session history union, or write arbitration, and therefore does not close that issue.
Why
Embedding applications can bind multiple conversations to the same project workspace. Today those conversations necessarily share delegated-agent persistence and coordination files under the project. Filtering a shared ledger after the fact cannot provide isolation and still leaves concurrent writers. A host-owned state root separates lifecycle/control-plane storage without changing where agents execute.
The default remains byte-for-byte compatible at the API behavior level: callers that leave the field unset continue to use
<workspace>/.codewhale/state.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features --locked(warning-free under the CI allow list)cargo test --workspace --all-features --lockedAdditional checks run:
cargo check -p codewhale-tui --lockedexplicit_state_roots_isolate_managers_for_the_same_execution_workspaceresume_from_loads_transcript_artifact_when_availableThe two repository TUI suite commands were also run on Windows:
cargo test -p codewhale-tui --bins --lockedcargo test -p codewhale-tui --tests --lockedBoth execute the same 9,683 binary tests here and ended at 9,661 passed / 14 failed / 8 ignored. The failures are in untouched shell execution, runtime handoff timing, file-mention indexing, TUI responsive-layout, and fleet-detail tests; the new isolation and resume tests pass independently. This draft does not report the full suite as green.
cargo clippy --workspace --all-targets --locked -- -D warningsis also not green on currentmainwith this Windows/Rust 1.97 toolchain: it promotes 43 existing warnings in untouched TUI visibility and command files (includingprivate_interfaces,match_result_ok, andneedless_return). No warning points to the changed state-root code.Checklist