Repository navigation
Description
Outcome and current state
An isolated session accepts valid facts, enforces session/run legality, and reconstructs the same owned accepted state from committed history without executing work. Parent: #2659. Completed for this passive isolated-session scope. Production sessions do not use this kernel; parent #2659 remains open.
Merged foundations:
| Slice | Implementation |
|---|---|
| Lifecycle, atomic batches, immutable inspection and loading | #2687 |
| Reusable context and rich content | #2725 |
| Passive model interactions and explicit endings | #2746; destination-boundary cleanup #2748 |
| Canonical payload DTOs and generated borrowed views | #2749 (closes #2747) |
| Bounded structured values, effective argument maps and immutable inspection | #2756 |
| Passive tool invocation/disposition, per-call admission, settlement, bulk closeout and inspection | #2755, merged 2026-11-10 as 56c38b5e53455caff18be4807d2d0b7445bbc82d |
| Logical model-request construction and reconstruction | #2793, merged 2026-11-17 as 91e3155236feb5dd684f0f6bf51e805cad1d30a4 |
| Independent model-usage accounting | #2841, merged 2026-11-18 as a65a05ca760afa682876ec404cc0fc3a8088abd8 |
| Diagnostic record/commit timestamps and writer-instance metadata | #2876, merged 2026-11-19 as 92a2777f5a5051371ccd3faf92b5148e0d932b1e |
The passive lifecycle, logical-request construction, independent accounting, and diagnostic metadata slices are complete. They retain and reconstruct facts without executing models/tools or adopting the kernel in production.
Diagnostic metadata merged in #2876. Records and commits require signed Unix-nanosecond timestamps; commits also require a caller-supplied nonzero writer-instance ID. Session stamps successful record admission and first submission preparation, freezes exact metadata/bytes/CIDs for retry, and preserves stored metadata on load without consulting the clock. Inspection returns UTC time.Time, distinguishing absent metadata from the Unix epoch. New/Load take Config with required Policy and InstanceID and an optional Now clock. Required version-1 envelope metadata intentionally rejects older experimental envelopes without migration or synthesized historical values. This is diagnostic metadata, not authenticated attribution, action timing, clock ordering, or backend receipt time; production execution is unchanged.
Capture-parity reassessment is complete; the full audit retains mappings and evidence. The scope decisions and retained gap register preserve deferrals and revisit triggers for submitter/approver/owner attribution, input-authority provenance, first-consumer integration proofs, and consumer-driven enrichment. The metadata row is delivered by #2876; the dated audit/decision comments retain their historical context. Exhaustive parity and a first real executor/provider consumer are not prerequisites for completing this passive-session story. Parent #2659 remains open.
Merged contracts to preserve
- Original requested-call arguments remain exact opaque bytes. Invocation retains the effective name and structured
value.Maparguments separately. Structured values support explicit null, booleans, UTF-8 text, exact integers, arrays and string-keyed maps, with bounded canonical encoding and borrowed immutable inspection. - One invocation and at most one explicit disposition per requested call. Returned, NotInvoked and Indeterminate record different knowledge, not retry authority. Output capture completeness is separate from tool success/error. Output retains ordered whole parts, exact JSON, resource references/embedded bodies and optional bounded producer-sanitized diagnostics. Resource references grant no fetch authority.
- Prerequisites name strictly earlier requested calls in the same response, ignoring interleaved content positions. They are settlement barriers, not success dependencies. Returned requires an accepted invocation and accepted prerequisite dispositions; candidate facts cannot manufacture those prerequisites. NotInvoked may follow a same-batch invocation.
- Ordinary endings require every call individually settled.
EndRun(reason)is ordinary. Only explicit Limit/CaptureFailed bulk endings derive NotInvoked for uncommitted calls and Indeterminate for committed calls without dispositions. Explicit outcomes win; actual ending provenance replaces fabricated per-call records/output/reasons. No late tool facts after ending. BulkToolCloseoutremains a bool: false is omitted on encoding and missing decodes false. True is explicit and reason-constrained. Session format remains version 1; there is no migration/dual reader. Strict required-field and payload validation remain.- Only a lone minimal exceptional bulk ending bypasses ordinary soft bounds. Ordinary admission reserves its actual capacity under both Session and History hard policies. Capacity cannot guarantee backend availability or stopped external effects. Existing
Captureremains model-request evidence, not new tool-correlated evidence. - Raw records retain facts.
RunView.ToolCalls()constructs a caller-retained one-pass association across the entire pinned run using public view types/APIs. It is not a current-turn/readiness API or hidden historical index. Snapshot/RunView capture remains O(1); old handles retain old answers and selected-leaf copying does not clone siblings. - Builder, preflight and replay share scope/membership/pairing/lifecycle checks. Accepted source is distinct from ordered candidate state. Keep atomic failure/publication, immutable backing, bounded codecs/admission and exact frozen history-proposal retry. Loading grants neither execution authority nor automatic recovery.
Current code/Godoc and tests own implemented behavior. The merged tool plan and contract rationale retain design provenance. Earlier issue comments and drafts are historical rationale where superseded by these contracts.
Merged slice: logical-request construction/reconstruction
#2793 merged on 2026-11-17 as 91e3155236feb5dd684f0f6bf51e805cad1d30a4. The reviewed implementation plan retains design provenance; current code/Godoc and tests own implemented behavior.
modelrequest.Constructbuilds an owned provider-neutral request and detached recipe from a pinnedSnapshotorCommitView. Capture-boundAddModelRequestproves destination freshness; same-batch creation/run/preparation/request is supported, including a pre-genesis source anchor. Construction/acceptance is not proof of sending or invocation authority.- Chronological-v1 projects retained instructions, ordered tools, typed model settings and conversation across runs.
RootInstructionsis the harness root contract;UserInstructionsholds prepared persona/project guidance. Dynamic guidance remains chronologicalEffectiveInput. Required contribution keys are producer bookkeeping, unique per complete collection, ordered by slice position and omitted from logical content/CID. - Original provider call IDs and argument bytes are preserved. Tool results follow requested-call order with explicit outcomes, truthful output/capture notices and resource rendering; no resource fetch occurs. Private continuation is selected only by explicit exact API/model/producer/format/version matches; compatibility policy remains provisional.
- Adjacent text within each content sequence coalesces byte-for-byte without separators. Media, messages, instruction blocks and assistant items preserve their boundaries. The check is the canonical logical-request content CID, not a source-record CID manifest.
Reconstructuses the accepted request's original record prefix and run, including preceding preparation in the same commit, never current configuration/context. It strictly decodes retained parameters and checks the resulting CID. Unsupported recipes, malformed inputs and mismatches fail without preventing ordinary inspection. Submit/storage-backed Load, later appends/runs, ownership and exact-byte regressions exercise the public flow.- Output codec limits bound accepted parameters/output, not peak projection memory. Private finalization transfers exclusively owned DTO backing; public
MutableCloneand recipe export detach mutable data. - Experimental chronological-v1/session schemas may still change in place until explicitly locked. No old-algorithm implementations, migrations, dual readers or waived CID checks were introduced. Earlier experimental payloads may fail to load/reconstruct; histories are not rewritten or deleted.
These approved contracts supersede conflicting older interview text: accepted-only preparation, a source-record manifest and mandatory side-by-side historical algorithm implementations are not this delivered design. No SDK/provider/production integration, execution/recovery, compaction or network retrieval was delivered.
Merged slice: independent model-usage accounting
#2841 merged on 2026-11-18 as a65a05ca760afa682876ec404cc0fc3a8088abd8. The reviewed design context explains its boundaries; current code/Godoc and tests own implemented behavior.
- Each history-scoped usage identity has immutable purpose and optional run/request associations; its latest accepted report replaces the previous report completely. Reports can decrease, arrive after run end, be withdrawn, and be restored. They do not reopen execution or settle requests/tools.
- Five optional token counters distinguish unknown from explicit zero. Buckets retain selected logical route/model labels and optional usage-only opaque evidence; they do not infer serving identity, prices, spend, or complete work/attempt coverage.
- This is best-effort showback, not chargeback. No finality state, automatic deduplication, overlap proof, or billing reconciliation was added; these are not unfinished requirements of the delivered slice.
Snapshot.Usages()explicitly scans the pinned history to join definitions with latest reports; snapshot capture remains O(1). - Usage is independent of model responses/failure evidence and excluded from logical model-request content. Submit/Load, replacement, correlation, rollback, ownership and reconstruction-exclusion regressions cover the retained contracts.
- No production wire/API changes or client upgrades. The explicitly approved experimental Go/stored-data break removes embedded usage fields under session Version 1; strict decoding rejects old fields, with no migration, dual reader or alias. Production capture/integration remains separate.
Closure decision and retained follow-ups
- Passive-session outcome complete: admission, session/run legality, atomic acceptance, ownership, immutable inspection, reconstruction, logical requests, usage accounting, and diagnostic metadata are delivered. Closure follows explicit scope review, not merely the metadata merge. A first executor/provider consumer is not required; later consumers may motivate follow-up kernel changes. Experimental APIs are not frozen.
- Authority/provenance stays actionable: Preserve authorization and disclosure gates in the production kernel #2670 owns the contract for verified submitter/approver/owner-action-principal separation and principal-ingress/harness/unknown input authority. Share session controls and recover original command decisions #2669 supplies and preserves verified prompt/control/approval identities through asynchronous handoffs. Reassess at client/API integration planning, or earlier if an execution consumer needs it. Further postponement must record its reason and next trigger in the owning issues. Missing provenance stays explicitly unknown; owner, logical Actor, and writer-instance ID do not substitute for verified authority. Resolve the necessary contract before identity-dependent production capture/controls rely on it.
- First-consumer qualification remains downstream: execution/tool-boundary proofs belong to Exercise commit-gated model and tool execution in an isolated kernel #2664, recovery to Recover interrupted kernel work without repeating uncertain effects #2665, and provider continuation/effective-input capture plus retry/failure/cancel usage coverage and deduplication to Preserve effective model inputs and private provider continuation #2667 coordinated with the first executor. Closing this issue satisfies none of their execution/integration acceptance criteria. Accounting feat(kernel): define model-usage accounting contracts #2841 is complete; do not reopen finality/chargeback scope.
- Enrichment is optional, not an unassigned promise: richer action/retry timing, resource/deployment/hostname metadata, and backend receipt timestamps require a concrete consumer and separate scope decision. Reassess as client needs become clearer; these are not committed backlog deliverables or closure blockers.
- Preserve the evidence and limits: keep the capture audit and scope/gap register linked. Their dated comments are historical where superseded here. Closure does not assert execution/provider qualification, production readiness, backend durability/fencing beyond its contract, or any migration/cutover approval.
Parallel storage/ownership work belongs to #2666: #2760 targets a local/embedded or single-host file backend with concurrent engines/processes and file locking; #2761 designs replica ownership and backend fencing. These can progress independently of request algorithms; neither is already delivered by the memory-backed passive lifecycle.
Execution/recovery qualification belongs to #2664/#2665; production/provider capture integration to #2667. Shared controls, governance, delegation and production cutover retain their own scoped work. No production behavior or stored-data upgrade is implied by the merged isolated slices.
Activity
jbeda commentedon Nov 5, 2026
Design interview outcome — 2026-11-05
Joe approved the semantic direction and then split the expanded work into three independently reviewed checkpoints. This is a design decision record, not a claim that the work below is implemented or that production uses the isolated kernel.
The lifecycle-only checkpoint is merged in PR #2687, merge commit
841f554c0392dce842604faa22e4c7035438a208. It does not complete this story or #2659.Confirmed next-slice refinements (Q57–Q60)
Delivery checkpoints after that PR
Each checkpoint requires concrete public-contract review before implementation. Discussion approval is not blanket implementation authority.
Commitment and lifecycle
/goalis later orchestration that evaluates completion and starts another run.Identity, audit, and private continuation
Reconstruction and storage efficiency
Rich media and disclosure
Admission, limits, and explicit deferrals
/goal, fork implementation, compactor execution, generic rewrite/provenance framework, blob store, or full attempt log is authorized by this design interview.feat(kernel): draft passive tool disposition contracts
feat(kernel): draft passive tool disposition contracts
feat(kernel): construct and reconstruct logical model requests
jbeda commentedon Nov 18, 2026
Capture-parity reassessment after #2841 — 2026-11-18
Audited production producers/persistence against the isolated kernel at
a65a05ca760afa682876ec404cc0fc3a8088abd8. Code/Godoc and tests, not historical drafts, are the evidence. #2841 completes independent best-effort usage accounting; it does not integrate the kernel into production.Conclusion: the principal model/tool/accounting carriers already exist. The meaningful gaps are a few attribution/provenance/time contracts and unqualified producer mappings—not a requirement to copy every production field. Record a gap without committing to implement it. No implementation or issue closure is proposed by this audit.
Mapping and gap table
Paths/lines below refer to the audited commit.
Created,RunStarted, history commit/record envelopes have no occurrence/acceptance time. Ordering is not time.Actoris expressly a logical-origin string, not verified identity; no equivalent owner/action-principal capture.UserInputretains content; inlineActor/Purpose/Sourcedo not express this authority classification.Evidence and existing tests
internal/adapter/server/service.go:3025,engine/adapter/sessnap/sessnap.go:334,adapters/jsonlstore/jsonlstore.go:896; compareengine/kernel/history/format/commit.go:18andengine/kernel/session/format/created.go:3.engine/session/principal.go:39,internal/adapter/server/exact_plan_actor_test.go:63,internal/adapter/server/caller_identity_owner_test.go:112.engine/session/conversation.go:23,engine/adapter/sessnap/prompt_provenance_test.go:10; compare kernel origin-label contract andengine/kernel/session/format/user_input.go:12.engine/kernel/modelrequest/construct_test.go:164,engine/kernel/modelrequest/reconstruct.go:14,engine/kernel/session/format/model_response.go:170,provider/openai/request.go:432.engine/agent/dispatch.go:1753,engine/agent/dispatch.go:1782,engine/kernel/session/tool_calls_view_test.go:325,engine/kernel/modelrequest/tool_result_projection_test.go:16(including diagnostic non-disclosure).engine/kernel/session/usage_test.go:24,engine/kernel/session/usage_retry_test.go:14,engine/kernel/modelrequest/usage_test.go:14,internal/adapter/llmresilience/loop_integration_test.go:475.engine/kernel/session/invocation_evidence_view_test.go:8,internal/adapter/server/eventlog_test.go:120.ObservedEvidencevalidates syntax, not disclosure safety.Proposed focused proofs, attached to the right consumer
Production itself already has limits: accepted steers queue content/message IDs without their own verified caller, and historical snapshots cannot recover effective tool arguments, lost usage presence, or response interleaving. Do not promise an exact lossless legacy import or silently attribute missing facts.
Scope recommendation
Review input-authority provenance as the smallest justified next slice; separately settle whether narrow action-attribution and occurrence-time contracts are needed before first production capture. Do not hold the isolated session story open for all telemetry/enrichment or all production integration proofs. Make its closure boundary an explicit decision with Joe.
Leave typed latency/retry telemetry, richer resources, exhaustive policy/approval narratives, pricing/chargeback/finality, verified serving/charging identity, successful-call provider IDs and exact wire reproduction unimplemented unless a concrete consumer establishes the requirement. Some are deliberate non-goals, not deferred obligations.
Verification: focused local
go -C engine test ./kernel/session ./kernel/modelrequest -run 'Usage|Example|TestConstructToolNotInvokedNotices|TestConstructToolOutcomeCaptureNotices'passed. Additional targeted production/kernel test selections were run during the read-only audit; no full repository gate, live provider call, runtime change, production cutover or issue closure was performed. #2871 is separate and untouched.jbeda commentedon Nov 18, 2026
Capture-parity scope decisions after the audit — 2026-11-18
Follow-up to the full capture-parity audit. The audit's recommendation to start with input-authority provenance is superseded by the decisions below. These are scoped design/deferral decisions, not delivered behavior, issue closure, or permission for production cutover.
Selected next slice: diagnostic timestamps and writer metadata. Session stamps signed Unix-nanosecond timestamps on successful record admission and once when first preparing a frozen commit for submission. Commit-only opaque nonzero uint64 writer-instance ID is injected by the caller and shared across sessions; Session rejects zero and does not generate an ID. Consumers can inspect enclosing accepted commit metadata. Retries preserve exact bytes/CIDs; replay never consults the clock. No ordering/causality/clock-accuracy, authenticated attribution, execution-time or storage-acceptance guarantee. Storage-assigned timestamps could be external backend metadata later. Required metadata intentionally breaks old experimental envelopes under version 1, without migration or synthesized historical values. Plan reviewed; implementation has not begun.
Retained gap register — not all prerequisites for #2663 closure
The audit above retains the actual producer→persistence mappings, code/test evidence, production capture losses and proposed focused proofs. Keep that audit and this decision register linked when reviewing closure of #2663 and when planning #2664/#2667 and governance/control integration. A recorded gap is neither forgotten nor automatically implementation approval or a closure blocker. Do not silently infer missing historical attribution, usage precision or execution outcomes.
The reviewed full implementation plan is retained locally at
.scratch/2663-history-metadata-plan.md(slug2663-history-metadata, intended branchimpl/2663-history-metadata, basemain). This comment is durable scope/deferral context, not a full-plan archive. #2871 is separate and untouched.