Skip to content

feat(kernel): retain passive model interactions and run endings - #2746

Merged
jbeda merged 5 commits into
mainfrom
impl/kernel-model-interactions
Nov 8, 2026
Merged

jbeda merged 5 commits into
mainfrom
impl/kernel-model-interactions

Conversation

@jbeda

@jbeda jbeda commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implement slice 3: passive model interactions in the isolated kernel. Refs #2663 (does not close it or #2659).

  • Retain run-scoped model request commitments with the exact accepted source, versioned construction recipe/check, and optional retry correlation.
  • Capture complete ordered responses with output/reasoning/refusal content, requested calls, reported usage, and one opaque response-wide provider envelope. Observed invocation failures remain separate from provider responses and do not imply zero remote spend.
  • Share source-aware admission across builder, preflight, Apply, and Load; enforce earlier accepted request/outcome boundaries, input coverage, and unresolved-call obligations.
  • Replace experimental interruption records with explicit run endings, including capture-failure evidence and actual minimal-ending reservation against both Session and History encoding policies.
  • Preserve immutable snapshots, typed views, call-order identities, exact bytes, and absent-versus-zero usage.

No production wiring, model/tool invocation, request reconstruction/check verification, tool dispositions, or aggregate/late accounting. Those remain separate slices.

Review map

  1. Contracts and codecs: model_request_id.go, model_request.go, model_response.go, invocation_failure.go, run_ended.go, and the corresponding session/format schemas. format/zz_cbor_generated.go is generated; the two engine/api snapshots reflect the exported contracts.
  2. Admission and endings: lifecycle_state.go, session_commit.go, session.go, and the interaction admission/replay/ending/capture/policy suites. Focus on pinned accepted source versus provisional state, clean-ending coverage, minimal hard-only escape, and append uncertainty.
  3. Inspection and tests: record_view.go, views beside the owning types, immutable-view/ownership tests, fuzz seeds, and traversal benchmarks. Call IDs count calls, not all response items.

Full implementation plan and decisions, archived as a PR conversation comment with a verified plan digest.

Verification

Passed locally on the final candidate:

  • task lint (all configured modules; zero issues)
  • task generate:codecs:check and task api:check; codecs and both session API snapshots regenerated through their owning tasks
  • cd engine && go test -race ./id ./kernel/... ./arch ./adapter/history/...
  • cd engine && GOWORK=off go test ./kernel/... ./arch ./adapter/history/...
  • cd engine && GOARCH=386 go test ./kernel/...
  • task docs (strict link and generated-reference checks)
  • Focused repeated/adversarial replay, capture fallback, unknown-acceptance, ownership, malformed-codec and fuzz-seed checks
  • Complete-traversal benchmarks: direct traversal remained 0 B/op and 0 allocs/op across independent count/payload axes
  • git diff --check

Per engine/AGENTS.md, this isolated engine change uses scoped race/architecture/API/standalone evidence rather than the full repository test/test:race suites. No live-provider tests ran.

Split panel review covered Spec, Standards, Test adequacy, and Domain (architecture, security, library reuse, duplication), fixed against a5322b5231a970fd21744d3484bd87090c1bf43b. Two test-adequacy findings and one documentation advisory were fixed and passed targeted incremental rechecks. No open findings or reviewer failures. Unaffected axes retain their initial scoped evidence; this is not a claim that every reviewer reran after test/doc-only fixes.

API compatibility

  • Wire: no remote-observable behavior changes; the isolated kernel is not connected to production entry points. No wire major or feature identifier change, and no client upgrade required.
  • Go/stored experimental kernel contracts: replaces RunInterrupted/Interrupt with unified ending types/operations and adds model interaction records. Old experimental interruption histories are intentionally unsupported; no migration shim. This is the approved isolated-kernel waiver, not a production data migration.
  • Public API snapshots are updated. Changelog/compatibility-note bookkeeping is waived by engine/kernel/AGENTS.md for the experiment.

Record scoped model requests, ordered atomic responses, invocation failures,
reported usage and opaque provider evidence in the isolated session kernel.
Share accepted-source admission across builder, preflight and replay, retain
immutable inspection, and reserve actual minimal run-ending envelopes.

Keep request construction, tool disposition, accounting and production wiring
outside this slice. Add adversarial replay, bounds, ownership and retry tests.

