interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / docs / plans / tracing / INVENTORY-398.md

79 lines · 9380 bytes Raw Blame History Rendered
1# Inventory for #398: ids and recording sites a correlation trace can join on
2
3Read from main at the branch point. Line numbers are from that checkout. Roles:
4AUTH = authorization (decides whether something may run), EVID = evidence
5(records what happened), NEITHER = bookkeeping or an observation tap.
6A trace event is NEITHER by design: it points at AUTH and EVID, never replaces them.
7
8## Scheduler (`crates/aien-scheduler`)
9| Site | What | Role |
10|---|---|---|
11| `src/sequence.rs:11` `SequenceId {slot: u32, generation: u32}`; packed u64 via `from_u64` / `Into<u64>` (`:50`, `:56`) | Per-sequence id, slot plus generation. Layout in doc comment at `:8`. | NEITHER |
12| `src/lib.rs:82` `step_id` field, set `:99`, stamped into the batch `:399`, incremented `:433` and `:961` | Scheduler step counter, local to one scheduler instance. Not unique across restarts. | NEITHER |
13| `src/lib.rs:61` `SchedulerMetrics` (counters only; `admitted_requests` bumped `:229`, `:256`; `preempted_requests` `:499`, `:1104`; `finished_requests` `:1108`, `:1154`; `total_steps` `:1181`) | Aggregates. No per-sequence or per-swarm key, so it cannot be joined on. | NEITHER |
14| `src/lib.rs:157` `submit_request` returns `SequenceId`; `:261` `fork_sequence`; `:286` `fork_subagent` | Admission entry points. Natural place for `sequence_admitted`. | NEITHER |
15| `src/lib.rs:108` `set_decision_observer`; call site `:424` | Read-only tap, once per `build_scheduled_batch`, `None` by default. | NEITHER |
16| `src/dual_observer.rs:239` `DecisionObserver::observe_admit_preempt(&AdmitPreemptRecord)`; record `:215` carries `step_id` and, via `AdmissionCandidate.seq` (`:150`), the `SequenceId` of admission candidates | Decision record of the DUAL experiment. Observation only; return type is `()`. | EVID for scheduler choices (DUAL), not for tool authority |
17
18## Swarm (`crates/aien-runtime/src/swarm.rs`)
19| Site | What | Role |
20|---|---|---|
21| `:80` `swarm_id` from `next_swarm_id` (starts 1, `:65`), returned by `launch_swarm` (`:71`) | Per-process counter. Resets on daemon restart (UNVERIFIED whether it is ever persisted; no persistence seen in this file). | NEITHER |
22| `:31` `SwarmRecord {id, root_sequence_id, branch_sequences, branch_worlds, finished_branches, state}`; `SwarmState` `:11` | Swarm to sequence to world mapping. | NEITHER |
23| `:84`, `:116`, `:117` root world id, `fork_world`, `arena.fork` | World ids and branch `SequenceId`s are created together at fork. Branch KV is forked later by `fork_branches_from_ready_root` (`:172`). | NEITHER |
24| `:221` `cancel_swarm`; `:274` `note_sequence_finished` | Cancel and natural completion. Both drop branch worlds. No event is recorded today. | NEITHER |
25| `src/spine.rs:309` `AienRuntimeSpine::launch_swarm`; `:193`-`:210` finish path: `SequenceId::from_u64(request_id)` then `note_sequence_finished` | The `request_id` of a finished stream IS the packed sequence id here. | NEITHER |
26| `src/client.rs:108` `cancel_swarm` sends `ControlCommand::CancelSwarm(swarm_id)` | Control entry for cancel. | NEITHER |
27
28## Generation record (`crates/aien-runtime/src/generation.rs`)
29| Site | What | Role |
30|---|---|---|
31| `:12` `GENERATION` marker; `:125` `build_record` | Daemon-authored note in the compose ledger: model and tokenizer sha256, prompt/output token-id hashes, finish reason, daemon pid/start, `request_id` and `operation_id`. Doc (`:1`-`:8`): "EVIDENCE ONLY", no grant, intent or effect decision reads it. | EVID |
32| `:41` `request_id`, `:42` `operation_id` | "Caller-asserted: the client chooses the envelope ids; recorded, not trusted" (`:139`). Do not treat as proof of identity. | EVID (untrusted field) |
33| `:168` `PROVENANCE`, `:180` `Provenance {generation_record: Option<u64>, allen_agent, stale_generation, note}` | Link from a commit/grant/intent/ack to the generation record id (a compose ledger record id). Reserved key; no ledger reader parses it for decisions (`:171`). | EVID |
34| `src/spine.rs:2651` `write_task_generation`, used `:2579`; `Provenance::new` `:2580` | Where the generation record id is minted for a run. | EVID |
35
36## MCP broker (`crates/aien-mcp`)
37| Site | What | Role |
38|---|---|---|
39| `src/wire.rs:8` `CallOutcome {Finished(Value), Rejected(String), Uncertain}` | Provider answer. `Uncertain` means the request may have reached the server and is never resent. | EVID (provider side) |
40| `src/effect.rs:9` `EffectIntent {provider, tool_name, arguments, capability_digest}` | What is to be run. Carries arguments, so a trace must not copy it. | NEITHER |
41| `src/authority.rs:149` `intent_digest(&EffectIntent) -> Digest32` | Digest naming one intent. Join key to approval and ledger. | NEITHER (name only) |
42| `src/authority.rs:25` `AuthorityDecision {Allow, AllowRestricted, RequireApproval, Deny, Contain}`; `:133` `AuthorityOutcome {Pending, Approval, Denied, Contained, Execution}` | Policy verdict and the reasons nothing ran. | AUTH |
43| `src/broker.rs:293` `EffectLane::authorize`; `:308` `authorize_approved`; `:344` policy digest computed | Mints `AuthorizedEffect`; the only production mint. | AUTH |
44| `src/effect.rs:64` `AuthorizedEffect<T>` (private fields; `approval_id()` `:76`, `world_id()` `:99`, `winning_jnode()` `:103`, `policy_digest()` `:107`, `idempotency_key()` `:115`) | Capability token in the type system. Cannot be built from a trace. | AUTH |
45| `src/approval.rs:105` `ApprovalDesk::issue`; grant id = `Digest32::of(counter ++ intent_digest ++ idempotency_key)` (`:112`-`:118`); `ApprovalGrant::id()` `:86` is crate-private | Approval grant id (32 bytes). Counter is per broker. | AUTH |
46| `src/broker.rs:32` `LedgerEntry {InFlight, Completed(EffectReceipt), Uncertain}`; row keyed by `EffectId`, bound to `EffectIdentity {intent digest, world_id, winning_jnode}` (`:43`) | In-memory idempotency ledger. | EVID (in memory only, UNVERIFIED whether persisted elsewhere) |
47| `src/broker.rs:485` execute; receipt built `:544` | `EffectReceipt {effect_id, world_id, winning_jnode, policy_digest, provider, tool_name, capability_digest, output}` (`effect.rs:25`). `Finished` stores Completed, `Uncertain` or transport error stores Uncertain and returns `ReconciliationRequired`, `Rejected` removes the row. | EVID |
48| No `EffectReceipt` digest function seen in `effect.rs` or `broker.rs`. Receipt digest for a trace is UNVERIFIED: must be defined by the instrumenter (for example over a canonical encoding) or taken from the Interplane receipt verifier. | | |
49
50## Compose daemon (`crates/aien-runtime/src/spine.rs`, `effects.rs`)
51All ids below are compose ledger record ids (u64, one append-only journal), not hashes.
52| Stage | Site | Role |
53|---|---|---|
54| Proposal and commit | `spine.rs:2438` `run_task_inner`; model run; commit record `effects.rs:1277` `write_compose_commit`, called `spine.rs:2581`, stamped with `Provenance` | EVID (commit claim) |
55| Mint grant | `effects.rs:1335` `authorize` (`ComposeAuthorize`), `:1326` `mint_grant`; also `write_approved_grant` `:1182` for approved compose | AUTH |
56| Open intent | `effects.rs:1592` `open_intent`; text has `phase: "intent"`, `authorization: <grant id>` (`:1626`) | AUTH check, then EVID of the intent record |
57| Execute and ack | `effects.rs:1641` `ack`; phase `ack` (`:14`); links `[intent, authorization]` | EVID (executor report plus world state) |
58| Record mark | `spine.rs:2058` `advance_mark`; called after commit `:2598`, and on `:2364`, `:2546`, `:2714`, `:2972`; types in `cortex_mark.rs:123` `MarkRefusal` | EVID (tamper evidence for the journal) |
59| Reconcile | `effects.rs:1673` `reconcile`, phase `reconcile` (`:15`), `:1858` `reconcile_at_start`; gate `:705` `reconcile_gate`; `spine.rs:2385` `set_reconcile_failed` | EVID, and a gate that refuses effect commands |
60| Effect states | `effects.rs:52` `EffectState {Open, Done, NotDone, Unresolved}` | EVID |
61
62Refusal names (`effects.rs:85`, text `EFFECT_REFUSED <name>: detail`), verified by grep of
63`Refusal::new` call sites: Stopped, NotAuthorized, AlreadySpent, ReconciliationRequired,
64Revoked, Stale, ReconcileFailed, NotRegular, MissingParent, CorruptLedger, Unreadable,
65OutsideWorkspace, DeskMacRequired, Replayed, AlreadyAuthorized. Mark errors (`spine.rs`):
66E_MARK, E_MARK_TRUNCATED, E_MARK_DIGEST, E_MARK_WRITE; also E_REPLAY (`spine.rs:2334`).
67All are AUTH outcomes (a refusal), mapped by a trace to a status, never reinterpreted.
68
69## Join keys
70| Link | Key | Notes |
71|---|---|---|
72| swarm to branch/root | `swarm_id` (u64), `SequenceId` as u64 | `SwarmRecord` `swarm.rs:31` |
73| sequence to world | `world_id` (u64) | fork time, `swarm.rs:116` |
74| sequence to scheduler step | `step_id` (u64) | `AdmitPreemptRecord.step_id`; per scheduler instance |
75| sequence to stream/generation | `request_id` equals packed `SequenceId` on the finish path (`spine.rs:193`) | generation `request_id` is caller-asserted |
76| model turn to commit/grant/intent/ack | `generation_record` (ledger id) via `Provenance` | evidence only |
77| proposal to grant to intent to ack | ledger record ids: `authorization` field, `links` | `effects.rs:1626` |
78| tool request to approval to receipt | `intent_digest`, approval grant id (`approval_id()`), `EffectId` idempotency key, `world_id`, `winning_jnode` | `broker.rs:43` |
79| AIEN to Interplane | UNVERIFIED: no Interplane id exists in this repo yet; coordinate with interplane#97 | trace id is minted here and handed over |