Skip to content

Reconstruct accepted session state from committed history #2663

Closed
1 of 1 issue completed
Closed

Description

@jbeda

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.Map arguments 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.
  • BulkToolCloseout remains 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 Capture remains 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.Construct builds an owned provider-neutral request and detached recipe from a pinned Snapshot or CommitView. Capture-bound AddModelRequest proves 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. RootInstructions is the harness root contract; UserInstructions holds prepared persona/project guidance. Dynamic guidance remains chronological EffectiveInput. 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.
  • Reconstruct uses 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 MutableClone and 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. jbeda commented on Nov 5, 2026

    @jbeda
    ContributorAuthor

    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)

    • Request-local targeting is deferred until needed and an actual request identity/lifetime exists. The next slice supports prospective persistent context replacements.
    • The current opaque input format is a placeholder, not a compatibility constraint. Rationalize authored input into ordered rich content; change the input schema deliberately, with no migration shim or silent interpretation of old opaque bytes.
    • Preserve high-fidelity input-box contents separately from ordered effective prompts. References to original authored content and harness-origin rewritten/supplemental content retain explicit source/triggering-input provenance. A model-facing user role does not imply the user authored it.
    • Context may be accepted in the same atomic commit as run start/input. Active-run preparation governs admission, not ownership: instructions/catalog/model settings are session-scoped, carry no RunID, persist across runs, and the latest applicable accepted replacement wins at a selected request head. Multiple superseded updates remain inspectable; no conversation re-encoding is required.
    • The next-slice plan incorporates these decisions and passed initial plus targeted planning critique with no remaining findings. This is not runtime proof or implementation authorization; exact public Go/DTO declarations still receive coherent review before consumers.

    Delivery checkpoints after that PR

    1. Reusable context and content facts — next. Independently retained/replaced effective root instructions, advertised tool catalog, declared model/API binding and behavior-affecting settings; ordered rich content and media source forms; authored versus effective input; immutable snapshots and exact load. Demonstrate an authored skill command and its retained expansion, then prompt/catalog replacement, without rerunning skills or consulting current configuration. Exclude model/tool-cycle state machines, request construction, compactor execution, and generalized conversation edits.
    2. Passive model/tool-cycle lifecycle. Request commitments, completed responses, requested calls versus effective intents, explicit out-of-order resolutions, private continuation, clean completion, and bounded interruption preserving uncertainty. No model/tool execution or request-construction implementation. Review the whole pairing/advancement contract together rather than creating temporary model-only APIs.
    3. Versioned request construction. A separate package constructs the logical request from a frozen snapshot at an explicit accepted head, ignoring later records. Reuse immutable context/content rather than recording the full expanded request each turn. Verify an implicit ordered manifest with record-level CIDs; support historical algorithm versions and explicit context/conversation replacement. No provider SDK or raw-wire equality guarantee.

    Each checkpoint requires concrete public-contract review before implementation. Discussion approval is not blanket implementation authority.

    Commitment and lifecycle

    • Preparation/rewriting can repeat before acceptance. Definitively accept the decided logical request before provider invocation. Retry the same frozen request when model delivery is uncertain; duplicate spend is tolerable under the no-external-side-effects assumption. At most one response is accepted and it cannot be replaced by a later attempt.
    • Only completed terminal provider responses enter history, including token-limit/non-success stop reasons. Broken stream fragments do not create accepted calls. Streaming progress is separate from accepted-history snapshots.
    • One logical model interaction at a time. Every requested tool call needs a disposition before normal advancement; result arrival order does not change requested-call order.
    • A tool intent is an immutable audit point: retain final target/arguments, originating call, and safe authorization/preparation explanation before invocation. Intent proves neither execution nor success and does not make retry safe.
    • Explicit non-invocation, ordinary tool error, and known completion with withheld/unavailable output can resolve a call. Continuing an active run past in-flight unknown execution is deferred; interrupt honestly instead.
    • Loading preserves active state without automatic resume or fabricated closure. A higher owner can safely continue an active run or explicitly interrupt it. Accepted interruption is terminal; subsequent work uses a new run.
    • Normal completion accounts for admitted input, but does not assert task success. Interruption may preserve unprocessed input. /goal is later orchestration that evaluates completion and starts another run.
    • Run interruption closes remaining obligations as unresolved without fabricating per-tool results or claiming an external executor stopped. Preserve accepted siblings. Executor/pod loss may leave uncertain effects, a still-running command, or inconsistent external state.
    • Preserve the actual synthetic explanation sent to the model as retained effective content, not text regenerated later or falsely attributed to the tool.

    Identity, audit, and private continuation

    • Model request identity is run-scoped; its unique response needs no independent allocator. Requested calls are scoped to that request and their original order. Provider call IDs are not uniqueness authority.
    • Keep provider request/response/item/call identifiers for accepted facts as debugging/forensic evidence. Comprehensive failed/discarded-attempt logs and optional informational records are deferred.
    • Preserve ordered rich response items/content, tool-call positions, and opaque continuation boundaries/bindings. Final content order is not delta-arrival order. Do not flatten everything into text.
    • Record continuation producer/format identity and version. Unknown provider formats remain preservable/inspectable; preservation is not compatibility. Provider interpretation/conversion belongs to later adapters.
    • Separate declared route/API dialect/requested model selector from observed upstream identity. Virtual aliases and gateways need not resolve to a known model. Record safe evidence without claiming a compatibility decision or retaining credentials.

    Reconstruction and storage efficiency

    • Root instructions, tool definitions, model/settings, conversation content, and required private continuation are historical effective facts. Never rebuild them from today's config, installed skills, hooks, or external work.
    • Store complete replacements of changed context components, then reuse them. Replacing a prompt/catalog must not re-encode the conversation. Changes apply prospectively by default; request-local scope is explicit.
    • Compaction/context changes are retained data interpreted by the algorithm; only interpretation changes require a new algorithm version. The effective session conversation normally spans runs.
    • Initial construction consumes accepted snapshots, not provisional batch previews: accept components, construct, accept request commitment, then invoke. Exact source-head match is required; a stale preparation is rejected rather than appended to a changed history.
    • A historical head can be reconstructed from a later snapshot. Branching from it is a future new-history/fork operation, not permission for stale appends.
    • Fingerprint the ordered CIDs of canonical CBOR records, not commits. Preserve order and multiplicity. Identical records need no occurrence discriminator solely for the signature; provenance can use history-scoped record ordinals.
    • This validates selected fact bytes/order, not arbitrary code changes interpreting the same facts under the same version label. Reconstruction regression tests remain necessary. Defer an assembled-request digest, wire tracing, and harness/dependency-version recording.
    • Session validates structural commitments; the separate constructor owns algorithm selection and fingerprint verification. Unsupported reconstruction fails explicitly without making history uninspectable. Supported historical algorithms remain available side by side.
    • A configurable assembled-byte sizing check is a lightweight sanity check for bugs/unexpected legitimate growth, not a malicious-session security mechanism or token cap. Permit intended very large contexts; never truncate or silently alter a request.

    Rich media and disclosure

    • Preserve ordered text/image/audio/document content, distinguishing inline bytes, remote references, and provider-scoped file IDs. Reference fidelity does not promise remote availability or retained remote bytes.
    • Retain inline media once within bounds; do not automatically archive URLs/provider files. Reject oversized inline content. Optional referenced blob storage, media preparation/upload, and archival policy are later work.
    • Audit fidelity does not override disclosure/withholding. Held bytes and payload-bearing traces remain memory-only; they cannot leak into history, checkpoints, audit evidence, or private continuation. Known completed execution with lost output does not imply failure, no effects, or safe retry.

    Admission, limits, and explicit deferrals

    • Pending input/steer slots are not canonical history merely because they may be durable. Their storage ownership remains open: a future session runtime or higher coordinator might persist them for recovery/handoff. Do not implement that subsystem in these passive slices.
    • Additional authored input is admitted only at safe interaction boundaries. Pending outside-history input does not block completion. Future promotion must avoid lost/duplicate delivery across crashes.
    • Keep ordinary soft admission and hard persistence bounds. Prove actual minimal bounded interruption fits hard capacity; a large practical soft/hard gap is not a substitute for that proof. Cleanup-only admission must not bypass limits for ordinary facts.
    • Concrete accounting/finality is deferred. Late accounting must be appendable after terminal execution without reopening a run. It remains a separate checkpoint, not silently removed from story tracking.
    • No production integration, legacy aggregate import/wrapper, distributed backend/fencing, eager steering, /goal, fork implementation, compactor execution, generic rewrite/provenance framework, blob store, or full attempt log is authorized by this design interview.
  3. jbeda commented on Nov 18, 2026

    @jbeda
    ContributorAuthor

    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.

    Fact Actual production capture Kernel coverage / gap Disposition and owner
    Creation/occurrence time Session creation time survives snapshots; successful-turn timing is retained in configured event logs; tool queue/execution durations and recorder-time timestamps live in optional best-effort audit sidecars. Events are not generally wall-clock timestamped. Created, RunStarted, history commit/record envelopes have no occurrence/acceptance time. Ordering is not time. Early design decision, before first production history capture: which occurrence times must survive? Keep occurrence, acceptance and duration distinct; no blanket timestamp framework. Session capture owner; history owns envelope time only if justified.
    Verified action principal vs owner Verified ingress principal stamps server-appended durable events; owner separately survives snapshots. Exact live approvals can use the verdict caller, not run initiator. Kernel Actor is expressly a logical-origin string, not verified identity; no equivalent owner/action-principal capture. Early contract candidate before identity-bearing ingress. Host verifies; owning attribution/ownership contract retains narrow values. Never infer actor from owner or authentication from a label; loading identity grants no authority.
    Input-authority provenance Root prompt/accepted steer vs harness continuation vs unknown is retained through snapshots/events; action review consumes it fail-closed. It is an ingress classification, not proof every transformed byte came from an authenticated human. UserInput retains content; inline Actor/Purpose/Source do not express this authority classification. Strongest small next-contract candidate: preserve structured provenance and explicit unknown, without overloading role/source/actor. Session input contract, trusted ingress producer; governance interprets it.
    Model requests Production builds final requests with ephemeral instruction bodies; optional manifests retain labels/counts/sizes, not reconstructible content. Prepared content/settings/tools plus source/recipe reconstruct the original logical CID. This is stronger retention, not raw SDK/HTTP equality. Covered isolated contract. Factory fidelity belongs to first production adapter (#2667), not another request-contract redesign.
    Model responses and private continuation Snapshots retain opaque replay data, phase and provider item IDs; readable reasoning instead goes to configured event logs. Flattened production messages lose some original interleaving. Ordered response items and response-wide opaque private envelope can retain these facts; exact selector gates replay. Provider metadata remains provisional. Carrier exists; integration proof missing. #2667 must preserve item identities/order/phase inside the provider envelope before flattening, and keep private bytes out of public projections. No new kernel field demonstrated necessary.
    Requested vs effective tool arguments Original arguments survive conversation/events; hook-rewritten effective arguments reach execution and optional best-effort audit sidecar. Exact original bytes and separate effective name/structured arguments are retained and joined by scoped call ID. Covered isolated contract. #2664/#2667 capture at actual dispatch, not from the original tool card; historical snapshots cannot invent effective arguments.
    Tool outcomes/output Conversation retains released typed output/error; post-hook, UTF-8 repair and incoming review precede final recording. Old error flags conflate denial and execution failure. Returned / NotInvoked / Indeterminate, independent output completeness, ordered output/resource parts. Covered, intentionally more precise. First executor integration must preserve the released-result boundary. Never infer no side effects from an old error flag or retain unreleased raw output for parity.
    Usage Production accumulates five normalized counters by purpose/opaque attribution; failed/discarded attempts can contribute usage. Legacy integer counters lose absence-vs-zero. #2841 retains independent identities, fixed correlation, complete replacement/withdrawal/restoration, optional counters and safe usage-only raw evidence; no finality, billing or automatic overlap proof. Covered isolated contract. First producer (#2667, coordinated with resilience) must define stable observation identity and avoid double-counting retries/cancellation; never split an opaque attribution key or manufacture historical precision.
    Explanations and correlation Terminal explanations, reasoning summaries and sanitized failed/interesting network-attempt evidence may persist in configured event logs; not all are conversation snapshot state. Failure/ending explanations, diagnostics and safe provider correlation already have distinct carriers and Submit/Load coverage. Not a generic approval/control audit log. Mostly covered. Producer sanitization/disclosure and any future governance/control decisions belong with their consumers, not an omnibus explanation schema.
    Actionable pre-execution failure detail Production can return useful denial/preparation error text to the model. NotInvoked reasons project generic notices; producer diagnostics are deliberately not rendered. Real behavior difference, defer until #2664 needs model self-correction. Decide explicit model-safe detail then; do not expose Diagnostic to close the gap.
    Timing, retries, richer resource metadata Successful-turn latency, tool timings and retry observations exist in separate logs/sidecars; production resources have extra description/size/audience/priority/modified metadata. No equivalent typed timing/attempt history; resource metadata is narrower. Defer. Revisit for a concrete latency/SLO, attempt-accounting/recovery or resource-rendering consumer. An importer must acknowledge loss; it need not expand schemas now.

    Evidence and existing tests

    • Time: internal/adapter/server/service.go:3025, engine/adapter/sessnap/sessnap.go:334, adapters/jsonlstore/jsonlstore.go:896; compare engine/kernel/history/format/commit.go:18 and engine/kernel/session/format/created.go:3.
    • Identity: single server stamping boundary, engine/session/principal.go:39, internal/adapter/server/exact_plan_actor_test.go:63, internal/adapter/server/caller_identity_owner_test.go:112.
    • Authority provenance: production fail-closed consumer, engine/session/conversation.go:23, engine/adapter/sessnap/prompt_provenance_test.go:10; compare kernel origin-label contract and engine/kernel/session/format/user_input.go:12.
    • Requests/private replay: 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.
    • Tool retention/security: 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).
    • Accounting: report semantics and deliberate limits, 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.
    • Explanation/correlation retention: engine/kernel/session/invocation_evidence_view_test.go:8, internal/adapter/server/eventlog_test.go:120. ObservedEvidence validates syntax, not disclosure safety.

    Proposed focused proofs, attached to the right consumer

    1. Provenance contract, if selected next: Submit/storage-backed Load preserves principal-ingress, harness and unknown distinctions; logical origin/source cannot upgrade authority. Exercise unknown/legacy and transformed-input cases. No need to integrate the production review engine now.
    2. Attribution/time, before production ingress: owner A / actor B / separate approval caller C; absent principal stays absent; asynchronous control handoff preserves its actual caller. Use a controlled clock to distinguish occurrence from append time and assert no ordering/authority is inferred from timestamps. These are contract proposals, not fields approved by this audit.
    3. First execution/provider consumers: provider continuation through adapter → Submit/Load → request reconstruction → adapter replay (multiple reasoning items, phase, call item IDs); original/effective hook arguments; released-output parity; retry/cancel usage neither omitted nor counted twice. These are integration tests, not evidence that the carriers need expansion.

    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.

  4. jbeda commented on Nov 18, 2026

    @jbeda
    ContributorAuthor

    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

    Gap / qualification Current disposition Revisit trigger / owning work
    Record/commit diagnostic time and writer clock domain Selected, planned; not implemented This bounded #2663 slice; do not expand it into authority capture or telemetry.
    Verified input submitter, tool approver and owner/action-principal separation Explicitly deferred; writer ID and logical Actor are not substitutes Actual input/control ingress and authenticated-principal propagation, before identity-bearing production capture/authorized controls, under #2659's governance/control work. Include owner A / actor B / approver C and asynchronous handoffs.
    Principal-ingress / harness / unknown input-authority provenance Explicitly deferred; remains a real semantic gap, not implicit role/source trust Before governance-capable production integration, or sooner if an isolated execution consumer needs it. Session input contract plus trusted ingress/governance consumer.
    Real provider continuation round trip, effective logical request fidelity, original/effective tool arguments and released-output capture Existing carriers; integration proof still missing First execution/provider consumers in #2664 / #2667. Prove factory/adapter → Submit/Load → reconstruction/replay; don't add fields just to claim parity.
    Retry/failure/cancel usage coverage and deduplication at producer boundaries #2841 accounting contracts complete; producer integration not qualified #2667 coordinated with resilience/first executor. Stable observation identity, no invented unknown counters or lost failed-attempt usage; no chargeback/finality expansion.
    Actionable model-safe pre-execution denial/preparation detail Deferred behavior difference #2664 when model self-correction needs more than generic NotInvoked notices. Never expose private Diagnostic merely to close this gap.
    Typed timing/retry observations, richer resource metadata, hostname/deployment enrichment or backend receipt timestamps Consumer-driven deferral Concrete latency/SLO, recovery/accounting, resource rendering or operational-debugging consumer, with privacy/retention semantics. Diagnostic record timestamps do not implement these.
    Pricing/chargeback/finality, verified serving/charging identity, comprehensive provider IDs, exact SDK/HTTP reproduction Deliberate non-goals unless explicitly re-scoped New concrete requirement and separate scope review, not latent acceptance criteria.

    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 (slug 2663-history-metadata, intended branch impl/2663-history-metadata, base main). This comment is durable scope/deferral context, not a full-plan archive. #2871 is separate and untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions