Plan correction repair implementation

This commit is contained in:
2026-11-11 04:00:47 +00:00
parent b036336e2a
commit 93a080059d
2 changed files with 372 additions and 63 deletions

View File

@@ -2,11 +2,8 @@
**Updated:** 2026-11-11
**Status:** Feature direction and all six decisions accepted; implementation
pending. No open feature decisions remain. Configuration names, concrete schema
fields, and adapter details remain implementation-planning work. This document
owns the target and remaining work, not a release date or implementation status
for the completed library adoption.
**Status:** Feature direction and all six decisions accepted. Implementation
is pending. See the [implementation plan](implementation.md).
## Objective
@@ -132,8 +129,7 @@ Use a structured response that distinguishes revision from withdrawal and carrie
the requested proposal reference. A revision contains the correction data needed
by the existing validators. Empty replacement text remains a possible span
deletion; it must not double as a withdrawal signal. The response schema owns
shape validation; Audita owns correspondence and domain acceptance. Exact field
names can be selected with the schema implementation.
shape validation. Audita owns correspondence and domain acceptance.
### Validator-Owned Feedback
@@ -168,12 +164,8 @@ request commands expose the configured prompt assets through their normal APIs.
PromptKit already supports
[appending rendered assistant and corrective messages](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/171fb11f4e967a1da3af57843c6467954b14ba09/docs/consumers/pkg-promptkit.md#append-already-rendered-messages).
Use its public preparation and execution APIs to render the module repair
definition and assemble the intended conversation. Appended messages are already
rendered; appending template text alone will not expand its variables. Confirm
the full-history path and per-call response-schema selection with a focused
integration example before settling adapter details. If that exposes a genuine
upstream gap, document a small reproducer and request focused support rather than
introducing another renderer or provider client.
definition and assemble the intended conversation from rendered messages. Use
its per-call schema selection for the revision contract.
Maintain the existing distinctions between recoverable model-operation failures,
fatal application/invariant failures, and cancellation. Domain revision attempts
@@ -182,52 +174,6 @@ structural repairs; account for these separately. Share existing backend admissi
and cancellation instead of adding a repair-specific global concurrency limiter.
Use the accepted [reporting scope](#ordinary-reports-and-attempt-history).
## Work From the Baseline
1. **Prove the request path.** Exercise native message composition with an
original multi-proposal response, a rendered module repair instruction, a
revision response schema, and a subsequent branch turn. Confirm operator
prompt replacements and the same behavior with debug disabled.
2. **Carry conversation state through the existing boundaries.** Extend
`framework/structuredoutput`, the LLM adapter, proposal-generation results,
and module/framework contracts as needed to retain and replay the original
request and full response. Preserve source-reference mapping and metadata.
Use compact lineage data and shared immutable initial context where practical;
no particular storage layout or new package hierarchy is prescribed.
3. **Add module repair assets and the response schema.** Extend the prompt
registry, embedded definitions, shared fragments where useful, and
`framework/responseschema`. Provide revision/withdrawal decoding and
correspondence checks without changing ordinary span-deletion semantics.
4. **Adapt feedback collection.** Update validator findings where their current
messages are insufficient for repair. When repair is enabled, collect the
agreed applicable findings and distinguish failures, unavailable decisions,
and checks that could not run. With an effective budget of zero, use the
existing validator filtering. Keep complete validation mandatory for approval.
5. **Implement the bounded branch loop.** Integrate revision calls and full
revalidation into the current stage/section flow. Preserve accepted proposals,
branch isolation, deterministic application, cancellation, and existing
apply-time checks. Unsuccessful branches must not discard unrelated accepted
work. This does not require redesigning stage barriers or chunk scheduling.
6. **Wire configuration and readiness.** Add the accepted
[budget](#semantic-repair-budget-and-configuration-scope)
and [profile](#repair-execution-profile) settings with native presence and stage
inheritance. Keep semantic attempts distinct from structural
`llm.repair_attempts`. Preflight checks any additional required role/prompt
readiness when enabled, without making disabled repair require an unused
profile. Let existing inspection expose resolved settings.
7. **Extend outcomes and documentation.** Implement the accepted reporting scope
through ordinary reporting, correction ledgers, and optional redacted debug
artifacts. Update
the canonical [configuration](../config.md), [pipeline](../internal/pipeline.md),
[module](../internal/modules.md), [validator](../internal/validators.md),
[prompt](../internal/prompts.md), [runtime](../internal/llm-runtime.md), and
[output](../integrations/output-files.md) documentation when behavior lands.
Record significant ownership decisions through the documentation policy's
ADR process if warranted; routine API and template choices need no ADR.
These are work dependencies for later implementation planning. They do not
mandate separate commits, a general workflow engine, or a new release process.
## Acceptance and Completion
Use controlled model responses and real loading/rendering at integration
@@ -287,8 +233,6 @@ the operator configures more attempts. Use a distinct setting from structural
Retain existing per-call timeouts and parent cancellation, and document that
each semantic attempt may include transport retries and structural repairs.
This provides useful feedback-driven revision with a simple finite bound.
The default and scope are accepted; exact configuration names remain an
implementation-planning choice.
### Provider Request Limits
@@ -337,8 +281,6 @@ operational errors and recoveries through the existing report framework and keep
the current exit-status policy.
Editorial rejection and voluntary withdrawal are correction outcomes. Keep
conversation text and per-attempt details in optional redacted debug artifacts.
Choose the report location, fields, and any schema version change during
implementation planning.
### Revising the Span or Target Reference