Document consumer-owned execution observation and its architecture decision

This commit is contained in:
2026-11-23 02:48:37 +00:00
parent 00fc11360e
commit 9825ee75fd
8 changed files with 110 additions and 20 deletions

View File

@@ -1,6 +1,8 @@
# ADR-0024: Publish artifacts with native reports and debug evidence
**Status:** Accepted
**Status:** Accepted; the requirement for one native invocation ExecutionGroup is
partially superseded by [ADR-0025](0025-use-consumer-owned-execution-observation.md).
All other decisions remain accepted.
**Date:** 2026-11-22
## Context

View File

@@ -0,0 +1,49 @@
# ADR-0025: Use consumer-owned execution observation
**Status:** Accepted
**Date:** 2026-11-22
## Context
Native contextual observation now reaches initial, prepared, coordinated, nested,
and concurrent execution without application request-option forwarding.
ckprompt supplies optional invocation reporting; requested debug capture needs
its own native snapshot. The runner is not a consumer of invocation accounting.
## Decision
Each interested consumer attaches native observation through its execution
context. ckprompt owns optional reporting. The CLI owns a debug group only when
capture is enabled, writes its snapshot before capture finalization after joined
work, and preserves publication-aware capture failures. Other callers own their
observers and inspect them when their work finishes.
The runner propagates the supplied context without a group input, unconditional
group allocation, or general observer forwarding through execution options.
Per-request capture observers and preparation hooks retain operation evidence
independently of invocation accounting.
Independent native groups may observe the same work. Do not add their overlapping
totals or introduce shared-group discovery or an application accounting service.
Preserve native IDs, terminal coverage, and unknown-versus-zero facts; cache hits
contribute no historical executions or usage.
This supersedes only [ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md)'s
requirement for one invocation ExecutionGroup. Its artifact, report, capture,
failure, sensitive-data, and remaining native-accounting decisions remain in force.
There is no required count of consumers or groups.
## Alternatives considered
- Keep runner-owned accounting and forward observers through requests. Native
context already supplies the mechanism; the runner does not use the totals.
- Discover and share one group between consumers. This adds ownership machinery
without a demonstrated need; independent native groups are sufficient.
## Consequences
Optional reporting and requested debug evidence coexist without a second
application ledger. No-flag execution needs no application accounting group.
CLI publication/finalization and primary causes remain application-owned.
No configuration version, prompt/model choice, artifact, cache, assessment,
worker/admission, budget, or completion-report contract changes.

View File

@@ -92,17 +92,19 @@ Framework/model code transports it rather than deriving another session.
[pipeline_run.go](../../internal/cli/pipeline_run.go) performs the ordered handoff:
1. Load/validate the selected application result and derive runtime configuration.
2. Generate a safe run identity and allocate requested capture.
2. Generate a safe run identity and allocate requested capture. If enabled,
attach its local native execution group to the inherited invocation context.
3. Capture selected configuration, compose registries, expand reference actions,
and resolve the effective pipeline.
4. Obtain the shared engine when needed and perform offline preflight.
5. Materialize references, construct prepared typed modules, read input bytes,
and resolve the effective session.
6. Construct the accepted-result cache and optional recorder collaborator,
create one native execution group, and invoke the runner with independent
worker and execution selections.
and invoke the runner with the context and independent worker/execution
selections. Disabled capture adds no debug group.
7. Report process diagnostics, publish returned logical files only after runner
success, finalize requested capture, then submit the native completion report.
success, write the debug group's snapshot immediately before capture
finalization, then submit the native completion report.
Modules receive the shared engine, operation data, and explicit collaborators,
not physical roots or CommandKit reporters. Detailed worker, assessment,
@@ -110,6 +112,8 @@ eligibility, and cache algorithms belong in [Pipeline Internals](pipeline.md);
physical publication/capture collaborators belong in [Run State Internals](state.md).
Requested capture allocates before engine/preflight and finalizes once.
The runner has joined its work before returning; it owns neither this group nor
the summary write. Snapshot write errors use the recorder's sticky error handling.
Primary operation causes and additional capture failures remain available.
Later report delivery failure does not rerun model work, remove valid artifacts,
or terminalize capture again.
@@ -121,6 +125,12 @@ value with a native text template. Native serializers render that same value.
Domain files, not a persisted report or ledger, are the deliverables.
Fallback qualification is independent of optional diagnostic visibility.
The installed ckprompt feature owns optional invocation usage presentation.
The handler preserves its contextual observer, including when debug attaches
an independent group; it does not add overlapping totals or supply a final usage
callback. See [native usage reporting][usage] and
[consumer-owned observation](../adr/0025-use-consumer-owned-execution-observation.md).
Warnings/advisories keep their domain classification and use the reporter's
diagnostic channel. Outcome helpers retain native configuration/preflight causes
and distinguish identifiable invalid input from operational/mixed failures.
@@ -154,4 +164,5 @@ behavior. There is no universal Notarius envelope or parallel serializer.
Use focused CLI tests and pair with configuration/preflight tests when those
boundaries change. [Development](../development.md#validation) owns wider checks.
[native-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.7.0/docs/cli.md
[native-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md
[usage]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting

View File

@@ -139,10 +139,14 @@ handle lifetime and admission behavior.
## Native Evidence And Sensitive Data
The runner supplies one invocation execution group. Actual initial, continuation,
and nested validator executions enroll once; group observations preserve native
identity, terminal coverage, and unknown usage without copied totals or a
durable profile inventory.
Execution carries the caller's context through producers, prepared misses,
coordination, validators, and workers. The runner owns no invocation group or
observer forwarding option. ckprompt owns optional reporting; requested CLI
capture independently attaches a debug group and retains it for finalization.
Other callers may attach their own native observer. See the
[native observation contract][observations] and
[ownership decision](../adr/0025-use-consumer-owned-execution-observation.md);
do not add overlapping totals or a durable profile inventory.
[Native capture](../../internal/framework/pipeline/native_capture.go) composes
observers/preparation callbacks rather than replacing them. Retain prepared
@@ -181,6 +185,7 @@ override propagation, cancellation/admission, reuse, and evidence. They do not
claim production model quality. Wider checks belong in
[Development](../development.md#validation).
[consumer]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/docs/consumers/pkg-promptkit.md
[formats]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/docs/formats.md
[prepared]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/docs/consumers/pkg-promptkit.md#prepare-now-and-execute-the-same-snapshot-later
[consumer]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md
[formats]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md
[prepared]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#prepare-now-and-execute-the-same-snapshot-later
[observations]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#observe-an-ordinary-run

View File

@@ -171,8 +171,10 @@ It does not choose a directory, publish a report, or serialize execution ledgers
[State Internals](state.md) owns physical publication and failure retention.
Optional scoped evidence records inputs, candidates, findings, outcomes, and
cache decisions. Native observers enroll actual executions once in one invocation
group, preserving unknown usage and terminal coverage. Capture failures are
cache decisions. Workers and native calls preserve the supplied context, including
consumer-owned observers. The runner allocates no invocation group or accounting
summary; [CLI internals](cli.md#run-orchestration) owns optional debug grouping
and ckprompt reporting integration. Capture failures are
ordinary boundary failures, never semantic feedback or reasons to rerun a model.
Debug layout is private; it is not a recovery source or consumer protocol.

View File

@@ -153,9 +153,15 @@ results, raw response text, and full readable exchanges. Events are written
incrementally. Scope includes operation/step/lane/chunk/validator identity to
avoid concurrent evidence collisions.
One invocation `ExecutionGroup` enrolls actual initial, continuation, and nested
validator executions once. Native identity, terminal coverage, and unknown usage
remain native facts, not a copied profile/attempt accounting model.
When capture is enabled, the CLI attaches its own native execution group to
the inherited invocation context after allocation. Its finish path writes one
snapshot immediately before `Finalize`, after runner work has joined and any
successful domain publication. Snapshot errors remain sticky capture failures.
The runner owns no group or summary write. ckprompt's optional reporting group
is independent; overlapping totals are never added. See
[consumer-owned observation](../adr/0025-use-consumer-owned-execution-observation.md)
and the [native contract](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#observe-an-ordinary-run).
Native identity, terminal coverage, and unknown usage remain native facts.
Hits can retain prepared evidence without execution or usage. Result-less failures
retain availability/cause evidence; undelivered responses are explicitly unassessed.

View File

@@ -338,8 +338,13 @@ leave partial stdout and valid published artifacts; retain those artifacts,
useful locations, and distinct operation/delivery causes without model retries.
Exact report fields and outcomes belong in [CLI Reference](../cli.md).
One native execution group records actual initial, continuation, and nested
validator executions once. Preserve identity, terminal coverage, and
Interested consumers own native contextual observation: ckprompt owns optional
reporting, the CLI owns requested debug grouping, and other callers attach their
own observers or groups. The runner propagates context without owning invocation
accounting. Independent groups need no shared discovery or application totals
service; their overlapping totals are not additive. See
[ADR-0025](../adr/0025-use-consumer-owned-execution-observation.md).
Preserve identity, terminal coverage, and
unknown-versus-zero usage without synthetic IDs, copied totals, or historical
execution claims on cache hits.

View File

@@ -330,6 +330,16 @@ URLs/credentials to confirm all calls stay local.
## Stage 6 — Align Architecture, The ADR, And Internal Ownership Docs
**Status:** Complete. Added ADR-0025 for consumer-owned contextual observation
and narrowly updated ADR-0024's status; its accepted body is unchanged. Replaced
the architecture group-count clause and aligned CLI/LLM/pipeline/state ownership
with conditional CLI capture, inherited context, native optional reporting, and
publication-aware finalization. Native mechanics link to selected upstream
contracts. Policy provenance and its current implementation-date metadata are
retained. All 178 local links in the seven affected documents resolve; selected
upstream anchors, stale ownership searches, ADR status-only diff, and whitespace
pass. Reused passing runtime checks for unchanged code.
**Goal:** Record the implemented ownership change without rewriting accepted
history or preserving a redundant exact-one-group requirement.