Refs #2663

Co-authored-by: Mecatl <[email protected]>
@jbeda

jbeda commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Implementation plan: passive model interactions

  • Slug: kernel-model-interactions
  • Source: .scratch/kernel-model-interactions-plan.md (local provenance)
  • Branch: impl/kernel-model-interactions; base/start: refs/heads/main at a5322b5231a970fd21744d3484bd87090c1bf43b
  • Published PR head: afeda89a87fdbe965d88db87ecf9eaea48db471c
  • Updated: 2026-11-07T20:22:13Z
  • Plan-portion SHA-256: 7684cbc300133035f609c38cc096cddbac248f610c7ce6a9b4da12cb790c339d

This is the full current implementation plan, published without redactions. Verification commands below are the plan's intended checks, not evidence of passing; actual local results and review outcomes are recorded in the PR description. No production integration or merge is authorized.

Passive model interactions — slice 3 of #2663

Slug: kernel-model-interactions
Implementation branch: impl/kernel-model-interactions
Base branch: main (tracking origin/main)
Planning baseline: a5322b5, after merged #2725.
Plan path: .scratch/kernel-model-interactions-plan.md
Status: slice 3 implemented locally on impl/kernel-model-interactions; split code review and targeted fixes/rechecks completed. Joe authorized commit, push, and a new review PR. This document retains the approved design and planned verification; actual command outcomes belong in the PR description and implementation run note. No production integration or merge is authorized.

Implementation start: refs/heads/main at a5322b5231a970fd21744d3484bd87090c1bf43b, verified clean with exact remote main before branching. Original reviewed design SHA-256: 17cc3da9f6e9f96099a07ca4e3c959a91c75557218c3e0a6abbd2cb6a4789434.

Publication amendment: no semantic scope changes. Concrete ending reasons use compact unsigned codes 1–6. Split review added explicit disclosure responsibility on ending explanations and deterministic malformed-codec/effective-contribution coverage regressions. These are implementation refinements within the approved design.

Outcome and boundaries

The isolated session accepts and reconstructs model-request commitments, complete responses or observed invocation failures, requested tool calls, reported per-invocation usage, and explicit run endings. Demonstrate the lifecycle through real History acceptance without calling a model/tool or rebuilding a request.

This is slice 3 under #2663, not completion of that issue or #2659. Slice 1 merged in #2687; slice 2 merged in #2725. Slice 4 adds tool intents/dispositions; slice 5 implements versioned request construction/check verification; slice 6 adds aggregate/late/final accounting.

No production wiring, legacy session import/wrapper, protocol-adapter changes, execution/coordinator, queues/steering, permissions/hooks, handoff/fencing, compaction execution, blobs, partial-response bodies or comprehensive diagnostic/SDK-attempt logs. Do not implement a retry loop or reasoning-removal transformation. Do not rename existing indexes or refactor unrelated code.

Primary decision record: .scratch/kernel-context/slice-3-interview.md (Q1–Q33, all answered). Production research: .scratch/kernel-context/slice-3-production-research.md. The issue was updated/read back with current merged status and revised semantics. Older issue comment 6665718324 is historical: its one-logical-request-spanning-visible-attempts and binary ending model are superseded.

Grounding and reuse

  • Extend existing session/format owners, not a new framework: lifecycle_state.go:13, session_commit.go:100, record.go:49, record_view.go:26.
  • Builder addition, live preflight, and decoded evaluate/Apply/Load must share legality. evaluate does NOT call preflight (session.go:211); source-head checks only in a public method would be bypassable.
  • Snapshots/accepted DTOs are immutable prefixes; publication follows complete staging (session.go:229–267, snapshot.go:15). Never retroactively attach an outcome to a published request entry.
  • Reuse ContentPart for text/media, existing constructor size preflight, generated codecs, run/input ordinal patterns, Count/At/iter.Seq conventions, explicit codec/Policy limits. No legacy session.Usage import.
  • Existing closeout reservation actually prepares the next interruption envelope; policy has no defaults (policy.go:12). Generalize that mechanism, not merely a guessed soft/hard gap.
  • feat(engine): establish canonical tool-call identity and private replay #2404 at 3aa9bf4 informed occurrence mapping, exact provider tokens and ownership. Do NOT inherit its random IDs, flattened responses, provider-token whole-batch rejection or legacy fallback aliases.

Material contracts

Identities and atomic facts

Proposed names below define coherent responsibilities; final spelling/CBOR keys are routine design work in task 1, not permission to alter semantics.

Owner/value Required contract
ModelRequestID Comparable RunID + positive contiguous request ordinal, assigned provisionally by the aggregate. Zero invalid. No independent response allocator.
RequestedCallID ModelRequestID + positive contiguous ordinal among CALLS, not all response items. Derive from accepted response order; provider tokens never identity authority.
ModelRequest ID; exact accepted SourceHead; construction recipe; optional earlier same-run RetryOf. One engine-visible invocation per request, including retries.
ConstructionRecipe Exact algorithm identifier, positive version, exact algorithm-owned parameter bytes, nonempty bounded construction-check bytes. Empty parameters allowed if defined by the named version. Check is algorithm-produced and CID-derived; its format/meaning belongs to algorithm/version, not a global session hash parser.
ModelResponse RequestID; ordered canonical items; normalized terminal class and exact optional provider reason; optional safe observed provider/correlation evidence; optional reported usage; optional single response-wide private envelope. One atomic response record.
ResponseItem Exactly one content or requested-call branch. Content has output/reasoning/refusal kind and ordered ContentPart values. Call has exact UTF-8 name (empty/unknown allowed) and exact argument bytes (empty/invalid JSON allowed). No tool/schema validation or normalization.
OpaqueProviderData Producer/format identifier(s), positive format version, owned exact bytes. Response envelope internally preserves provider ordering and mappings to canonical local item/call ordinals. No generic kernel binding language, provider-token lookup API or global map. Unknown formats remain retainable/inspectable.
InvocationFailure RequestID; small observed failure classification; optional bounded safe explanation/correlation evidence and reported usage. No response items, partial-body field, fabricated provider response or assertion of no remote processing/charge.
InvocationUsage Optional nonnegative int64 input/output/cache-read/cache-write/reasoning counts, each with absence distinct from zero. Use existing engine counter semantics as prior art: input/output inclusive; cache/reasoning breakdowns not extra spend. No enforced accounting sum/subset equations or aggregate totals. Preserve optional raw usage-only evidence in a versioned opaque carrier, including on failure; never use it as a partial-body escape hatch.
RunEnded RunID; fixed-size reason category; optional bounded safe explanation and capture-failure evidence described below. One ending family replaces experimental RunInterrupted. Reasons cover completed/error/limit/cancelled/interrupted/capture-failed; exact external names reviewed in task 1. No response/result fabrication or claim external effects stopped.
CaptureFailureEvidence Optional ending-owned request reference, safe observed correlation metadata and reported usage, ONLY on a capture-failed ending naming the currently pending accepted request. No response items, partial body or private response envelope. Does not resolve that request or certify provider failure. This is same-invocation evidence at ending, not a standalone late-usage ledger.

Public values retain full scope and explicit assignment/Clone/Equal contracts. Constructors own nested mutable storage and return zero on failure. DTOs omit enclosing history/run/request context only where supplied unambiguously by their enclosing fact; reject conflicting public scope before omission. Optional exact provider evidence preserves absence where meaningful; original detail also survives in the private envelope. Structural errors never interpolate payloads or raw backend/provider exceptions.

Private data is evidence, not permission. Producer/adapter interprets its schema and validates occurrence mappings before dependent use; the passive session does not parse signatures, encrypted reasoning, provider IDs or private ordinal relations. No silent omission or invented provider pairing tokens. Future derived lookup indexes cannot become a second authority.

Accepted source and commit gates

A request is prepared from an ALREADY ACCEPTED snapshot. Its SourceHead must equal the exact sequence+CID immediately before its containing commit; stale/foreign/zero heads reject. The source must already have the same active run, a model binding, no pending request outcome, and no unresolved calls. Missing instructions/catalog mean empty under the construction algorithm; no synthetic facts or current host defaults.

Use a small concrete shared admission context carrying the pinned pre-commit source and ordered candidate scalars in builder/preflight/evaluate. Do not confuse prepare's proposed NEW ref with the accepted source. Do not advance source while iterating records.

  • StartRun/context/input can batch normally, but provisional start/binding/input cannot establish request prerequisites at the source. Require candidate input coverage frontier to equal source frontier at request admission.
  • Context replacements may precede/follow a request in the same batch, but are prospective relative to that request: its recipe still uses the pinned accepted source. Read source binding, never candidate/latest binding, when validating request prerequisites.
  • A response/failure requires its referenced request to have been accepted in an EARLIER commit. Do not permit Request→Response/Failure in one atomic proposal to masquerade as the request-before-invocation gate.
  • Likewise Response/Failure→new Request in one commit is ineligible because the pinned source still has an outstanding outcome. Accept the outcome before constructing another request.
  • Response/Failure plus an otherwise legal ending may batch: there is no dependent external invocation between those facts.
  • Typed constructors only prove local validity, not accepted source membership. Apply/Load must reject hand-crafted commits violating the same gates.

The recipe's parameters/check are retained without interpretation or algorithm registration. Session does not select source records, verify the check, construct requests, implement compaction or remove reasoning. Unknown algorithm/version remains inspectable; unsupported reconstruction later fails explicitly. Compaction/context changes determine source selection through the documented algorithm; retries are invisible to that algorithm. A changed interpretation needs a new algorithm version; an already defined parameter change does not.

Interaction state, input coverage, retries

Keep one outstanding engine-visible request at a time; no new input/request while its outcome is pending or requested calls remain unresolved. An adapter explicitly declares API terminality; EOF/local exception does not. Accept terminal non-success/provider-failure responses, zero items, private-only responses, explicitly empty content/parts and empty text without conflating their representation.

A complete response OR observed invocation failure resolves that request's pending outcome once. Both cannot exist; duplicate same/different outcomes reject even if byte-identical. Exact frozen HISTORY-proposal retry remains separate and unchanged. Provider-client internal retries are opaque. A higher layer retries by committing an ordinary NEW request from the current accepted head, optionally referencing an accepted earlier same-run request. RetryOf is correlation only: no automatic retry, frozen-old-context semantics, backoff or eligibility policy. New recipe parameters can deliberately change construction; old request and private data remain intact.

Track a per-run admission/coverage frontier for authored submissions and nonempty effective contributions. Every authored submission, including empty content, advances it. An empty EffectiveInput remains a retained no-content contribution and does NOT request generation or dirty an otherwise covered frontier, per effective_input.go:10–14. Nonempty duplicates still contribute/advance; references alone are not processing. Context replacement is not an input frontier change. Capture source frontier at request acceptance; its terminal outcome accounts for that frontier for ending purposes, not proof the model understood/satisfied/received input. Newer input cannot be accounted for by an older outcome. Overflow rejects before consuming IDs or publishing scalars.

A response with N calls creates N unresolved obligations, with call ordinals independent of interleaved text/reasoning/refusal. Unknown names, invalid arguments, repeated/missing provider tokens do not suppress calls. Complete call items in terminal non-success responses are obligations too. Adapter must not declare fragments as complete calls. Slice 3 offers no disposition operation: no next request/input or clean completion until slice 4; ending may preserve them unresolved.

Endings and uncertainty

One ending fact makes the active run terminal; no automatic successor, retry, cancellation, outcome synthesis or reload-time ending. Wrong run, duplicate ending or later model outcome for an ended run reject. Starting a successor resets ACTIVE counters without rewriting historical requests/calls/outcomes. Old pending work stays inspectable and cannot be resolved by a new run's IDs.

Completed reason requires no pending request/calls and an accounted current input frontier. Input-free runs may end without an invocation. Explicit error/limit/cancel/interrupted/capture-failed reasons may end with unresolved or unprocessed work; that state remains derived from accepted facts, not silently marked resolved. A recorded invocation failure can account its input frontier and justify an error ending after retry exhaustion; it does not prove delivery. New input prevents claiming an old outcome covered it; an explicit uncertain ending can still terminate while preserving that newer unprocessed work. Failed clean-ending attempts reject atomically; do not convert them into another ending.

Reason explains the owner's ending, not merely last provider stop. Reported provider tokens/reasons may be unknown. Proposed normalized provider classes: normal/limit/refusal/error/cancelled/other; actual call items, not the label, establish call obligations. Reasons and classifications never themselves authorize execution. Preserve exact optional provider reason independently.

Bounds and actual terminal escape

Whole response (canonical items + private envelope + usage/evidence) is one bounded record. Constructor sizing precedes conversion/allocations; generated decode and aggregate cumulative hard checks remain authoritative. No truncation, body/private-envelope dropping or partial call acceptance. If capture rejects, accepted request remains pending; a fresh ending can say capture-failed, not falsely provider-failed. When ordinary bounds permit, its optional CaptureFailureEvidence retains the pending request's available usage/correlation without accepting any stripped response or turning capture rejection into InvocationFailure. Validate full same-run/request membership before DTO scope omission. This evidence has no response-content/envelope field and does not resolve the request. Detailed capture-failed endings are SOFT-bounded; after known local rejection, a fresh minimal ending omits all evidence/detail. Never switch to a fallback proposal after uncertain append acceptance. No partial-stream storage, implicit blob store or UI implementation.

Generalize reserveInterruption/prepareInterruption to actual preparation of a one-record minimal ending. Minimal shape is fixed-size identity + compact closed reason and NO explanation/evidence/usage or lists. All promised emergency reason encodings must fit (use compact reason codes and prove worst permitted case). Preserve actual next-envelope sizes, sequence-width changes, hard record/byte/decoded-work/payload/commit constraints, not a guessed reserve. Eligibility for unconditional uncertain ending must not use a synthetic lifecycle missing new pending/coverage scalars.

Only an exact minimal-ending-only batch may use the hard-only closeout exception. Detailed endings and mixed ordinary batches remain soft-bounded; never relabel content as cleanup. For a bound session, also validate the exact next minimal envelope against History.Identify's encoding policy (no backend I/O), not only Session.Policy, so the end-to-end encodability claim is honest. Keep internal sizing contexts explicit rather than adding mutable global limits. A backend I/O failure is still possible: the guarantee is reserved encodability/admission, NOT guaranteed acceptance/durability.

Unknown append acceptance freezes the exact proposal/slot; no alternate response or ending until resolved/reloaded. A limit-shaped backend error is not known rejection. Apply/Load remain HARD-ONLY, without ordinary soft reservation for hypothetical future writes; loading never executes, retries or closes.

Immutable inspection and organization

Keep declarations/helpers/comments beside owning types; format owns schemas/local validation and generator roots. Extend RecordView typed accessors and child views using immutable handles, Count/At and iter.Seq for new ordered parts/items. View zero values, failure returns, ownership and out-of-range behavior follow existing conventions. Call ordinal views derive IDs from request scope and call order; never store redundant independently mutable IDs in every call DTO.

Use append-only positions for any needed request/run lookup. Do not retroactively fill outcome pointers in published request entries or mutate slice-prefix elements. Timeline inspection through Records and typed RequestID on outcomes suffices; do not add speculative outcome/provider-token maps or promise O(1) lookups without locators. If direct request lookup is added, follow UserInputByID and extend its architecture guard intentionally. Existing RunView.Records is a chronological span, NOT ownership filtering: idle context after an ending can remain in the preceding span until next run start. Keep that documented behavior.

Snapshot capture must remain O(1), old handles/sequences pinned after append/replacement/new outcome/ending/new run, and concurrent readers safe with caller-serialized owner operations. Preserve existing allocation guards; do not promise opaque iter.Seq composition free.

Implementation tasks (dependency ordered)

  1. Contract values and DTO slice. Add IDs, request/recipe, response/items/calls, opaque provider data, usage, invocation failure and unified ending values in owning files; document proposed enums, absence/zero/scope/ownership. Add corresponding format roots/local validators and bounded constructor size checks. Reuse ContentPart. For native source-head CID links, narrowly allow session/format→contentid in BOTH .golangci.yml and engine/arch/layering_test.go; never import history into format. Check remains algorithm-owned bytes. Review this coherent public Go/DTO surface BEFORE adding aggregate consumers. Completion: local validation/Clone/Equal/codec tests cover explicit zero/empty and malformed evidence without normalization. No temporary model-only API that drops calls.
  2. Shared source-aware transition rules. Extend copyable lifecycle scalars/context, provisional request allocation, context-after-created legality and coverage frontier. Introduce concrete request/outcome/ending batch operations; replace experimental Interrupt/RunInterrupted surface coherently (no compatibility shim). Apply identical source/candidate gates in add/preflight/evaluate. Completion: failed additions consume no ordinal/state; hand-crafted replay violations fail too. Focus existing metadata-versus-decoded oracle and new same-batch tests.
  3. Accepted publication and inspection. Extend acceptedRecord decode/metadata and closed dispatch, staged append-only locators, typed views and sequence traversal. Outcome references accepted request; no mutable outcome map. Completion: real Submit/Apply/Load yield identical inspectable request/response/failure/end histories, old snapshots pinned, new run IDs independent.
  4. Unified terminal reservation. Generalize actual ending preparation/reservation and exact minimal hard-only exception; include History encoding-policy check. Retain pending facts on endings and distinguish capturefailed. Completion: exact-fit/one-short tests for every minimal reason and next-envelope boundary; no detail/mixed-batch bypass; hard-only replay preserved.
  5. Interaction acceptance scenarios. Exercise all worked cases below through memory History and independently Apply/Load, with adversarial locally valid DTOs bypassing builder. Mutation/negative controls detect source-head, gate, scope, duplicate outcome, invalid clean end and alias regressions. Completion: no execution/host/config fixtures; observations preserve missing vs zero and representation-sensitive bytes.
  6. Generation and integrated verification. Run generation owning tasks; update both session API snapshots; extend architecture/constant-accessor guards as needed. Update owning Godoc and kernel README only if scope description materially changes; no design-history prose in architecture docs. Run focused/race/standalone, lint/API/codec freshness and final code review against implementation-start OID. Completion: clean integrated diff, no pins/production adapter changes, explicit test evidence.

Tasks 1–4 must land as one coherent final candidate; no partial publication using new schemas with old reducers or missing reservation. Direct-write tasks remain serial. Implementation was explicitly authorized after planning; commit/push/PR delivery was separately authorized after local implementation. Never merge as part of this workflow.

Observable acceptance / worked histories

  • Create + optional initial context in one commit; idle replacements accepted; absent root/catalog differ from explicit empty in views but require no host defaults; source without binding rejects request even if binding/start appears provisionally in same commit.
  • Accepted source → request → complete output response → completed ending. Output/reasoning/refusal/media order and empty items/parts/text survive exactly; one opaque envelope and optional zero usage survive.
  • Input A → request → outcome → input B → completed ending rejects. Invocation failure covering A can justify error ending without response. Empty effective contribution alone neither requires generation nor dirties coverage; nonempty duplicate/inline contributions do.
  • Input A → request1 → observed network failure (optional usage, delivery uncertain) → request2 RetryOf1 from new head/recipe → terminal response. Changed recipe parameters preserved; no actual constructor/retry runs. RetryOf foreign run/future/unknown rejects; retry correlation never edits request1.
  • Request→response and response→new request in same commit reject; prior accepted request→response+ending may batch. Context before/after request remains prospective relative to pinned source. Stale source sequence OR CID rejects atomically through all entry paths.
  • Tool-bearing terminal response interleaves content/calls and retains invalid JSON, empty/unknown names, repeated/missing provider tokens. Call ordinals count calls only. Further request/input/completed ending rejects; explicit uncertain ending leaves every call inspectably unresolved, with no synthetic results. Slice 4 is not simulated by fake dispositions.
  • Response then failure, failure then response, second identical/different response, duplicate ending and late outcome after ending reject without changing accepted state. Frozen-history-proposal retry after lost acknowledgment preserves EXACT proposal bytes/identity and does not allocate a new model request.
  • Empty/private-only terminal response accepted. Provider-declared terminal failure is response evidence; failed transport is separate failure, not invented response. Failure has no partial-body field. Unknown algorithm/provider-format/reason stays inspectable without execution or compatibility claim.
  • Oversized response/private envelope rejects whole. If small usage/correlation evidence fits ordinary bounds, capturefailed ending retains it through CaptureFailureEvidence while the request remains unresolved; foreign/nonpending references reject. If the detailed ending itself cannot fit, known local rejection permits a fresh minimal capturefailed ending with no evidence or detail (uncertain acceptance does NOT). No response items or stripped private envelope become accepted in either path. Many requested calls do not increase minimal-ending payload size. Test reason/envelope integer-width boundaries, per-payload/node/collection/work bounds, no detail/evidence cleanup bypass, tighter History policy, and failed append uncertainty (cannot switch proposals).
  • Mutate constructor inputs/DTO exports/usage pointers/private bytes/argument bytes after capture; accepted views unchanged. Late outcome/context/end/new-run appends cannot alter old snapshots or stored sequences. Race readers of pinned views while owner appends.
  • Bounds and sequence overflow fail before allocations/ordinal publication; unsupported record kind/version fails closed. No regression to file-less/offline tests, no provider/network/ambient user state.

Verification and delivery boundary

Use real offline memory History/adapters and explicit policies. Preserve existing tests; extend owning suites rather than remove prior allocation/identity guards. No tests ran for this future implementation during planning.

From root: task generate:codecs; task generate:codecs:check; task api:update; task api:check; task lint. From engine: go test -race ./id ./kernel/... ./arch ./adapter/history/...; GOWORK=off go test ./kernel/... ./arch ./adapter/history/.... Add focused repeated source/ending/ownership tests, 386 checks for ordinal/count conversions, and constructor/decode fuzz seeds for new union/envelope/usage schemas. Benchmark representative direct complete new-view traversals across independent count/payload axes; preserve zero-copy direct navigation and intentional byte-export controls.

This remains isolated engine work: scoped engine guidance permits focused tests rather than whole-repository test/test:race. Broaden if implementation crosses integration boundaries. Complete Go suite targets get 1800s outer timeout; other full gates 600s. If Markdown changes, task docs. Generated files only via task, not hand editing. No API changelog/compatibility-note bookkeeping under experimental kernel waiver. New stored kinds/replaced ending schema deliberately do not support old experimental data; no migration shim. No current wire behavior or major/features change because no production/remote consumers are wired; reassess BEFORE crossing that boundary.

When implementation begins, create/resume impl/kernel-model-interactions from actual clean main after branch/remote/worktree preflight; record its FULL start OID then (do not substitute today's planning baseline). Initial code panel-review fixed point is that recorded implementation start. Capture full final-tree diff/new files; fixes get targeted incremental recheck. Rebase, commit, push or PR creation require their own authority. When a new implementation PR is authorized, publish the latest safe full plan in one identifiable plan comment and verify readback; do not rewrite #2725's historical plan comment.

Readiness and remaining risks

No unanswered semantic interview question is intentionally left open. Exact Go names/CBOR keys/closed reason values and conservative internal indexes are task-1 concrete contract work, not a license to revisit decisions. If surface review reveals a material behavior gap, stop and ask rather than silently expanding scope.

Highest risks: source vs provisional state, coverage vs actual composition, a failure outcome falsely claiming no remote spend, response/provider relation loss, mutable accepted-prefix outcome indexes, and hard-only ending bypass. The worked tests directly target them. This plan does not prove runtime behavior; passing planning critique is not implementation authorization or PR-wide readiness.

jbeda and others added 3 commits November 7, 2026 13:58
Make session occurrence identities opaque and nonconvertible across kinds,
align identity reference naming, and preserve numeric identity wire bytes.
Use bounded string ending reasons, combine cancellation with interruption,
and retain actual worst-case minimal-ending reservation.

Clarify provider stop reasons and provisional evidence contracts, organize
DTOs by record ownership, and strengthen kernel standards and panel review.

Co-authored-by: Mecatl <[email protected]>
Share complete immutable backing between proposals and accepted views, internalize low-level reconstruction, and consolidate batch authoring inputs. Preserve lifecycle and storage contracts, adapt regression tests, and capture the future extension-record direction.

Co-authored-by: Mecatl <[email protected]>
Fix the strict documentation dead-end finding without weakening graph checks.

Co-authored-by: Mecatl <[email protected]>
Retain materialized records directly and validate typed identity scope before DTO conversion. Complete immutable nested inspection views and document admission ownership and lifecycle rationale.

Exercise complete scalar traversal and field-only byte exports through Submit and Load, including presence, aliasing, allocation, and pinned-reader coverage.

API compatibility: no wire, schema, canonical format, or production behavior changes. Experimental kernel getter signatures intentionally change to views.

Co-authored-by: Mecatl <[email protected]>
@jbeda
jbeda merged commit 8c1276a into main Nov 8, 2026
46 checks passed
@jbeda
jbeda deleted the impl/kernel-model-interactions branch November 8, 2026 02:19
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant