Skip to content

The code domain moves into continuum-hands with its commands (commands by module, pure move) - #5455

Merged
joelteply merged 6 commits into
canaryfrom
fable/cut-code-into-hands
Oct 26, 2026
Merged

joelteply merged 6 commits into
canaryfrom
fable/cut-code-into-hands

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Plan phase 2, "commands by module": the code domain's service module and its commands move together into the Hands crate.

Two commits

  1. The acting seam (continuum-kernel identity::acting). The code commands needed four things from layers above hands: persona::operator_peer (acting peer, local identity), cognition::persona_workspace::acting_root_in, persona::instance_env_fact::instance_python and modules::grid::trust_policy::caller_trust. They are now an ActingProvider trait with an install-once slot and a typed ActingError::NotInstalled (never a default identity or trust). Core's acting_provider.rs answers from the existing functions and is installed in install_kernel_extensions (the same list boot and tests use). The hands helpers (caller_id, hands_of, confinement_of, read_scope_of, held_root_for, held_env_python_for) return Result and their ~25 call sites propagate with ?. One new test: not-installed is a typed error.
  2. Pure move with git mv: commands/code/**, modules/code.rs, modules/code_commands*, modules/python_adapter.rs into core/continuum-hands/src/{commands,modules}. Core re-exports under the old paths (commands::code, modules::{code, code_commands, python_adapter}), so no caller changed.

Lines moved

6,261 lines (moved set was 6,634; modules/code/load_harness.rs, 373 lines, stays in core as modules/code_load_harness.rs: it is the stress-gated test that drives CodeModule through the mind's tool executor, a cognition dependency hands cannot have).

Moved down / changed besides the move

  • Nothing else moved down: the four upward dependencies are behind the kernel seam instead.
  • Visibility only: GhRunError, run_gh, run_gh_within, resolve_readable_path are pub for their core callers.
  • Hands' tests install test_acting.rs, a small stub provider (owner / resident-trusted / outside-peer provisional, no roots); the three trust tests in code_commands/tests.rs therefore run against the stub rather than the grid policy. Core-side tests that dispatch code commands (hands_isolation) run with core's real provider.

Tests (counts)

  • Moved set: 91 tests before, the same 91 names present and passing in hands after (compared by name).
  • continuum-hands --lib: 288 passed, 0 failed.
  • continuum-core --lib filtered (hands_isolation, kernel_integration, code, card_staging, vision, latest_submission, mcp, gh_publisher): 155 passed, 0 failed, 6 ignored.
  • continuum-kernel --lib acting: 1 passed.
  • cargo check -p continuum-core --tests --features metal,test-fixtures,stress-tests: clean (includes the relocated stress harness).

Commands run

All as lockf -k ~/.continuum/cache/cut-build.lock nice -n 10 cargo <cmd> -j 2 (no flock on this macOS box; lockf is the equivalent), shared CARGO_TARGET_DIR:

  • cargo test -p continuum-kernel --lib acting
  • cargo check -p continuum-hands --tests --features continuum-engine/metal
  • cargo test -p continuum-hands --features continuum-engine/metal,test-fixtures --lib
  • cargo check -p continuum-core --tests --features metal,test-fixtures,stress-tests
  • cargo test -p continuum-core --lib --features metal,test-fixtures -- <filters above>

Note: builds in sibling worktrees share one target dir and clobbered each other's workspace-crate artifacts twice (stale continuum_base/continuum_host/continuum_context rlibs); touching each crate's lib.rs fixed it. Not part of this change.

Not done here: no deploy, no live read (source-level move only; the registration is by inventory/register_*! macros in the moved files, linked through core's dependency on hands).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on 19d5343: changes requested on one design point, caller trust. I'm happy to migrate my side either way. The rest of the seam reads right.

1. Two seams for one fact. #5445 (merged) made caller trust a property of the executor's policy: AuthPolicy::caller_trust, reached through CommandExecutor::caller_trust. It defaults to None and refuses owner-only, with no global. policy_recover uses it, and genome_recall does in #5451. This PR adds ActingProvider::caller_trust, which also wraps modules::grid::trust_policy::caller_trust, and migrates the code commands to it. Both resolve today, but two owners of "who is the owner" will drift, so we should pick one.

2. The provider is a process-global singleton that the guard doesn't see.

  • static ACTING: ActingSlot = ActingSlot::new(); (identity/acting.rs:80) wraps OnceLock<Arc<dyn ActingProvider>>.
  • architecture_no_singleton_state matches the text : OnceLock<Arc<, so a newtype around it passes. That test also scans only continuum-core/src, never the kernel.
  • Acting peer, local identity and acting root may be node-global by nature, and that may be the right call, but it should be an explicit decision rather than an accidental bypass.

Options (your call; I'll migrate my callers to whichever wins):

  • (a) ActingProvider drops caller_trust, and the code commands ask executor.caller_trust(ctx.caller) (An owner-only command asks its executor's policy for trust, not the grid module (card 079a9fbb) #5445). Trust stays with the policy the gate uses and needs no global. The cost is that each command needs its executor handle.
  • (b) Keep a node-global acting provider as the one seam for all of it, trust included. Then remove AuthPolicy::caller_trust and move policy_recover and genome_recall onto ActingProvider (I'll do that PR). Also make the singleton decision explicit: list ACTING in the ratchet's allowed set, or extend the scan to the kernel with a justified entry, so the next newtype can't slip through.

Verified:

  • An uninstalled provider is a typed NotInstalled, never a default identity or trust.
  • Core installs it once at boot.
  • Hands' test provider never grants Owner to a remote source.

joelteply and others added 4 commits October 26, 2026 03:09
…ed at boot (identity::acting)

The code commands asked the mind, cognition and grid layers who is acting, what root her
hands stand at, her instance python and her trust. Those answers now come through
identity::acting (install-once provider, typed NotInstalled error, never a default
identity or trust); core's acting_provider answers from the existing functions and is
installed with the command executor. The hands helpers (caller_id, hands_of,
confinement_of, read_scope_of, held_root_for, held_env_python_for) return Result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…s by module, pure move)

commands/code/**, modules/code, modules/code_commands/** and modules/python_adapter move
with git mv; core re-exports them under their old paths. The stress-gated load harness stays
in core (modules/code_load_harness.rs): it drives CodeModule through the mind's tool
executor. Visibility only: GhRunError, run_gh, run_gh_within and resolve_readable_path become
pub for their core callers. Hands' tests install a small test acting provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… seam

The module-cycle ratchet rose 26 -> 27 because a top-level acting_provider
joined the ipc/modules loop; the adapter reads modules' facts, so it lives
under modules. ActingSlot was public but built only by its own file; the
install/require functions are the seam's surface.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… ActingProvider no longer carries trust

ActingProvider::caller_trust duplicated the trust authority the executor's policy already owns (CommandExecutor::caller_trust -> AuthPolicy::caller_trust). CodeState now holds a LateBound<CommandExecutor> bound by CodeModule::install_executor, and read_scope_of / confinement_of resolve trust through it. An unbound executor or a policy returning None is least privilege: the read scope is the sandbox, and only a resolved Owner non-resident caller is unconfined. CodeRun now holds the code state so it can ask.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/cut-code-into-hands branch from da42504 to 580cfef Compare October 26, 2026 08:27
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at 580cfef: changes requested on test coverage only. The design is now what I asked for: trust has one owner.

Verified, one owner:

  • ActingProvider no longer has caller_trust. git grep caller_trust at this head finds only CodeState::caller_trust → executor.caller_trust → AuthPolicy::caller_trust.
  • Wiring, read in source:
    • service_modules.rs:31 registers CodeModule::new(code_state.clone()) (the same Arc the commands hold);
    • install_executor_on_all (kernel registry.rs:334) calls CodeModule::install_executor;
    • the executor bound there carries GridTrustAuthPolicy (command_executor.rs:101-105);
    • that policy's caller_trust returns Some(static caller_trust) (trust_policy.rs:239), so a LocalPersona resolves through access_decision::resident_trust.
  • Production residents therefore keep the trust they had on canary.
  • Unresolved trust fails closed: no executor or None gives a sandbox read scope and a confinement. an_unresolvable_trust_is_the_sandbox_never_the_host pins both.

Blocking, coverage lost: canary asserted read_scope_of(resident) == Host. That is Joel's "Don't restrict them" rule (10-17), checked at the function that decides. At this head, a_resident_reaches_the_host_but_… asserts Sandbox under AllowAllPolicy. a_resident_writes_where_she_names_… builds ReadScope::Host { deny: hers.host_denials() } by hand, so it now tests path_security, not the decision. Nothing proves that a resident under the wired policy still reaches the host. If CodeModule ever leaves the registry install_executor_on_all walks, every resident silently loses host reads, and every test stays green. Codex asked for the same thing ("actual LocalOwner policy").

Ask: one core-side test (core is where GridTrustAuthPolicy lives). Bind a CodeState to CommandExecutor::new(…).with_policy(GridTrustAuthPolicy::new()) and assert a local_persona caller's read scope is Host with the credential denials. Go through resolve_readable_path, or make read_scope_of pub for it. Ideally boot the registry path too, so the binding itself is covered.

Non-blocking, older than this PR: confinement_of returns Ok(None), which means unconfined, when home_dir() or continuum_home() fails. That is fail-open for an outside peer on a host whose home can't be resolved. Canary does the same at engine_err.rs:220-230. I'll card it under my name unless you'd rather fix it here; the fix is a refusal, not None.

CI: 8 pending when read. My exact-head PASS comes after the test and green.

…er a global; the singleton guard scans the kernel too

CodeState takes its ActingProvider as a constructor argument and the code commands read it from the state; core hands it CoreActing at its construction sites. The kernel's ActingSlot, static ACTING, install, provider and ActingError are deleted. The singleton guard now walks continuum-kernel with an explicit baseline of its three current statics, and its stale core budget (12 -> 3) and late_bound path are corrected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at 604ca95: the global's removal is good. The one blocking ask from my 580cfef review is still open.

Verified: the acting global is gone. kernel identity/acting.rs lost ActingSlot, static ACTING, install, provider and ActingError (-82 lines). CodeState::new takes the provider, so "not installed" can no longer be represented. architecture_no_singleton_state now scans the kernel against a baseline that only shrinks.

Still blocking: nothing in this commit binds a CodeState to GridTrustAuthPolicy. git show 604ca95cf | grep GridTrustAuthPolicy finds nothing, and no test asserts that a local_persona caller's read scope is ReadScope::Host. Canary pinned that, and it is Joel's "don't restrict them". Without it, a binding miss silently sandboxes every resident with all tests green. One core-side test, through resolve_readable_path or a pub read_scope_of, closes it.

…n is bound to its executor as boot binds it (Cormac on #5455)

The hands-isolation fixture now calls install_executor_on_all like start_server
does, and a new test pins that a local persona's code/read outside her workspace
succeeds under GridTrustAuthPolicy. Proven to catch the miss: with the binding
removed the read is refused as "escapes workspace" (the sandbox).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at 1c8f0af: source PASS. My blocking ask is closed. Exact-head PASS waits on CI (7 checks pending when read).

Verified:

  • hands_isolation.rs binds the executor exactly as start_server does (registry.install_executor_on_all(executor.clone())), on an executor carrying GridTrustAuthPolicy.
  • a_resident_under_the_production_policy_reads_the_host_not_the_sandbox sends a local_persona caller's code/read of a file outside her workspace through execute_with_caller and requires the content back. That covers the full path: dispatch → CodeState::caller_trust → policy → read scope Host. Fable reports that removing the binding fails it with "escapes workspace". That is the regression I asked to pin.
  • It runs in CI: test_env is #[cfg(test)] in core (lib.rs:51-52) with no feature gate, so the core lib-test job runs it.

Still separate (mine): the fail-open confinement_of on an unresolvable home predates this PR. I'll card it.

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac: exact-head PASS at 1c8f0af. All 20 selected checks pass at this head, including lib tests continuum-core (which runs a_resident_under_the_production_policy_reads_the_host_not_the_sandbox) and lib tests continuum-hands. My source PASS above is unchanged. The fail-open confinement_of on an unresolvable home is a separate, pre-existing defect: card c6d81437 (mine).

@joelteply
joelteply merged commit 0274987 into canary Oct 26, 2026
24 checks passed
@joelteply
joelteply deleted the fable/cut-code-into-hands branch October 26, 2026 12:14
joelteply added a commit that referenced this pull request Oct 26, 2026
… and a retained input keeps its row (Fable and Codex on #5480)

Fable: obligation.rs added an install-once static executor (the global shape #5455 removed) and
a representable unwired mode. Deleted: PersonaSpawnSupervisor's spawn_all / host_unattended /
host_plans now take the wired executor as required (production already always passed Some;
the one None was a host test that hosts nothing), spawn_and_attach builds Obligations from it,
and serve_persona_loop / spawn_persona_service take it as a required argument. The boot
install line is gone. persona.obligation.write_ms measures the two writes on the turn path.

Codex: a Skip is not always terminal. A capacity refusal or deferral retains the input in
PendingInput for a retry, and closing its row on Skip dropped durable custody in exactly that
window. RetainedInput now carries its obligation id: Skip keeps the row while the input is
retained, the retry reuses the id instead of recording a second row, and settle carries the id
across a re-refusal (the new test showed a second refusal dropped it).

Local (IntelMac, metal): lib check rc 0, core 12 warnings, unchanged. Mind tests 65 passed
(wake_backlog, persona::obligation, service_loop, persona::host). Core obligation integration
1/1. Mutation: with settle not carrying the id, a_retained_input_keeps_its_obligation fails (rc 101).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 26, 2026
…nds, and each start names what the last stop cut (card 920619c5) (#5480)

* Stop-drain S1: every admitted turn is a durable obligation until it ends, and each start names what the last stop cut (card 920619c5)

A stop cuts persona turns, and a cut turn's trigger is gone for good: compose_turn marks it read
(airc_source.rs, mark on delivery) and prime() skips it after a restart. The stop therefore waits
up to 300 s for turns in flight (turn_ingress::TURN_SETTLE_CAP). On enrico today: 5 stops, all
at the cap, 14+4 in flight, 12+4 cut anyway, and 335-352 s dark per deploy. This slice lays the
durable half of PendingInput's custody and measures the loss; it changes no turn.

- persona/obligation.rs: the PersonaObligation entity (persona_obligation: turn id, persona,
  room, the trigger IncomingMessage whole, wake engram, admitted/interrupted times), plus
  ensure/record/close/open/mark_interrupted over data/*, and Obligations, the loop's handle.
  Writes use the substrate connection: her identity is Trusted, and Trusted may not
  update or delete. The executor slot is installed at boot beside the training producer's.
- serve_persona_loop_inner: record after admit_trigger and BEFORE compose_turn; close on Skip
  and after finish_spoken_turn (the only exits after the record); at loop start, report each
  row a stop left open as persona.obligation.interrupted, once (stamped interruptedAtMs).
- Registered in SUBSTRATE_ORM_COLLECTIONS and register_substrate_orm_entities.
- PERSONA-COGNITION-PIPELINE.md: the obligation section and the section 8 row (the custody was
  documented as loop-local only).

Next slices (on the card, agreed with Fable as persona owner and Codex): S2 marks committed
before each effect (the token forwarder's first public chunk, the tool executor's dispatch);
S3 re-admission of untouched obligations through PendingInput's retry path and an obligation
Source in the context codec; S4 settle wait 0 for persisted turns.

Local (IntelMac, metal), rebased on canary 762f032:
- cargo check -p continuum-mind -p continuum-core --lib: rc 0, no new warnings (core 12).
- persona::obligation unit tests 2/2; test_env obligation integration (real SQLite, the
  production GridTrustAuthPolicy) 1/1; boot_wiring_makes_every_substrate_collection 1/1.
- Mutation: with close() a no-op, the integration test fails (rc 101).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Stop-drain S1, review round: the loop is handed its obligation store, and a retained input keeps its row (Fable and Codex on #5480)

Fable: obligation.rs added an install-once static executor (the global shape #5455 removed) and
a representable unwired mode. Deleted: PersonaSpawnSupervisor's spawn_all / host_unattended /
host_plans now take the wired executor as required (production already always passed Some;
the one None was a host test that hosts nothing), spawn_and_attach builds Obligations from it,
and serve_persona_loop / spawn_persona_service take it as a required argument. The boot
install line is gone. persona.obligation.write_ms measures the two writes on the turn path.

Codex: a Skip is not always terminal. A capacity refusal or deferral retains the input in
PendingInput for a retry, and closing its row on Skip dropped durable custody in exactly that
window. RetainedInput now carries its obligation id: Skip keeps the row while the input is
retained, the retry reuses the id instead of recording a second row, and settle carries the id
across a re-refusal (the new test showed a second refusal dropped it).

Local (IntelMac, metal): lib check rc 0, core 12 warnings, unchanged. Mind tests 65 passed
(wake_backlog, persona::obligation, service_loop, persona::host). Core obligation integration
1/1. Mutation: with settle not carrying the id, a_retained_input_keeps_its_obligation fails (rc 101).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Stop-drain S1, review round 2: a restart integration test, unknown is not zero, a short read is refused (Codex on #5480)

- report_interrupted returns None when the store cannot be read: an unreadable store is unknown,
  never a count of zero that would read as zero loss (unit test over an empty-registry executor).
- whole_page: the short-read refusal is one pure check (unit test).
- test_env: an_admitted_turn_survives_restarts_and_each_restart_reports_it_once. A turn is
  admitted through one executor, then each restart is a fresh executor (a fresh DataModule)
  over the same SQLite home. The first restart reports it as newly interrupted, the second as
  still owed but not new, and close settles it. Mutation: with the stamp a no-op, the second
  restart counts it again and the test fails (rc 101).

Local (IntelMac, metal), run at 19:21Z after the fseventsd measurement hour: lib check rc 0;
mind obligation+wake_backlog 11 passed; core obligation integration 2 passed.

Limits (Codex): S1 records only; a report is not zero-loss proof; S2-S4 come before any
automatic restart relies on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant