From b20ef9d4b9b96c4782a040438c4f3e9ba25cd6d0 Mon Sep 17 00:00:00 2001 From: vypbot Date: Sun, 8 Nov 2026 21:48:58 +0100 Subject: [PATCH 1/3] docs(sdd): specify issue contract in specs/final-progress-completion-recovery.md --- specs/final-progress-completion-recovery.md | 228 ++++++++++++++++++++ 1 file changed, 228 insertions(+) diff --git a/specs/final-progress-completion-recovery.md b/specs/final-progress-completion-recovery.md index b4242f4c4..171da6b45 100644 --- a/specs/final-progress-completion-recovery.md +++ b/specs/final-progress-completion-recovery.md @@ -676,3 +676,231 @@ completion. These #937 gates remain pending until independently recorded. - Related specs/ADRs/issues/PRs: `specs/immutable-progress-content-recovery.md`, `specs/complete-progress-comparison-inventory.md`, and `specs/progress-scope-source-ownership.md`; prerequisite #833/#830 and extension H3 #704 remain separate. - Decisions and rejected alternatives: exactly one replacement rather than a general retry; closed counts rather than raw output; retain strict parsing rather than normalize percentages; unchanged model/configuration/limits/permissions; no new absolute deadline port; no automatic write replay. Reject forcing 100 from previous statuses, dropping uncertain requirements or sources, accepting provider errors as completed output, increasing capacities, adding a third query, caching partial evidence, weakening approval, or treating model claims as execution proof. - Follow-up work explicitly outside this spec: broader progress-planning improvements, #830 partition-length recovery, extension implementation, release and deployment. This spec includes implementation and its full CI/coverage/review acceptance; adoption into the master-pinned runtime is a separately reviewed operator transition. The reported parser/graph consistency at `3e7ceea` and catalog snapshot `9abb7882` establishes planning consistency only, not implementation or acceptance. + +## Proposed change: Repeated native citations pass the assessment schema then abort same head progress + +- Status: Draft +- Catalog capability: github-communication-experience + +### 1. Executive summary + +This delta extends the retained final progress recovery contract to repeated citations in an otherwise valid, attributable progress response. The host will permit one complete correction under the existing allowance shared with length and completion recovery. Acceptance still requires distinct admitted source references, complete requirement coverage, exact identities, unchanged response and call/time bounds, and the existing final publication gates. If repeated citations remain after the allowance is used, progress stays unpublished and the operation returns a precise, content-free, nonretryable diagnostic. + +```text +validate complete batch -> distinct admitted citations -> existing publication gates + -> repeated citations -> one shared complete correction + -> valid distinct citations -> existing gates + -> repeat or other invalid evidence -> retain prior progress; stop +``` + +Text equivalent: only a complete response with distinct valid citations proceeds to existing gates; one repeated-citation correction may use the shared allowance, and failure retains prior progress. + +### 2. Problem, current behavior, and evidence + +#### 2.1 Problem + +Issue [#944](https://github.com/vypdev/copilot/issues/944) reports that repeated native citations can pass the assessment schema and then abort same-head progress at evidence validation. This creates a mismatch between wire-level acceptance and receipt-level acceptance. The reported run retained existing progress, as required, but could not complete acceptance batch 1 of 4. The original native response was not retained; repetition is an inference from the failure path, not a raw citation capture. The issue reports a deterministic synthetic counterexample and a unique-citation control, but those issue-provided results are not independent evidence from this selected source view. + +#### 2.2 Current behavior in the selected source + +1. `src/application/policies/progress_batch_policy.ts` builds `progressBatchResponseSchema` with citations as an array of 1–8 strings selected from admitted non-generated evidence IDs. The schema does not declare uniqueness. +2. `src/data/repository/agent_json_schema_validator.ts` checks array bounds and each item against its schema; it contains no distinct-item check. Therefore schema validation alone permits repeats. +3. `readProgressAssessmentEvidence` in `src/application/policies/progress_batch_policy.ts` requires citation arrays to contain distinct IDs and rejects repetition with `evidence-missing`. It also checks each reference exists, belongs to the current head, and is not generated. `parseProgressAssessmentReceipt` uses that evidence reader before producing a receipt. +4. `src/application/usecases/actions/progress_batch_workflow.ts` submits each batch, reads and parses its evidence, and converts the retained-batch rejection to the existing batch diagnostic. The selected implementation shown here has no repeated-citation correction at this boundary. + +The compact profile is decoded by `decodeCompactProgressAssessment` in `src/application/policies/progress_compact_assessment_policy.ts`; it maps closed assessment codes to canonical fields and retains response identity fields. The selected sources do not establish that the reported native output was captured or that this issue’s counterexample was run against this revision. The issue states both prose and closed-fact profiles preserve citation arrays; verify that behavior in implementation tests before treating it as established for this revision. + +#### 2.3 Evidence and limits + +The selected source directly establishes the schema/receipt uniqueness mismatch and the evidence checks described above. The issue reports a native failure at requirement R63, acceptance batch 1 of 4, with `validation.evidence-unavailable`, reason `evidence-missing`, and prior progress retained. It also reports that a valid unique-citation control succeeds. These are incident assertions; the original response is unavailable, so exact citations and the cause in that native response remain unverified. No conclusion about a quota failure is supported by the report. The selected owner `specs/final-progress-completion-recovery.md` already specifies a single shared correction allowance for eligible final assessment failures; this delta adds repeated citations to its scope without replacing its retained requirements or cases. The neighboring evidence, scope, batching, and capacity owners remain authoritative for their existing contracts. + +### 3. Actors, surfaces, and terminology + +The affected actors and surfaces remain those in the retained owner `specs/final-progress-completion-recovery.md`: the issue author supplies progress scope, the configured model returns assessments, the host workflow validates and controls publication, and maintainers inspect a failed run and decide whether a fresh assessment is appropriate. + +For this delta, a **citation** is an admitted source reference attached to a requirement assessment. **Distinct citations** contain no repeated reference within that assessment. A **complete correction** is one replacement response for the entire frozen batch, using the same head, manifest, requirement identities, admitted evidence, and profile. The model supplies response data; the host owns identity, evidence admission, uniqueness validation, recovery eligibility, and publication authority. + +The observable outcome remains in existing CLI/API errors, Check, Job Summary, and progress publication surfaces. A terminal repeated-citation failure must identify the affected requirement and batch through the existing safe diagnostic conventions, without exposing model prose or raw response content. Existing locale handling and user-facing content conventions remain in force. + +### 4. Goals, non-goals, and fixed invariants + +#### 4.1 Goals + +- **SDD-I944-U1-R1:** Accept only distinct citations in an otherwise valid, attributable progress response. A repeated-citation response may use the existing single complete-batch correction allowance shared with length and completion recovery. Preserve every requirement, distinct admitted source reference, identity, response bound, the 120-call/30-minute ceiling, and the final publication gate. If repetition remains after the shared allowance is consumed, return a precise content-free nonretryable diagnostic. Do not silently deduplicate output, invent citations, accept invalid receipts, add an allowance, weaken coverage, or rerun unchanged heads until green. +- **SDD-I944-U1-R2:** Keep missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence blocking publication. Retain complete frozen batches and never publish partial progress. + +#### 4.2 Non-goals + +- Changing source collection, scope ownership, batching, assessment semantics, publication, or any owning contract outside the repeated-citation recovery delta. +- Replacing or re-running the reported failed native operation to obtain a green status; changing the published artifact; or authorizing a release or deployment. +- Adding configurable or additional retries, increasing limits, expanding permissions, weakening evidence validation, or deduplicating model output automatically. + +#### 4.3 Fixed product and safety invariants + +- Citation uniqueness is a validation condition for every accepted response, regardless of prose or closed-fact wire profile. Correction must produce distinct admitted citations; the host must not repair the array by deduplication or fabricate evidence. +- The shared allowance is consumed at most once per complete batch across repeated-citation, length, and completion recovery. Exhaustion is terminal and nonretryable; no unchanged-head loop is permitted. +- All original requirement coverage, batch and head identities, manifest binding, freshness, evidence admission, capacity, response bounds, 120-call/30-minute ceilings, complete frozen-batch behavior, and final publication gates remain unchanged. +- Any missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence continues to block publication. Previous progress is retained until every required batch passes all existing gates; no partial progress is published. + +| Requirement | Behavior | +| --- | --- | +| SDD-I944-U1-R1 | Accept only distinct citations in an otherwise valid, attributable progress response; recover repeated citations using the existing single complete-batch correction allowance shared with length/completion recovery, preserving every requirement, distinct admitted source reference, identity, response bound, 120-call/30-minute ceiling, and final publication gate. A repeated citation after that shared allowance is consumed produces a precise content-free, nonretryable diagnostic. Do not silently deduplicate output, invent citations, accept invalid receipts, add an allowance, weaken coverage, or rerun unchanged heads until green. | +| SDD-I944-U1-R2 | Keep missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence blocking publication; retain complete frozen batches and do not partially publish progress. | + +### 5. Current versus proposed product journey + +#### 5. Current versus proposed product journey + +The immutable owner, `specs/final-progress-completion-recovery.md`, already defines complete-batch assessment, one shared correction allowance for eligible completion and length failures, and publication only after complete validation and freshness checks. This update adds repeated citations to that recovery boundary. In the affected flow, the response schema admits citation arrays with one to eight entries, while receipt validation requires distinct citations. A duplicate therefore can pass adapter schema validation and fail later as missing evidence; the consumer retains prior progress and receives a nonretryable error. The issue report’s native response was not retained, so the reported repetition remains inferred; its deterministic schema/receipt counterexample is separate evidence. + +Proposed journey: assess the complete assigned batch with its original identities and evidence references; if citations repeat but the response is otherwise valid and attributable, use the existing single complete-batch correction allowance, shared with length/completion recovery. Validate the correction against the same scope and publication gates. A valid unique-citation result continues through existing freshness and publication checks. A unique-citation response on the first attempt follows the current path without correction. If the allowance has already been spent, stop with a precise, content-free, nonretryable diagnostic and retain previously published progress. At no point may the host silently remove duplicates, infer or invent evidence, publish a partial batch, or retry unchanged heads until green. + +For operators, a blocked result should communicate the impact, cause, next action, then retained state: “Progress was not updated. The complete assessment did not verify distinct source citations for requirement R63, batch 1. Review the cited evidence and run a corrected assessment. Existing progress was retained.” Keep the requirement and batch details within the existing safe diagnostic projection; do not expose rejected response text or unverified references. A successful correction uses the existing completion and publication surfaces without an extra comment or notification. Existing locale selection and fallback remain in force. + +### 6. Functional behavior and state model + +#### 6. Functional behavior and state model + +This delta applies to both existing response profiles: narrative and closed-fact. The response must first satisfy its applicable schema, exact scope and batch identities, requirement coverage, locale, and all non-citation receipt checks. Citation admission then requires at least one citation per requirement, no repeated citation within a requirement, and every citation to identify admitted, non-generated evidence pinned to the current head. Each requirement and its citation set remain bound to the same complete frozen batch. + +A repeated citation in an otherwise valid, attributable response is an eligible correction trigger under the existing single complete-batch allowance. The replacement repeats the complete assigned batch and preserves every requirement, identity, distinct admitted source reference, response bound, and the original final publication gate. It may not normalize the rejected citation array by deduplication or carry rejected prose forward. A unique-citation response is accepted without correction. When completion or length recovery has already consumed the allowance, a subsequent repeated-citation failure is terminal: report a precise content-free, nonretryable diagnostic, retain existing progress, and do not issue another query for unchanged heads. Mixed repeated-citation and length/completion failures consume that same one allowance, never a second one. + +Missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence remains blocking and does not become eligible merely because citations are repeated. Preserve the existing complete frozen batches and discard provisional results if any batch or final gate fails; never partially publish. Keep the existing 120-call and 30-minute ceilings, and do not reset the attempt ledger for correction. Freshness, approval, and final publication behavior remain owned by the immutable owner and its existing contracts. + +The relevant current boundary is visible in `src/application/policies/progress_batch_policy.ts`: `progressBatchResponseSchema` bounds citation arrays to 1–8 admitted IDs, and `readProgressAssessmentEvidence` rejects duplicates and checks evidence identity before `parseProgressAssessmentReceipt` constructs a receipt. `src/application/usecases/actions/progress_batch_workflow.ts` owns complete-batch assessment and receipt aggregation; `src/application/usecases/actions/query_progress_assessment_workflow.ts` owns assessment-query correction. The update must connect the otherwise-valid duplicate failure to that shared bounded correction path without weakening receipt validation. + +### 7. User-facing configuration + +#### 7. User-facing configuration + +No new user-facing configuration is introduced. The correction allowance remains fixed at one per assessment invocation and is shared with existing eligible length/completion recovery; it is not configurable. Citation distinctness, evidence admission, complete-batch preservation, freshness checks, response bounds, the 120-call/30-minute ceilings, and the final publication gate are fixed correctness constraints. + +Use the existing provider, model, effort, locale, and invocation snapshot rules. Locale changes presentation only; it does not alter citation validation, evidence identity, or recovery eligibility. No persisted recovery state or migration is added. A new invocation follows the existing fresh-invocation behavior and must collect and validate its own complete evidence. + +### 8. Clean Architecture design + +#### 8. Clean Architecture design + +Keep the rule that citations are distinct and admitted as pure receipt-validation policy in `src/application/policies/progress_batch_policy.ts`. That policy owns citation identity checks against the immutable manifest and head; the response schema remains an adapter-facing shape constraint and must not be treated as proof that citation content is semantically valid. Preserve the existing distinction between response-schema validation in `src/data/repository/agent_json_schema_validator.ts` and host receipt validation in the application policy. + +The application workflow owns the one shared correction allowance and may spend it only when the complete response is otherwise attributable and valid apart from repeated citations. Reuse the existing assessment-query recovery boundary in `src/application/usecases/actions/query_progress_assessment_workflow.ts` and the batch orchestration in `src/application/usecases/actions/progress_batch_workflow.ts`. Keep provider adapters responsible for parsing and mapping responses; they must not deduplicate citations or decide recovery eligibility. Keep publication and freshness decisions with their existing owners. No provider-specific DTO, durable retry state, extra port, or new configuration is required. + +On correction, revalidate the complete response and every receipt from the beginning. Any invalid or stale evidence, incomplete batch, consumed allowance, or exhausted global bound returns a safe terminal failure and retains the prior published progress. Diagnostics expose only the existing closed safe facts, such as requirement and batch identity where host-verified; never log or publish rejected response content, arbitrary citation strings, or unverified identifiers. + +### 9. UI/UX and content contract + +#### 9.1 Information hierarchy + +For this delta, show the current batch status first, then that prior progress and complete frozen batches are retained, whether the one shared correction is running or exhausted, the next action, and sanitized diagnostic facts. Keep existing progress surfaces and publication behavior from the immutable owner `specs/final-progress-completion-recovery.md`. + +#### 9.2 Citation-specific content + +When an otherwise valid, attributable response repeats a citation, use the existing shared complete-batch correction allowance. While it runs, state that the complete batch is being reassessed and prior progress is retained. On success, report progress only after distinct admitted citations and all existing validation and publication gates pass. If the allowance is already consumed, state that progress was not published, identify the affected requirement and batch using host-verified identifiers, and give the precise nonretryable diagnostic. Tell the operator to inspect the run and qualify a corrected response before a fresh full assessment; do not recommend an unchanged-head retry loop. + +A response with unique admitted citations continues without correction. Do not expose rejected model prose or render it as Markdown. Keep existing locale, accessibility, responsive, and surface conventions; the diagnostic must remain understandable without color and preserve the same closed facts across supported locale rendering and fallback. + +#### 9.3 Existing interaction contract + +Create no new issue, PR, comment, label, Check, card, permission, or interactive control. Retain existing links, markers, titles, and notification budgets. Do not publish any part of a frozen batch while citation recovery is underway. + +### 10. Failure, recovery, and cleanup + +| Failure or state | User impact and retained facts | Recovery and action | +|---|---|---| +| Otherwise valid attributable response contains repeated citations and the shared correction allowance remains | No new progress is published; prior progress and complete frozen batches remain intact | Make exactly one complete same-batch correction using the existing allowance, preserving requirements, distinct admitted source references, identities, response bounds, the 120-call/30-minute ceilings, and the final publication gate. | +| Repeated citations occur after the shared correction allowance is consumed, including after length/completion recovery used it | Progress remains unpublished; prior progress and frozen batches remain intact | Return a precise, content-free, nonretryable diagnostic. Do not silently deduplicate, invent citations, add an allowance, or rerun unchanged heads. | +| Citation correction still contains repeats or another validation failure | No progress is published; retain the prior state and complete frozen batches | Do not make a third query. Report the failure through the existing safe diagnostic behavior. | +| Evidence is missing, foreign, generated, stale, malformed, forged, or otherwise invalid | Publication remains blocked; no partial batch is published | Preserve existing evidence-validation failure behavior; citation recovery does not make invalid evidence eligible. | + +Errors state impact, cause, action, and retained state in that order. Discard rejected payloads under the existing cleanup rules. A correction must be complete; partial batch results are never published. + +### 11. Security, permissions, and privacy + +1. Add no credentials, network authority, write capability, permission, or model-call allowance. Citation correction is bounded by the existing shared single complete-batch allowance and the existing 120-call/30-minute ceilings. +2. Permit correction only when the response is otherwise valid and attributable to the current complete frozen batch. Repeated citation values are invalid; the host must not normalize them by silently deduplicating. Accept only distinct references admitted by the existing evidence and receipt checks. +3. Preserve all existing evidence fences. Missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence remains blocking and cannot be repaired by citation correction. Keep requirement coverage, identities, response bounds, and final publication gates unchanged. +4. Do not expose raw response content, arbitrary citations, private prose, or unverified identifiers in diagnostics. Exhaustion diagnostics contain only the closed, host-verified facts needed to identify the affected requirement and batch and explain the nonretryable failure. +5. Model output cannot establish evidence validity or authorize publication. Publish only after the entire frozen batch passes the existing checks. + +### 12. Observability and operational UX + +Retain existing progress and emit no partial-publication signal for an incomplete or rejected batch. When correction is used, report only the fixed recovery status and closed, host-verified identifiers or facts needed to diagnose the result. When the shared allowance is exhausted, report a precise content-free nonretryable diagnostic and make clear that prior progress was retained. Do not log or retain rejected model prose, add telemetry payloads, or introduce provider retries. Existing run links, correlation, and operator surfaces remain in force. + +### 13. Compatibility, migration, rollout, and rollback + +This is a bounded update to the immutable owner `specs/final-progress-completion-recovery.md`. It adds repeated citations as another eligible failure handled by the existing single complete-batch correction allowance shared with length/completion recovery. No additional allowance, stored-state migration, configuration, or release authorization is introduced. + +Both prose and closed-fact wire profiles must enforce distinct admitted citations. Unique-citation responses retain their existing success path. A correction must preserve requirements, distinct admitted source references, identities, response bounds, the 120-call/30-minute ceilings, complete frozen batches, and the final publication gate. Invalid evidence remains blocking. Exhaustion is terminal and nonretryable; rollback to immediate rejection retains prior progress and does not rewrite published state. + +### 14. Testing strategy and numeric budget + +Add five minimum distinct regression cases to the existing owner budget; these are new cases, not a replacement for retained cases or coverage gates. Exercise both wire profiles, valid unique and repeated citations, exhaustion after the shared correction, mixed length/completion recovery, and invalid evidence with frozen-batch retention. Keep the complete-batch correction allowance shared and singular. Assertions must verify preservation of requirements, distinct admitted source references, identities, response bounds, the existing 120-call and 30-minute ceilings, and the final publication gate. Use deterministic fixtures and assert that exhaustion yields a precise content-free, nonretryable diagnostic without silent deduplication, invented citations, another allowance, or unchanged-head reruns. Keep repository and changed-module coverage thresholds and all existing budgets in force. These cases establish structural coverage targets; they do not establish executed acceptance. + +| Area | Minimum distinct cases | Behaviors/risks covered | +|---|---:|---| +| citation recovery | 2 | Observable scenarios in the case inventory. | +| allowance exhaustion | 1 | Observable scenarios in the case inventory. | +| shared recovery | 1 | Observable scenarios in the case inventory. | +| evidence validation | 1 | Observable scenarios in the case inventory. | +| Total | 5 | Distinct inventory cases; repeated executions do not add cases. | + +| Case ID | Area | Requirements | Scenario | +| --- | --- | --- | --- | +| inventory1-C01 | citation recovery | SDD-I944-U1-R1 | For each wire profile, an otherwise valid attributable response with repeated citations uses the existing shared complete-batch correction allowance, then succeeds only with distinct admitted citations while preserving requirements, identities, response bounds, call/time ceilings, and the final publication gate. | +| inventory1-C02 | citation recovery | SDD-I944-U1-R1 | A valid unique-citation response succeeds without correction. | +| inventory1-C03 | allowance exhaustion | SDD-I944-U1-R1 | When a repeated-citation response occurs after the shared correction allowance is consumed, evaluation returns a precise content-free nonretryable diagnostic; it does not silently deduplicate, add an allowance, or rerun unchanged heads. | +| inventory1-C04 | shared recovery | SDD-I944-U1-R1 | Repeated-citation recovery mixed with length/completion recovery consumes the same single complete-batch allowance. | +| inventory1-C05 | evidence validation | SDD-I944-U1-R2 | Missing, foreign, generated, stale, malformed, or forged evidence blocks publication; complete frozen batches remain intact and no partial progress is published. | + +### 15. Documentation and discoverability + +Update the operator guidance associated with final progress assessment so maintainers can distinguish repeated-citation correction from evidence rejection, understand that correction shares the existing complete-batch allowance with length/completion recovery, and interpret the terminal content-free diagnostic. Keep the unique-citation control, both wire profiles, invalid-evidence blocking, frozen-batch retention, no-partial-publication behavior, and existing limits aligned with the contract in `specs/final-progress-completion-recovery.md`. Preserve the native incident as reported: the original response was not retained, and repetition is an inference from the failure path; the synthetic counterexample and unique-citation control are separate evidence. Do not claim a consumer rerun or implementation acceptance. Publication acceptance must separately establish that the specification satisfies required format, internal and cross-document consistency is checked, and reciprocal catalog ownership, paths, and evidence agree with the generated view; the concrete invocation or prerequisite remains unverified where it has not been inspected. + +| Path | Change | +| --- | --- | +| specs/final-progress-completion-recovery.md | update | + +[specs/final-progress-completion-recovery.md](final-progress-completion-recovery.md) + +### 16. Acceptance scenarios + +1. Given an otherwise valid, attributable response with unique citations, when either wire profile is evaluated, then it succeeds without correction. This is `inventory1-C02`. +2. Given an otherwise valid, attributable response with repeated citations, when either wire profile is evaluated, then the existing shared complete-batch correction is used and evaluation succeeds only with distinct admitted citations, preserving all requirements, identities, response bounds, call/time ceilings, and the final publication gate. This is `inventory1-C01`. +3. Given a repeated-citation response after the shared correction allowance is consumed, when evaluation rejects it, then a precise content-free nonretryable diagnostic is returned; output is not silently deduplicated, no allowance is added, and unchanged heads are not rerun. This is `inventory1-C03`. +4. Given repeated-citation recovery combined with a length or completion failure, when the correction is applied, then both consume the same single complete-batch allowance. This is `inventory1-C04`. +5. Given missing, foreign, generated, stale, malformed, or forged evidence, when a batch is evaluated, then publication remains blocked, complete frozen batches remain intact, and no partial progress is published. This is `inventory1-C05`. + +### 17. Requirements traceability + +SDD-I944-U1-R1 requires acceptance of only distinct citations in otherwise valid attributable responses, correction through the existing shared allowance, preservation of coverage and limits, and terminal handling after exhaustion. It is exercised by `inventory1-C01`, `inventory1-C02`, `inventory1-C03`, and `inventory1-C04`. + +SDD-I944-U1-R2 requires invalid evidence to remain publication-blocking with frozen complete batches and no partial progress. It is exercised by `inventory1-C05`. + +These mappings describe planned acceptance coverage. They do not claim the cases were implemented or executed. + +| Requirement | Cases | +|---|---| +| SDD-I944-U1-R1 | inventory1-C01, inventory1-C02, inventory1-C03, inventory1-C04 | +| SDD-I944-U1-R2 | inventory1-C05 | + +### 18. Implementation sequence + +1. Clarify that each accepted citation must be distinct, admitted evidence, and that repetition makes an otherwise valid attributable response eligible for the existing complete-batch correction path. +2. Apply that correction through the single allowance shared with length and completion recovery. Retain the complete frozen batch and all requirement coverage, distinct admitted references, identities, response bounds, the 120-call and 30-minute ceilings, and the final publication gate. Do not deduplicate output, fabricate citations, or accept invalid evidence. +3. If repetition remains after the shared allowance is consumed, stop with a precise, content-free, nonretryable diagnostic. Do not retry unchanged heads or publish partial progress. +4. Keep the immutable retained contract and cases in `specs/final-progress-completion-recovery.md`; this delta refines repeated-citation handling within that contract. Validate both wire profiles, the unique-citation control, repeated-citation recovery and exhaustion, and mixed citation/length/completion recovery using the same allowance. Verify that missing, foreign, generated, stale, malformed, or forged evidence still blocks publication and that frozen batches remain intact. Existing test budgets and coverage gates apply; concrete verification invocations and prerequisites remain unverified in this draft. + +### 19. Definition of Done + +- The specification satisfies the required format. +- Internal and cross-document consistency is checked, including the retained recovery contract and the mapped behaviors for both wire profiles, unique citations, repeated-citation correction and exhaustion, shared allowance use, and invalid evidence. +- Reciprocal catalog ownership, paths, and evidence agree with the generated view. +- Product validation demonstrates that an otherwise valid repeated-citation response can recover within the existing shared complete-batch allowance, preserving coverage, identities, response bounds, the 120-call/30-minute ceiling, and the final publication gate; unique citations succeed without correction; and a repeat after allowance exhaustion produces a precise content-free nonretryable diagnostic without deduplication, added allowance, unchanged-head reruns, or partial publication. +- Missing, foreign, generated, stale, malformed, or forged evidence continues to block publication, with complete frozen batches retained. The original native response was not retained, so native repetition is not claimed as directly captured. The issue reports a synthetic counterexample and a unique-citation control; do not treat that report as execution of this delta's validation. +- Existing repository test budgets, coverage gates, and required review outcomes remain in force. Concrete invocation and prerequisites for product validation remain unverified. + +### 20. References and decisions + +Issue context: [#944](https://github.com/vypdev/copilot/issues/944). The issue reports that repeated citations pass adapter schema validation but fail evidence parsing, with progress retained. It explicitly says the original native response was not retained; repetition is inferred from the native failure path, while a synthetic counterexample reproduces the mismatch and a unique-citation control succeeds. This draft preserves that evidence limitation and does not assert that the native response was captured. + +The owning recovery contract and retained cases are in `specs/final-progress-completion-recovery.md`. The change is limited to making distinct citations explicit and routing repeated citations through the existing shared complete-batch correction allowance, while preserving evidence validation, batch retention, publication gating, and established limits. No new allowance or release authorization is implied. From 89cf1a4eb6b83ee5f5f950d28671994163c57d8e Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Sun, 8 Nov 2026 22:45:16 +0100 Subject: [PATCH 2/3] fix: bound native progress correction for repeated citations (#944) --- build/api/index.js | 2 +- .../src/domain/progress_batch_diagnostic.d.ts | 2 +- build/cli/index.js | 165 ++++++- build/deployment_recovery/index.js | 2 +- build/github_action/index.js | 165 ++++++- docs/agents/execution-contract.mdx | 16 + docs/issues/branch-management.mdx | 13 + .../operations/error-reference.mdx | 17 + specs/CATALOG.md | 6 +- specs/catalog.json | 9 +- specs/final-progress-completion-recovery.md | 465 ++++++++++++------ .../__tests__/progress_batch_policy.test.ts | 2 +- .../policies/progress_batch_policy.ts | 27 +- .../progress_citation_recovery_policy.ts | 69 +++ .../progress_prompt_capacity_policy.ts | 7 +- .../progress_citation_recovery.test.ts | 262 ++++++++++ ...ress_native_generation.integration.test.ts | 47 +- .../actions/progress_batch_workflow.ts | 6 +- .../query_progress_assessment_workflow.ts | 23 +- .../github_communication_test_budget.json | 8 +- src/domain/progress_batch_diagnostic.ts | 2 +- src/domain/progress_citation_repetition.ts | 21 + 22 files changed, 1117 insertions(+), 219 deletions(-) create mode 100644 src/application/policies/progress_citation_recovery_policy.ts create mode 100644 src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts create mode 100644 src/domain/progress_citation_repetition.ts diff --git a/build/api/index.js b/build/api/index.js index 66d1d2a88..88f565b98 100644 --- a/build/api/index.js +++ b/build/api/index.js @@ -9944,7 +9944,7 @@ exports.PROGRESS_BATCH_REASONS = void 0; exports.isProgressBatchDiagnostic = isProgressBatchDiagnostic; exports.PROGRESS_BATCH_REASONS = [ 'source-coverage', 'scope-capacity', 'manifest-identity', 'batch-identity', 'receipt-coverage', - 'evidence-identity', 'evidence-missing', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', + 'evidence-identity', 'evidence-missing', 'evidence-duplicate', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', ]; function isProgressBatchDiagnostic(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) diff --git a/build/api/src/domain/progress_batch_diagnostic.d.ts b/build/api/src/domain/progress_batch_diagnostic.d.ts index f969fb0d0..c7202a304 100644 --- a/build/api/src/domain/progress_batch_diagnostic.d.ts +++ b/build/api/src/domain/progress_batch_diagnostic.d.ts @@ -1,4 +1,4 @@ -export declare const PROGRESS_BATCH_REASONS: readonly ["source-coverage", "scope-capacity", "manifest-identity", "batch-identity", "receipt-coverage", "evidence-identity", "evidence-missing", "receipt-conflict", "call-budget", "time-budget", "aggregate-capacity"]; +export declare const PROGRESS_BATCH_REASONS: readonly ["source-coverage", "scope-capacity", "manifest-identity", "batch-identity", "receipt-coverage", "evidence-identity", "evidence-missing", "evidence-duplicate", "receipt-conflict", "call-budget", "time-budget", "aggregate-capacity"]; export type ProgressBatchReason = typeof PROGRESS_BATCH_REASONS[number]; export type ProgressBatchDiagnostic = Readonly<{ readonly reason: ProgressBatchReason; diff --git a/build/cli/index.js b/build/cli/index.js index b016160de..f48be7b4c 100755 --- a/build/cli/index.js +++ b/build/cli/index.js @@ -47056,6 +47056,8 @@ const progress_evidence_protocol_policy_1 = __nccwpck_require__(37124); const progress_evidence_path_1 = __nccwpck_require__(25887); const progress_assessment_capacity_policy_1 = __nccwpck_require__(67329); const progress_capacity_failure_1 = __nccwpck_require__(6457); +const progress_completion_mismatch_1 = __nccwpck_require__(6519); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262144, assessmentClauses: 32, calls: 120, milliseconds: 1800000 }); const digest = (value) => (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(value)).digest('hex'); @@ -47180,12 +47182,12 @@ function progressBatchResponseSchema(manifest, batch, anchors, compact) { properties: { ...schema.properties.requirements.items.properties, summary: { ...schema.properties.requirements.items.properties.summary, maxLength: factLimit, description }, remaining: { ...schema.properties.requirements.items.properties.remaining, maxLength: factLimit, description }, - citations: { type: 'array', minItems: 1, maxItems: 8, + citations: { type: 'array', minItems: 1, maxItems: 8, description: 'One to eight distinct admitted evidence IDs. Never repeat a citation within a requirement.', items: { type: 'string', enum: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) } } }, required: [...schema.properties.requirements.items.required, 'citations'] } } }, required: [...schema.required, 'manifestDigest', 'batchId', 'headSha'] }; } -function readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact) { +function readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact, requestSchema) { const payload = (0, progress_response_rejection_policy_1.progressResponsePayload)(response, locale, 'assessment'); const fail = (reason, requirementId = 'none') => { throw (0, progress_batch_rejection_policy_1.progressBatchRejected)(reason, { batch: batch.ordinal, requirementId }); }; if (!exact(payload, ['outputLocale', 'progress', 'requirements', 'manifestDigest', 'batchId', 'headSha']) @@ -47198,6 +47200,7 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho fail('receipt-coverage', missing?.id); } const citations = []; + let repetition; const factLimit = aggregateFactLimit(manifest, compact, anchors); const facts = payload.requirements.map(value => { if (!record(value) || !exact(value, ['id', 'status', 'evidence', 'summary', 'remaining', 'citations'])) @@ -47214,19 +47217,36 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho context: { kind: 'assessment', requirementCount: manifest.scope.requirements.length, batch: batch.ordinal, requirementId: id }, }); } - if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8 - || new Set(value.citations).size !== value.citations.length) + if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8) return fail('evidence-missing', id); for (const citation of value.citations) { const reference = manifest.evidence.find(entry => entry.id === citation); if (!reference || reference.headSha !== manifest.headSha || reference.generated) fail('evidence-identity', id); } + const distinctCount = new Set(value.citations).size; + if (!repetition && distinctCount !== value.citations.length) + repetition = { requirementId: id, citationCount: value.citations.length, distinctCount }; citations.push(Object.freeze([...value.citations])); const { citations: _citations, ...fact } = value; return fact; }); - return { payload: { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }, citations }; + const canonical = { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }; + if (repetition) { + const scope = progressBatchDisplayScope(batch, compact); + // A repetition is eligible only when every other native and semantic check passes. + // A simultaneous completion contradiction must not escape as an eligible completion result. + try { + (0, progress_scope_policy_1.parseScopedProgressResponse)(canonical, locale, scope, anchors); + } + catch (error) { + if (error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch) + return fail('evidence-duplicate', repetition.requirementId); + throw error; + } + throw (0, progress_citation_recovery_policy_1.progressCitationRepetitionError)(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, { ...repetition, batch: batch.ordinal, sourceLineId: anchors[repetition.requirementId] ?? 'none' }, requestSchema); + } + return { payload: canonical, citations }; } function parseProgressAssessmentReceipt(response, manifest, batch, anchors, locale, compact) { const { payload, citations } = readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact); @@ -47564,6 +47584,80 @@ function progressCapacityDiffContext(diff, allPathReceiptsAccepted = false) { } +/***/ }), + +/***/ 88351: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PROGRESS_CITATION_HINT_MAX_BYTES = void 0; +exports.progressCitationRepetitionError = progressCitationRepetitionError; +exports.bindProgressCitationRepetition = bindProgressCitationRepetition; +exports.hasProgressCitationsSchema = hasProgressCitationsSchema; +exports.reservedProgressCitationPrompt = reservedProgressCitationPrompt; +exports.progressCitationRepairPrompt = progressCitationRepairPrompt; +const node_util_1 = __nccwpck_require__(47261); +const progress_citation_repetition_1 = __nccwpck_require__(3482); +const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_batch_rejection_policy_1 = __nccwpck_require__(13397); +const nativeRepetitions = new WeakMap(); +exports.PROGRESS_CITATION_HINT_MAX_BYTES = 256; +const PREFIX = '\n\nThe previous completed assessment repeated a source citation. Return one complete replacement for the SAME pinned batch, original requirement IDs, evidence dictionary, locale and unchanged schema. Each citations array must contain one to eight DISTINCT admitted source IDs. Preserve the complete original evidence inventory; do not invent references, infer verification, force completion or omit requirements. These closed measurements describe the rejected response, not implementation or execution evidence.\n[BEGIN_PREVIOUS_CITATION_REPETITION]\n'; +const SUFFIX = '\n[END_PREVIOUS_CITATION_REPETITION]'; +function freezeSnapshot(value) { + if (value && typeof value === 'object' && !Object.isFrozen(value)) { + Object.freeze(value); + Object.values(value).forEach(freezeSnapshot); + } + return value; +} +/** Only the native receipt validator mints this invocation-local origin; public error fields cannot forge it. */ +function progressCitationRepetitionError(schema, scope, anchors, locale, facts, requestSchema) { + const valid = (0, progress_citation_repetition_1.isProgressCitationRepetitionDiagnostic)(facts); + const error = (0, progress_batch_rejection_policy_1.progressBatchRejected)('evidence-duplicate', valid ? { batch: facts.batch, requirementId: facts.requirementId } : {}); + if (!valid || !requestSchema || !Object.isFrozen(requestSchema)) + return error; + try { + const captured = structuredClone({ scope, anchors, locale, facts }); + const canonical = structuredClone(schema), actual = structuredClone(requestSchema); + const compact = (0, progress_compact_assessment_policy_1.compactProgressAssessmentPlan)(canonical, locale); + if (!(0, node_util_1.isDeepStrictEqual)(canonical, actual) && (!compact || !(0, node_util_1.isDeepStrictEqual)(structuredClone(compact.schema), actual))) + return error; + nativeRepetitions.set(error, Object.freeze({ ...freezeSnapshot(captured), schema: requestSchema })); + } + catch { /* Unknown contracts never acquire recovery authority. */ } + return error; +} +/** Bind complete native request and scope snapshots, not exception names or model-echoed metadata. */ +function bindProgressCitationRepetition(error, schema, scope, anchors, sourceLineIds, locale) { + if (!error || typeof error !== 'object') + return null; + const captured = nativeRepetitions.get(error); + if (!captured || captured.locale !== locale || captured.schema !== schema + || !(0, node_util_1.isDeepStrictEqual)(captured.scope, scope) || !(0, node_util_1.isDeepStrictEqual)(captured.anchors, anchors) + || !sourceLineIds?.includes(captured.facts.sourceLineId)) + return null; + return captured.facts; +} +/** Planning only: an unrelated legacy schema does not reserve a citation correction it cannot produce. */ +function hasProgressCitationsSchema(schema) { + const record = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value); + const properties = schema.properties, requirements = record(properties) ? properties.requirements : undefined; + const items = record(requirements) ? requirements.items : undefined, fields = record(items) ? items.properties : undefined; + return record(fields) && record(fields.citations); +} +function reservedProgressCitationPrompt(prompt) { + return prompt + PREFIX + ' '.repeat(exports.PROGRESS_CITATION_HINT_MAX_BYTES) + SUFFIX; +} +function progressCitationRepairPrompt(prompt, facts) { + if (!(0, progress_citation_repetition_1.isProgressCitationRepetitionDiagnostic)(facts)) + throw new TypeError('Progress citation repetition diagnostic is invalid.'); + return prompt + PREFIX + JSON.stringify(facts) + SUFFIX; +} + + /***/ }), /***/ 32351: @@ -48536,6 +48630,7 @@ const progress_partition_response_policy_1 = __nccwpck_require__(30025); const progress_completion_recovery_policy_1 = __nccwpck_require__(93325); const progress_assessment_length_policy_1 = __nccwpck_require__(60334); const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_PROMPT_FRAMING_RESERVE_BYTES = 1024; /** Counts exactly the security/schema/task envelope used by the native adapter. */ function remainingProgressPromptBytes(prompt, task, schema, effort, dimension = 'native-prompt-bytes') { @@ -48559,7 +48654,10 @@ function progressAggregateBudget(promptWithoutEvidence, schema, effort) { function remainingProgressAssessmentPromptBytes(prompt, schema, effort) { remainingProgressPromptBytes(prompt, 'progress', schema, effort); const compact = (0, progress_compact_assessment_policy_1.compactProgressAssessmentPlan)(schema, 'en-US'); - return Math.min(remainingProgressPromptBytes((0, progress_completion_recovery_policy_1.reservedProgressCompletionPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), remainingProgressPromptBytes((0, progress_assessment_length_policy_1.reservedProgressAssessmentLengthPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), ...(compact ? [remainingProgressPromptBytes((0, progress_compact_assessment_policy_1.reservedCompactProgressAssessmentPrompt)(prompt), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : [])); + return Math.min(remainingProgressPromptBytes((0, progress_completion_recovery_policy_1.reservedProgressCompletionPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), remainingProgressPromptBytes((0, progress_assessment_length_policy_1.reservedProgressAssessmentLengthPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), ...(compact ? [remainingProgressPromptBytes((0, progress_compact_assessment_policy_1.reservedCompactProgressAssessmentPrompt)(prompt), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), ...((0, progress_citation_recovery_policy_1.hasProgressCitationsSchema)(schema) ? [ + remainingProgressPromptBytes((0, progress_citation_recovery_policy_1.reservedProgressCitationPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), + ...(compact ? [remainingProgressPromptBytes((0, progress_citation_recovery_policy_1.reservedProgressCitationPrompt)((0, progress_compact_assessment_policy_1.compactProgressAssessmentPrompt)(prompt)), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), + ] : [])); } @@ -61609,7 +61707,7 @@ async function analyzeProgressBatches(context, issueDescription, captured, diff, const promptFor = (batch, diffEvidence, schema) => (0, prompts_1.getCheckProgressPrompt)({ ...parameters, acceptanceScope: scopeData(batch.scope), diffEvidence }) + '\n\nSame-head assessment receipt contract\n' + (0, progress_scope_1.renderProgressPromptData)(JSON.stringify({ manifestDigest: manifest.digest, batchId: batch.id, headSha: manifest.headSha, evidenceDictionary: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) }), 'progress.comparison', 262144, 'assessment') - + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight exact evidenceDictionary IDs in citations. ' + + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight DISTINCT exact evidenceDictionary IDs in citations; never repeat an ID within a requirement. ' + 'A citation is its exact unitId in the complete comparison facts, or its exact path when no unitId is supplied. A SHA echo alone is insufficient. ' + 'Every outcome requires a non-generated source observation. Missing or uncertain outcomes require a traceable source observation supporting that outcome. ' + 'Do not infer contents of unprovided unchanged files or external verification. Preserve uncertainty and all qualifiers. Return no partial inventory. ' @@ -61641,8 +61739,8 @@ async function analyzeProgressBatches(context, issueDescription, captured, diff, capacity(() => requests.forEach(({ prompt, schema }) => (0, progress_prompt_capacity_policy_1.remainingProgressAssessmentPromptBytes)(prompt, schema, context.agentConfiguration.effort))); for (const { batch, schema, prompt } of requests) { let acceptedResponse; - const projectResponse = (response) => { - const { payload } = (0, progress_batch_policy_1.readProgressAssessmentEvidence)(response, manifest, batch, context.targetLocale, anchors, compact); + const projectResponse = (response, requestSchema) => { + const { payload } = (0, progress_batch_policy_1.readProgressAssessmentEvidence)(response, manifest, batch, context.targetLocale, anchors, compact, requestSchema); acceptedResponse = response; return payload; }; @@ -61932,6 +62030,8 @@ const logging_ports_1 = __nccwpck_require__(6152); const progress_response_1 = __nccwpck_require__(64264); const query_progress_result_workflow_1 = __nccwpck_require__(33658); const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); +const progress_batch_rejection_policy_1 = __nccwpck_require__(13397); function freezeSnapshot(value) { if (value && typeof value === 'object' && !Object.isFrozen(value)) { Object.freeze(value); @@ -61954,9 +62054,12 @@ async function evaluate(agent, request, context, projectResponse, compact) { } try { const canonical = compact ? (0, progress_compact_assessment_policy_1.decodeCompactProgressAssessment)(response, compact, context.scope, context.anchors) : response; - return { kind: 'valid', result: (0, progress_response_1.parseProgressResponse)(projectResponse(canonical), context.targetLocale, context.scope, context.anchors) }; + return { kind: 'valid', result: (0, progress_response_1.parseProgressResponse)(projectResponse(canonical, request.options?.schema), context.targetLocale, context.scope, context.anchors) }; } catch (error) { + const repetition = (0, progress_citation_recovery_policy_1.bindProgressCitationRepetition)(error, request.options?.schema, context.scope, context.anchors, context.sourceLineIds, context.targetLocale); + if (repetition) + return { kind: 'repetition', facts: repetition }; if (!(error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch)) throw error; const facts = error.factsFor(context.scope); @@ -61978,21 +62081,27 @@ async function queryProgressAssessment(agent, request, context, projectResponse ...captured.request, prompt: (0, progress_compact_assessment_policy_1.compactProgressAssessmentPrompt)(captured.request.prompt, facts), options: { ...captured.request.options, schema: plan.schema }, }); - const first = await evaluate(agent, initialCompact ? compactRequest(initialCompact) : captured.request, captured.context, projectResponse, initialCompact); + const initialRequest = initialCompact ? compactRequest(initialCompact) : captured.request; + const first = await evaluate(agent, initialRequest, captured.context, projectResponse, initialCompact); if (first.kind === 'valid') return first.result; (0, logging_ports_1.logInfo)(first.kind === 'length' ? 'A progress acceptance fact exceeded its unchanged response limit. Requesting one complete replacement for the same pinned batch; previous progress is retained.' - : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); + : first.kind === 'repetition' + ? 'A completed progress assessment repeated a native source citation. Requesting one complete correction for the same pinned batch; previous progress is retained.' + : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); const replacementCompact = initialCompact ?? (first.kind === 'length' ? compact : undefined); - const replacement = replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' - ? (0, progress_assessment_length_policy_1.progressAssessmentLengthRepairPrompt)(captured.request.prompt, first.facts) - : (0, progress_completion_recovery_policy_1.progressCompletionRepairPrompt)(captured.request.prompt, first.facts) }; + const replacement = first.kind === 'repetition' ? freezeSnapshot({ ...initialRequest, prompt: (0, progress_citation_recovery_policy_1.progressCitationRepairPrompt)(initialRequest.prompt, first.facts) }) + : replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' + ? (0, progress_assessment_length_policy_1.progressAssessmentLengthRepairPrompt)(captured.request.prompt, first.facts) + : (0, progress_completion_recovery_policy_1.progressCompletionRepairPrompt)(captured.request.prompt, first.facts) }; const second = await evaluate(agent, replacement, captured.context, projectResponse, replacementCompact); if (second.kind === 'valid') return second.result; if (second.kind === 'length') throw (0, progress_assessment_length_policy_1.progressAssessmentLengthRejected)(second.facts); + if (second.kind === 'repetition') + throw (0, progress_batch_rejection_policy_1.progressBatchRejected)('evidence-duplicate', { batch: second.facts.batch, requirementId: second.facts.requirementId }); throw new application_error_1.ApplicationError('agent.failed', 'Progress completion remained inconsistent after one complete reassessment. Existing progress was retained.', { correlationId: second.correlationId, recovery: { id: 'progress-completion-recovery-exhausted', variables: second.facts } }); } @@ -103543,7 +103652,7 @@ exports.PROGRESS_BATCH_REASONS = void 0; exports.isProgressBatchDiagnostic = isProgressBatchDiagnostic; exports.PROGRESS_BATCH_REASONS = [ 'source-coverage', 'scope-capacity', 'manifest-identity', 'batch-identity', 'receipt-coverage', - 'evidence-identity', 'evidence-missing', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', + 'evidence-identity', 'evidence-missing', 'evidence-duplicate', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', ]; function isProgressBatchDiagnostic(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) @@ -103728,6 +103837,30 @@ function progressCapacityDiagnostic(input) { } +/***/ }), + +/***/ 3482: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isProgressCitationRepetitionDiagnostic = isProgressCitationRepetitionDiagnostic; +const progress_response_diagnostic_1 = __nccwpck_require__(56289); +/** Closed host measurements only; neither source references nor rejected prose are retained. */ +function isProgressCitationRepetitionDiagnostic(value) { + if (!value || typeof value !== 'object' || Array.isArray(value)) + return false; + const facts = value; + return Object.keys(facts).sort().join(',') === 'batch,citationCount,distinctCount,requirementId,sourceLineId' + && (0, progress_response_diagnostic_1.isProgressRequirementId)(facts.requirementId) && (0, progress_response_diagnostic_1.isProgressSourceLineId)(facts.sourceLineId) + && Number.isSafeInteger(facts.batch) && facts.batch >= 1 && facts.batch <= 1024 + && Number.isSafeInteger(facts.citationCount) && facts.citationCount >= 2 && facts.citationCount <= 8 + && Number.isSafeInteger(facts.distinctCount) && facts.distinctCount >= 1 + && facts.distinctCount < facts.citationCount; +} + + /***/ }), /***/ 75095: diff --git a/build/deployment_recovery/index.js b/build/deployment_recovery/index.js index 8e351c641..54c756d5b 100644 --- a/build/deployment_recovery/index.js +++ b/build/deployment_recovery/index.js @@ -37614,7 +37614,7 @@ exports.PROGRESS_BATCH_REASONS = void 0; exports.isProgressBatchDiagnostic = isProgressBatchDiagnostic; exports.PROGRESS_BATCH_REASONS = [ 'source-coverage', 'scope-capacity', 'manifest-identity', 'batch-identity', 'receipt-coverage', - 'evidence-identity', 'evidence-missing', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', + 'evidence-identity', 'evidence-missing', 'evidence-duplicate', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', ]; function isProgressBatchDiagnostic(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) diff --git a/build/github_action/index.js b/build/github_action/index.js index a318d5bf6..1d59e8aa2 100644 --- a/build/github_action/index.js +++ b/build/github_action/index.js @@ -48917,6 +48917,8 @@ const progress_evidence_protocol_policy_1 = __nccwpck_require__(37124); const progress_evidence_path_1 = __nccwpck_require__(25887); const progress_assessment_capacity_policy_1 = __nccwpck_require__(67329); const progress_capacity_failure_1 = __nccwpck_require__(6457); +const progress_completion_mismatch_1 = __nccwpck_require__(6519); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262144, assessmentClauses: 32, calls: 120, milliseconds: 1800000 }); const digest = (value) => (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(value)).digest('hex'); @@ -49041,12 +49043,12 @@ function progressBatchResponseSchema(manifest, batch, anchors, compact) { properties: { ...schema.properties.requirements.items.properties, summary: { ...schema.properties.requirements.items.properties.summary, maxLength: factLimit, description }, remaining: { ...schema.properties.requirements.items.properties.remaining, maxLength: factLimit, description }, - citations: { type: 'array', minItems: 1, maxItems: 8, + citations: { type: 'array', minItems: 1, maxItems: 8, description: 'One to eight distinct admitted evidence IDs. Never repeat a citation within a requirement.', items: { type: 'string', enum: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) } } }, required: [...schema.properties.requirements.items.required, 'citations'] } } }, required: [...schema.required, 'manifestDigest', 'batchId', 'headSha'] }; } -function readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact) { +function readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact, requestSchema) { const payload = (0, progress_response_rejection_policy_1.progressResponsePayload)(response, locale, 'assessment'); const fail = (reason, requirementId = 'none') => { throw (0, progress_batch_rejection_policy_1.progressBatchRejected)(reason, { batch: batch.ordinal, requirementId }); }; if (!exact(payload, ['outputLocale', 'progress', 'requirements', 'manifestDigest', 'batchId', 'headSha']) @@ -49059,6 +49061,7 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho fail('receipt-coverage', missing?.id); } const citations = []; + let repetition; const factLimit = aggregateFactLimit(manifest, compact, anchors); const facts = payload.requirements.map(value => { if (!record(value) || !exact(value, ['id', 'status', 'evidence', 'summary', 'remaining', 'citations'])) @@ -49075,19 +49078,36 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho context: { kind: 'assessment', requirementCount: manifest.scope.requirements.length, batch: batch.ordinal, requirementId: id }, }); } - if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8 - || new Set(value.citations).size !== value.citations.length) + if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8) return fail('evidence-missing', id); for (const citation of value.citations) { const reference = manifest.evidence.find(entry => entry.id === citation); if (!reference || reference.headSha !== manifest.headSha || reference.generated) fail('evidence-identity', id); } + const distinctCount = new Set(value.citations).size; + if (!repetition && distinctCount !== value.citations.length) + repetition = { requirementId: id, citationCount: value.citations.length, distinctCount }; citations.push(Object.freeze([...value.citations])); const { citations: _citations, ...fact } = value; return fact; }); - return { payload: { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }, citations }; + const canonical = { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }; + if (repetition) { + const scope = progressBatchDisplayScope(batch, compact); + // A repetition is eligible only when every other native and semantic check passes. + // A simultaneous completion contradiction must not escape as an eligible completion result. + try { + (0, progress_scope_policy_1.parseScopedProgressResponse)(canonical, locale, scope, anchors); + } + catch (error) { + if (error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch) + return fail('evidence-duplicate', repetition.requirementId); + throw error; + } + throw (0, progress_citation_recovery_policy_1.progressCitationRepetitionError)(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, { ...repetition, batch: batch.ordinal, sourceLineId: anchors[repetition.requirementId] ?? 'none' }, requestSchema); + } + return { payload: canonical, citations }; } function parseProgressAssessmentReceipt(response, manifest, batch, anchors, locale, compact) { const { payload, citations } = readProgressAssessmentEvidence(response, manifest, batch, locale, anchors, compact); @@ -49425,6 +49445,80 @@ function progressCapacityDiffContext(diff, allPathReceiptsAccepted = false) { } +/***/ }), + +/***/ 88351: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PROGRESS_CITATION_HINT_MAX_BYTES = void 0; +exports.progressCitationRepetitionError = progressCitationRepetitionError; +exports.bindProgressCitationRepetition = bindProgressCitationRepetition; +exports.hasProgressCitationsSchema = hasProgressCitationsSchema; +exports.reservedProgressCitationPrompt = reservedProgressCitationPrompt; +exports.progressCitationRepairPrompt = progressCitationRepairPrompt; +const node_util_1 = __nccwpck_require__(47261); +const progress_citation_repetition_1 = __nccwpck_require__(3482); +const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_batch_rejection_policy_1 = __nccwpck_require__(13397); +const nativeRepetitions = new WeakMap(); +exports.PROGRESS_CITATION_HINT_MAX_BYTES = 256; +const PREFIX = '\n\nThe previous completed assessment repeated a source citation. Return one complete replacement for the SAME pinned batch, original requirement IDs, evidence dictionary, locale and unchanged schema. Each citations array must contain one to eight DISTINCT admitted source IDs. Preserve the complete original evidence inventory; do not invent references, infer verification, force completion or omit requirements. These closed measurements describe the rejected response, not implementation or execution evidence.\n[BEGIN_PREVIOUS_CITATION_REPETITION]\n'; +const SUFFIX = '\n[END_PREVIOUS_CITATION_REPETITION]'; +function freezeSnapshot(value) { + if (value && typeof value === 'object' && !Object.isFrozen(value)) { + Object.freeze(value); + Object.values(value).forEach(freezeSnapshot); + } + return value; +} +/** Only the native receipt validator mints this invocation-local origin; public error fields cannot forge it. */ +function progressCitationRepetitionError(schema, scope, anchors, locale, facts, requestSchema) { + const valid = (0, progress_citation_repetition_1.isProgressCitationRepetitionDiagnostic)(facts); + const error = (0, progress_batch_rejection_policy_1.progressBatchRejected)('evidence-duplicate', valid ? { batch: facts.batch, requirementId: facts.requirementId } : {}); + if (!valid || !requestSchema || !Object.isFrozen(requestSchema)) + return error; + try { + const captured = structuredClone({ scope, anchors, locale, facts }); + const canonical = structuredClone(schema), actual = structuredClone(requestSchema); + const compact = (0, progress_compact_assessment_policy_1.compactProgressAssessmentPlan)(canonical, locale); + if (!(0, node_util_1.isDeepStrictEqual)(canonical, actual) && (!compact || !(0, node_util_1.isDeepStrictEqual)(structuredClone(compact.schema), actual))) + return error; + nativeRepetitions.set(error, Object.freeze({ ...freezeSnapshot(captured), schema: requestSchema })); + } + catch { /* Unknown contracts never acquire recovery authority. */ } + return error; +} +/** Bind complete native request and scope snapshots, not exception names or model-echoed metadata. */ +function bindProgressCitationRepetition(error, schema, scope, anchors, sourceLineIds, locale) { + if (!error || typeof error !== 'object') + return null; + const captured = nativeRepetitions.get(error); + if (!captured || captured.locale !== locale || captured.schema !== schema + || !(0, node_util_1.isDeepStrictEqual)(captured.scope, scope) || !(0, node_util_1.isDeepStrictEqual)(captured.anchors, anchors) + || !sourceLineIds?.includes(captured.facts.sourceLineId)) + return null; + return captured.facts; +} +/** Planning only: an unrelated legacy schema does not reserve a citation correction it cannot produce. */ +function hasProgressCitationsSchema(schema) { + const record = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value); + const properties = schema.properties, requirements = record(properties) ? properties.requirements : undefined; + const items = record(requirements) ? requirements.items : undefined, fields = record(items) ? items.properties : undefined; + return record(fields) && record(fields.citations); +} +function reservedProgressCitationPrompt(prompt) { + return prompt + PREFIX + ' '.repeat(exports.PROGRESS_CITATION_HINT_MAX_BYTES) + SUFFIX; +} +function progressCitationRepairPrompt(prompt, facts) { + if (!(0, progress_citation_repetition_1.isProgressCitationRepetitionDiagnostic)(facts)) + throw new TypeError('Progress citation repetition diagnostic is invalid.'); + return prompt + PREFIX + JSON.stringify(facts) + SUFFIX; +} + + /***/ }), /***/ 32351: @@ -50397,6 +50491,7 @@ const progress_partition_response_policy_1 = __nccwpck_require__(30025); const progress_completion_recovery_policy_1 = __nccwpck_require__(93325); const progress_assessment_length_policy_1 = __nccwpck_require__(60334); const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_PROMPT_FRAMING_RESERVE_BYTES = 1024; /** Counts exactly the security/schema/task envelope used by the native adapter. */ function remainingProgressPromptBytes(prompt, task, schema, effort, dimension = 'native-prompt-bytes') { @@ -50420,7 +50515,10 @@ function progressAggregateBudget(promptWithoutEvidence, schema, effort) { function remainingProgressAssessmentPromptBytes(prompt, schema, effort) { remainingProgressPromptBytes(prompt, 'progress', schema, effort); const compact = (0, progress_compact_assessment_policy_1.compactProgressAssessmentPlan)(schema, 'en-US'); - return Math.min(remainingProgressPromptBytes((0, progress_completion_recovery_policy_1.reservedProgressCompletionPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), remainingProgressPromptBytes((0, progress_assessment_length_policy_1.reservedProgressAssessmentLengthPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), ...(compact ? [remainingProgressPromptBytes((0, progress_compact_assessment_policy_1.reservedCompactProgressAssessmentPrompt)(prompt), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : [])); + return Math.min(remainingProgressPromptBytes((0, progress_completion_recovery_policy_1.reservedProgressCompletionPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), remainingProgressPromptBytes((0, progress_assessment_length_policy_1.reservedProgressAssessmentLengthPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), ...(compact ? [remainingProgressPromptBytes((0, progress_compact_assessment_policy_1.reservedCompactProgressAssessmentPrompt)(prompt), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), ...((0, progress_citation_recovery_policy_1.hasProgressCitationsSchema)(schema) ? [ + remainingProgressPromptBytes((0, progress_citation_recovery_policy_1.reservedProgressCitationPrompt)(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), + ...(compact ? [remainingProgressPromptBytes((0, progress_citation_recovery_policy_1.reservedProgressCitationPrompt)((0, progress_compact_assessment_policy_1.compactProgressAssessmentPrompt)(prompt)), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), + ] : [])); } @@ -59660,7 +59758,7 @@ async function analyzeProgressBatches(context, issueDescription, captured, diff, const promptFor = (batch, diffEvidence, schema) => (0, prompts_1.getCheckProgressPrompt)({ ...parameters, acceptanceScope: scopeData(batch.scope), diffEvidence }) + '\n\nSame-head assessment receipt contract\n' + (0, progress_scope_1.renderProgressPromptData)(JSON.stringify({ manifestDigest: manifest.digest, batchId: batch.id, headSha: manifest.headSha, evidenceDictionary: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) }), 'progress.comparison', 262144, 'assessment') - + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight exact evidenceDictionary IDs in citations. ' + + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight DISTINCT exact evidenceDictionary IDs in citations; never repeat an ID within a requirement. ' + 'A citation is its exact unitId in the complete comparison facts, or its exact path when no unitId is supplied. A SHA echo alone is insufficient. ' + 'Every outcome requires a non-generated source observation. Missing or uncertain outcomes require a traceable source observation supporting that outcome. ' + 'Do not infer contents of unprovided unchanged files or external verification. Preserve uncertainty and all qualifiers. Return no partial inventory. ' @@ -59692,8 +59790,8 @@ async function analyzeProgressBatches(context, issueDescription, captured, diff, capacity(() => requests.forEach(({ prompt, schema }) => (0, progress_prompt_capacity_policy_1.remainingProgressAssessmentPromptBytes)(prompt, schema, context.agentConfiguration.effort))); for (const { batch, schema, prompt } of requests) { let acceptedResponse; - const projectResponse = (response) => { - const { payload } = (0, progress_batch_policy_1.readProgressAssessmentEvidence)(response, manifest, batch, context.targetLocale, anchors, compact); + const projectResponse = (response, requestSchema) => { + const { payload } = (0, progress_batch_policy_1.readProgressAssessmentEvidence)(response, manifest, batch, context.targetLocale, anchors, compact, requestSchema); acceptedResponse = response; return payload; }; @@ -59983,6 +60081,8 @@ const logging_ports_1 = __nccwpck_require__(6152); const progress_response_1 = __nccwpck_require__(64264); const query_progress_result_workflow_1 = __nccwpck_require__(33658); const progress_compact_assessment_policy_1 = __nccwpck_require__(32351); +const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); +const progress_batch_rejection_policy_1 = __nccwpck_require__(13397); function freezeSnapshot(value) { if (value && typeof value === 'object' && !Object.isFrozen(value)) { Object.freeze(value); @@ -60005,9 +60105,12 @@ async function evaluate(agent, request, context, projectResponse, compact) { } try { const canonical = compact ? (0, progress_compact_assessment_policy_1.decodeCompactProgressAssessment)(response, compact, context.scope, context.anchors) : response; - return { kind: 'valid', result: (0, progress_response_1.parseProgressResponse)(projectResponse(canonical), context.targetLocale, context.scope, context.anchors) }; + return { kind: 'valid', result: (0, progress_response_1.parseProgressResponse)(projectResponse(canonical, request.options?.schema), context.targetLocale, context.scope, context.anchors) }; } catch (error) { + const repetition = (0, progress_citation_recovery_policy_1.bindProgressCitationRepetition)(error, request.options?.schema, context.scope, context.anchors, context.sourceLineIds, context.targetLocale); + if (repetition) + return { kind: 'repetition', facts: repetition }; if (!(error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch)) throw error; const facts = error.factsFor(context.scope); @@ -60029,21 +60132,27 @@ async function queryProgressAssessment(agent, request, context, projectResponse ...captured.request, prompt: (0, progress_compact_assessment_policy_1.compactProgressAssessmentPrompt)(captured.request.prompt, facts), options: { ...captured.request.options, schema: plan.schema }, }); - const first = await evaluate(agent, initialCompact ? compactRequest(initialCompact) : captured.request, captured.context, projectResponse, initialCompact); + const initialRequest = initialCompact ? compactRequest(initialCompact) : captured.request; + const first = await evaluate(agent, initialRequest, captured.context, projectResponse, initialCompact); if (first.kind === 'valid') return first.result; (0, logging_ports_1.logInfo)(first.kind === 'length' ? 'A progress acceptance fact exceeded its unchanged response limit. Requesting one complete replacement for the same pinned batch; previous progress is retained.' - : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); + : first.kind === 'repetition' + ? 'A completed progress assessment repeated a native source citation. Requesting one complete correction for the same pinned batch; previous progress is retained.' + : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); const replacementCompact = initialCompact ?? (first.kind === 'length' ? compact : undefined); - const replacement = replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' - ? (0, progress_assessment_length_policy_1.progressAssessmentLengthRepairPrompt)(captured.request.prompt, first.facts) - : (0, progress_completion_recovery_policy_1.progressCompletionRepairPrompt)(captured.request.prompt, first.facts) }; + const replacement = first.kind === 'repetition' ? freezeSnapshot({ ...initialRequest, prompt: (0, progress_citation_recovery_policy_1.progressCitationRepairPrompt)(initialRequest.prompt, first.facts) }) + : replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' + ? (0, progress_assessment_length_policy_1.progressAssessmentLengthRepairPrompt)(captured.request.prompt, first.facts) + : (0, progress_completion_recovery_policy_1.progressCompletionRepairPrompt)(captured.request.prompt, first.facts) }; const second = await evaluate(agent, replacement, captured.context, projectResponse, replacementCompact); if (second.kind === 'valid') return second.result; if (second.kind === 'length') throw (0, progress_assessment_length_policy_1.progressAssessmentLengthRejected)(second.facts); + if (second.kind === 'repetition') + throw (0, progress_batch_rejection_policy_1.progressBatchRejected)('evidence-duplicate', { batch: second.facts.batch, requirementId: second.facts.requirementId }); throw new application_error_1.ApplicationError('agent.failed', 'Progress completion remained inconsistent after one complete reassessment. Existing progress was retained.', { correlationId: second.correlationId, recovery: { id: 'progress-completion-recovery-exhausted', variables: second.facts } }); } @@ -94419,7 +94528,7 @@ exports.PROGRESS_BATCH_REASONS = void 0; exports.isProgressBatchDiagnostic = isProgressBatchDiagnostic; exports.PROGRESS_BATCH_REASONS = [ 'source-coverage', 'scope-capacity', 'manifest-identity', 'batch-identity', 'receipt-coverage', - 'evidence-identity', 'evidence-missing', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', + 'evidence-identity', 'evidence-missing', 'evidence-duplicate', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', ]; function isProgressBatchDiagnostic(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) @@ -94604,6 +94713,30 @@ function progressCapacityDiagnostic(input) { } +/***/ }), + +/***/ 3482: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isProgressCitationRepetitionDiagnostic = isProgressCitationRepetitionDiagnostic; +const progress_response_diagnostic_1 = __nccwpck_require__(56289); +/** Closed host measurements only; neither source references nor rejected prose are retained. */ +function isProgressCitationRepetitionDiagnostic(value) { + if (!value || typeof value !== 'object' || Array.isArray(value)) + return false; + const facts = value; + return Object.keys(facts).sort().join(',') === 'batch,citationCount,distinctCount,requirementId,sourceLineId' + && (0, progress_response_diagnostic_1.isProgressRequirementId)(facts.requirementId) && (0, progress_response_diagnostic_1.isProgressSourceLineId)(facts.sourceLineId) + && Number.isSafeInteger(facts.batch) && facts.batch >= 1 && facts.batch <= 1024 + && Number.isSafeInteger(facts.citationCount) && facts.citationCount >= 2 && facts.citationCount <= 8 + && Number.isSafeInteger(facts.distinctCount) && facts.distinctCount >= 1 + && facts.distinctCount < facts.citationCount; +} + + /***/ }), /***/ 75095: diff --git a/docs/agents/execution-contract.mdx b/docs/agents/execution-contract.mdx index 4f3388622..c80c084b7 100644 --- a/docs/agents/execution-contract.mdx +++ b/docs/agents/execution-contract.mdx @@ -275,6 +275,22 @@ comparison. Validate a corrected Copilot build against the pinned source before one fresh assessment. Other provider errors retain their own retryability. No setting or capacity changes. +The same final-response allowance covers repeated citations only when the entire +completed native response is otherwise valid for the current batch, scope, +locale and evidence. Each requirement still needs one to eight distinct admitted, +non-generated references at the pinned head. The complete replacement keeps the +same wire profile, schema, settings and full original evidence dictionary. Its +reserved hint contains only verified requirement/source IDs, batch and citation +counts. The host never deduplicates output or retains rejected prose. +Repetition, length and completion share at most two queries in total per batch. +A second repetition reports non-retryable `progress-batch-retained` with reason +`evidence-duplicate`; other terminal failures retain their existing classification. +Missing, foreign, generated, stale or malformed evidence and simultaneous other +defects cannot acquire citation recovery. Provider-thrown or replayed errors +cannot authorize it. All provisional batches remain unpublished until every +receipt and the final freshness gates pass; the 120-call/30-minute ledger applies +to correction too. + Large inventories use closed semantic assessment codes rather than generated per-requirement prose. Each code fixes the status, evidence kind and remaining action together. Copilot renders complete host-owned labels of at most nine diff --git a/docs/issues/branch-management.mdx b/docs/issues/branch-management.mdx index e61109212..aa406d61e 100644 --- a/docs/issues/branch-management.mdx +++ b/docs/issues/branch-management.mdx @@ -325,6 +325,19 @@ before starting one fresh assessment. The run records the actual requirement count, batch count and per-text allocation before collecting comparison facts. Length and completion failures cannot each allocate a replacement: there are still at most two final queries for a batch. No provisional batches publish. + +An otherwise valid native assessment that repeats an admitted source citation +may spend that same single allowance on a complete correction. Both narrative +and closed-fact responses must ultimately contain one to eight distinct admitted +citations per requirement. Copilot preserves the whole original evidence +dictionary, scope, head and profile; it never silently deduplicates model output. +A second repetition stops with non-retryable `progress-batch-retained`, reason +`evidence-duplicate`, and verified requirement/batch IDs. Inspect the run and +qualify a corrected build before a fresh full assessment; do not loop on the +unchanged failed head. Invalid evidence and simultaneous other validation defects +remain blocking without citation correction. Accepted earlier batches remain +provisional, and correction cannot reset the 120-call/30-minute ledger. + Issue-body/open-state, native owning PR/target, base and head checks still run before publication. Publication failures retain their actual completed effects and error classification; writes are never automatically replayed. diff --git a/docs/security-operations/operations/error-reference.mdx b/docs/security-operations/operations/error-reference.mdx index 0070cacdd..241cc8a0e 100644 --- a/docs/security-operations/operations/error-reference.mdx +++ b/docs/security-operations/operations/error-reference.mdx @@ -215,6 +215,23 @@ contract. Existing labels and assessments remain. Verification, review, coverage and approval are independent gates. Malformed output, provider interruption and other semantic failures retain their own error and do not receive this recovery. +An otherwise valid complete assessment containing repeated admitted citations +can use the same single replacement allowance as completion and length recovery. +It must bind to the exact current frozen request, original scope, anchors, locale +and full evidence dictionary. Correction uses the same narrative or closed-fact +profile and unchanged schema; each final citations array must contain one to +eight distinct admitted non-generated IDs. Missing, foreign, generated, stale, +malformed evidence or simultaneous semantic defects remain blocking. + +If repetition remains on the replacement, `validation.evidence-unavailable` +returns non-retryable `progress-batch-retained` with reason `evidence-duplicate` +and host-verified requirement/batch identifiers. No raw citations or rejected +prose appear in the diagnostic. Earlier accepted batches are still provisional: +none publish when any batch fails. Inspect the linked run and qualify a corrected +build before a fresh full assessment; do not repeatedly rerun the unchanged head. +Other failures keep their existing error and retryability, and no third query or +extra call/time allowance is granted. + A completed acceptance response exceeding its current `summary` or `remaining` schema bound can use that same single replacement allowance. Native measurements must bind to the exact captured schema, current batch receipts and citations, diff --git a/specs/CATALOG.md b/specs/CATALOG.md index 9662baf1a..633427f6d 100644 --- a/specs/CATALOG.md +++ b/specs/CATALOG.md @@ -10,7 +10,7 @@ debt or convert unknown historic intent into a design decision. | Capability ID | Status | Scope | Primary SDD | Evidence | |---|---|---|---|---| -| `github-communication-experience` | Implemented | English-default, localized, semantic, bounded and idempotent product messages across GitHub and repository-aware operator surfaces; complete acceptance batches and cards with stable source identities, verified published SDD provenance, shared complete-inventory text allocation, precise response diagnostics and same-head requirement evidence before Commit progress publication; shared bounded complete-batch recovery for attributable completed acceptance-field length or completion failures; bounded closed-fact recovery and compact large-inventory assessment, exact original hard allocations, explicit admission counts and non-retryable length exhaustion with separate live-provider qualification; exact JSON-byte allocation and one shared source-part size replacement for both framed profiles, captured request contracts, receipt quota revalidation and nonretryable unit-specific exhaustion | [Semantic GitHub communication and repository localization](./semantic-github-publication-and-notification.md) + 11 companion | 456 paths · 2026-11-08 | +| `github-communication-experience` | Implemented | English-default, localized, semantic, bounded and idempotent product messages across GitHub and repository-aware operator surfaces; complete acceptance batches and cards with stable source identities, verified published SDD provenance, shared complete-inventory text allocation, precise response diagnostics and same-head requirement evidence before Commit progress publication; shared bounded complete-batch recovery for attributable completed acceptance-field length or completion failures; bounded closed-fact recovery and compact large-inventory assessment, exact original hard allocations, explicit admission counts and non-retryable length exhaustion with separate live-provider qualification; exact JSON-byte allocation and one shared source-part size replacement for both framed profiles, captured request contracts, receipt quota revalidation and nonretryable unit-specific exhaustion; shared same-profile complete-batch correction for otherwise-valid repeated citations with current-request origin binding, unchanged evidence gates and nonretryable citation exhaustion | [Semantic GitHub communication and repository localization](./semantic-github-publication-and-notification.md) + 11 companion | 459 paths · 2026-11-08 | | `release-orchestration` | Implemented | Release and hotfix promotion, publication, bounded merge readiness recovery, and receipt-verified reconciliation without republication; explicit native-guarded replacement of closed unpublished candidates with complete fresh validation and bounded audit history | [Configurable production-first release orchestration](./configurable-release-orchestration.md) + 3 companion | 91 paths · 2026-10-30 | | `merge-queue-readiness` | Implemented | Fail-closed validation of required checks and merge-group workflow support; optional manual-only RepoWise analysis with independent CI and verified required-check migration; cached RepoWise exports and bounded full-history secret processing with truthful completeness and resource evidence | [Merge queue readiness and effective target rules](./merge-queue-readiness.md) | 29 paths · 2026-10-21 | | `bugbot-review-state-reconciliation` | Implemented | Reconcile review snapshots, findings, threads, comments, and check conclusions | [Bugbot review-state reconciliation](./bugbot-review-state-reconciliation.md) | 86 paths · 2026-10-26 | @@ -42,8 +42,8 @@ debt or convert unknown historic intent into a design decision. - Specifications: [`specs/semantic-github-publication-and-notification.md`](./semantic-github-publication-and-notification.md) · [`specs/repository-locale-and-localization.md`](./repository-locale-and-localization.md) · [`specs/copilot-history.md`](./copilot-history.md) · [`specs/pull-request-title-compatibility.md`](./pull-request-title-compatibility.md) · [`specs/immutable-progress-content-recovery.md`](./immutable-progress-content-recovery.md) · [`specs/optional-check-run-diagnostics.md`](./optional-check-run-diagnostics.md) · [`specs/complete-progress-comparison-inventory.md`](./complete-progress-comparison-inventory.md) · [`specs/progress-capacity-diagnostics.md`](./progress-capacity-diagnostics.md) · [`specs/progress-scope-source-ownership.md`](./progress-scope-source-ownership.md) · [`specs/progress-partition-response-recovery.md`](./progress-partition-response-recovery.md) · [`specs/final-progress-completion-recovery.md`](./final-progress-completion-recovery.md) · [`specs/batched-progress-scope.md`](./batched-progress-scope.md) - Workflows: [`.github/workflows/copilot_issue.yml`](../.github/workflows/copilot_issue.yml) · [`.github/workflows/copilot_issue_comment.yml`](../.github/workflows/copilot_issue_comment.yml) · [`.github/workflows/copilot_pull_request.yml`](../.github/workflows/copilot_pull_request.yml) · [`.github/workflows/copilot_pull_request_review_state.yml`](../.github/workflows/copilot_pull_request_review_state.yml) · [`.github/workflows/copilot_pull_request_comment.yml`](../.github/workflows/copilot_pull_request_comment.yml) · [`.github/workflows/copilot_commit.yml`](../.github/workflows/copilot_commit.yml) · [`.github/workflows/copilot_close_inactive_issues.yml`](../.github/workflows/copilot_close_inactive_issues.yml) · [`.github/workflows/copilot_deployment_orchestration.yml`](../.github/workflows/copilot_deployment_orchestration.yml) - Entrypoints: [`src/actions/github_action.ts`](../src/actions/github_action.ts) · [`src/actions/github_action_completion.ts`](../src/actions/github_action_completion.ts) · [`src/actions/github_event_inputs.ts`](../src/actions/github_event_inputs.ts) · [`src/cli_context.ts`](../src/cli_context.ts) · [`src/cli/commands/check_progress.ts`](../src/cli/commands/check_progress.ts) · [`src/cli/commands/issue_command_policy.ts`](../src/cli/commands/issue_command_policy.ts) · [`src/api.ts`](../src/api.ts) · [`src/cli.ts`](../src/cli.ts) · [`package.json`](../package.json) -- Core code: [`scripts/coverage-budgets.json`](../scripts/coverage-budgets.json) · [`scripts/validate-github-communication-test-budget.cjs`](../scripts/validate-github-communication-test-budget.cjs) · [`src/architecture/github_communication_test_budget.json`](../src/architecture/github_communication_test_budget.json) · [`src/domain/implementation_plan.ts`](../src/domain/implementation_plan.ts) · [`src/domain/locale.ts`](../src/domain/locale.ts) · [`src/domain/message_catalog.ts`](../src/domain/message_catalog.ts) · [`src/data/model/locale.ts`](../src/data/model/locale.ts) · [`src/actions/github_action_locale_inputs.ts`](../src/actions/github_action_locale_inputs.ts) · [`src/application/ports/message_catalog_ports.ts`](../src/application/ports/message_catalog_ports.ts) · [`src/application/policies/resolved_message_catalog_policy.ts`](../src/application/policies/resolved_message_catalog_policy.ts) · [`src/application/policies/action_summary_message_catalog.ts`](../src/application/policies/action_summary_message_catalog.ts) · [`src/application/policies/branch_sync_message_catalog.ts`](../src/application/policies/branch_sync_message_catalog.ts) · [`src/application/policies/inactivity_message_catalog.ts`](../src/application/policies/inactivity_message_catalog.ts) · [`src/application/policies/inactivity_notification_policy.ts`](../src/application/policies/inactivity_notification_policy.ts) · [`src/application/policies/merge_queue_message_catalog.ts`](../src/application/policies/merge_queue_message_catalog.ts) · [`src/application/policies/setup_doctor_message_catalog.ts`](../src/application/policies/setup_doctor_message_catalog.ts) · [`src/application/policies/setup_doctor_report_policy.ts`](../src/application/policies/setup_doctor_report_policy.ts) · [`src/application/usecases/localization/resolve_message_catalog_use_case.ts`](../src/application/usecases/localization/resolve_message_catalog_use_case.ts) · [`src/application/usecases/setup/doctor_use_case.ts`](../src/application/usecases/setup/doctor_use_case.ts) · [`src/application/usecases/setup/merge_queue_readiness_use_case.ts`](../src/application/usecases/setup/merge_queue_readiness_use_case.ts) · [`src/application/usecases/steps/common/comment_language_translation_workflow.ts`](../src/application/usecases/steps/common/comment_language_translation_workflow.ts) · [`src/application/policies/comment_translation_policy.ts`](../src/application/policies/comment_translation_policy.ts) · [`src/application/usecases/steps/common/think_request_policy.ts`](../src/application/usecases/steps/common/think_request_policy.ts) · [`src/application/usecases/steps/common/think_workflow.ts`](../src/application/usecases/steps/common/think_workflow.ts) · [`src/application/usecases/steps/common/think_answer_workflow.ts`](../src/application/usecases/steps/common/think_answer_workflow.ts) · [`src/application/usecases/steps/common/think_use_case.ts`](../src/application/usecases/steps/common/think_use_case.ts) · [`src/application/usecases/comment_automation_use_case.ts`](../src/application/usecases/comment_automation_use_case.ts) · [`src/application/usecases/steps/common/publish_resume_workflow.ts`](../src/application/usecases/steps/common/publish_resume_workflow.ts) · [`src/domain/github_publication.ts`](../src/domain/github_publication.ts) · [`src/domain/git_object_id.ts`](../src/domain/git_object_id.ts) · [`src/application/ports/publication_freshness_ports.ts`](../src/application/ports/publication_freshness_ports.ts) · [`src/application/policies/publication_identity_policy.ts`](../src/application/policies/publication_identity_policy.ts) · [`src/application/policies/copilot_interaction_policy.ts`](../src/application/policies/copilot_interaction_policy.ts) · [`src/application/policies/recommendation_policy.ts`](../src/application/policies/recommendation_policy.ts) · [`src/application/ports/actor_authorization_ports.ts`](../src/application/ports/actor_authorization_ports.ts) · [`src/data/repository/actor_modification_policy.ts`](../src/data/repository/actor_modification_policy.ts) · [`src/data/repository/organization/actor_authorization_repository.ts`](../src/data/repository/organization/actor_authorization_repository.ts) · [`src/application/policies/publication_outcome_policy.ts`](../src/application/policies/publication_outcome_policy.ts) · [`src/application/policies/publication_message_catalog.ts`](../src/application/policies/publication_message_catalog.ts) · [`src/application/policies/semantic_result_publication_policy.ts`](../src/application/policies/semantic_result_publication_policy.ts) · [`src/application/policies/github_comment_publication_policy.ts`](../src/application/policies/github_comment_publication_policy.ts) · [`src/application/policies/agent_response_schemas.ts`](../src/application/policies/agent_response_schemas.ts) · [`src/application/usecases/actions/recommend_steps_result_policy.ts`](../src/application/usecases/actions/recommend_steps_result_policy.ts) · [`src/application/usecases/actions/publish_issue_comment_workflow.ts`](../src/application/usecases/actions/publish_issue_comment_workflow.ts) · [`src/data/model/recommendation_state.ts`](../src/data/model/recommendation_state.ts) · [`src/data/model/config.ts`](../src/data/model/config.ts) · [`src/prompts/recommend_steps.ts`](../src/prompts/recommend_steps.ts) · [`src/application/usecases/issue_use_case.ts`](../src/application/usecases/issue_use_case.ts) · [`src/application/usecases/issue_workflow.ts`](../src/application/usecases/issue_workflow.ts) · [`src/application/usecases/issue_workflow_context.ts`](../src/application/usecases/issue_workflow_context.ts) · [`src/application/usecases/steps/issue/answer_issue_help_use_case.ts`](../src/application/usecases/steps/issue/answer_issue_help_use_case.ts) · [`src/application/usecases/steps/issue/answer_issue_help_workflow.ts`](../src/application/usecases/steps/issue/answer_issue_help_workflow.ts) · [`src/application/ports/issue_lifecycle_ports.ts`](../src/application/ports/issue_lifecycle_ports.ts) · [`src/application/usecases/steps/common/status_card_publication_workflow.ts`](../src/application/usecases/steps/common/status_card_publication_workflow.ts) · [`src/application/usecases/steps/common/reply_publication_workflow.ts`](../src/application/usecases/steps/common/reply_publication_workflow.ts) · [`src/application/usecases/steps/common/transition_notification_workflow.ts`](../src/application/usecases/steps/common/transition_notification_workflow.ts) · [`src/application/usecases/steps/common/duplicate_comment_cleanup_workflow.ts`](../src/application/usecases/steps/common/duplicate_comment_cleanup_workflow.ts) · [`src/actions/local_action.ts`](../src/actions/local_action.ts) · [`src/actions/local_action_output.ts`](../src/actions/local_action_output.ts) · [`src/cli/commands/think.ts`](../src/cli/commands/think.ts) · [`src/cli/commands/think_command_handler.ts`](../src/cli/commands/think_command_handler.ts) · [`src/infrastructure/composition/local_action_composition_root.ts`](../src/infrastructure/composition/local_action_composition_root.ts) · [`src/infrastructure/composition/main_run_route_composition_root.ts`](../src/infrastructure/composition/main_run_route_composition_root.ts) · [`src/infrastructure/composition/issue_use_case_composition_root.ts`](../src/infrastructure/composition/issue_use_case_composition_root.ts) · [`src/infrastructure/composition/shared_capability_port_binding.ts`](../src/infrastructure/composition/shared_capability_port_binding.ts) · [`src/architecture/github_publication_mutation_baseline.json`](../src/architecture/github_publication_mutation_baseline.json) · [`src/application/policies/action_summary_policy.ts`](../src/application/policies/action_summary_policy.ts) · [`src/application/policies/application_error_message_catalog.ts`](../src/application/policies/application_error_message_catalog.ts) · [`src/application/policies/application_error_presentation_policy.ts`](../src/application/policies/application_error_presentation_policy.ts) · [`src/application/policies/branch_sync_notification_policy.ts`](../src/application/policies/branch_sync_notification_policy.ts) · [`src/application/policies/bugbot_message_catalog.ts`](../src/application/policies/bugbot_message_catalog.ts) · [`src/application/policies/deployment_message_catalog.ts`](../src/application/policies/deployment_message_catalog.ts) · [`src/application/usecases/actions/observe_branch_sync_use_case.ts`](../src/application/usecases/actions/observe_branch_sync_use_case.ts) · [`src/application/usecases/actions/close_inactive_issues_use_case.ts`](../src/application/usecases/actions/close_inactive_issues_use_case.ts) · [`src/application/usecases/actions/close_inactive_issues_workflow.ts`](../src/application/usecases/actions/close_inactive_issues_workflow.ts) · [`src/application/usecases/push_single_action_contexts.ts`](../src/application/usecases/push_single_action_contexts.ts) · [`src/infrastructure/composition/issue_inactivity_composition_root.ts`](../src/infrastructure/composition/issue_inactivity_composition_root.ts) · [`src/application/policies/bugbot_review_presentation_policy.ts`](../src/application/policies/bugbot_review_presentation_policy.ts) · [`src/application/usecases/steps/commit/detect_potential_problems_workflow.ts`](../src/application/usecases/steps/commit/detect_potential_problems_workflow.ts) · [`src/application/usecases/steps/commit/bugbot/publish_pr_review_comments.ts`](../src/application/usecases/steps/commit/bugbot/publish_pr_review_comments.ts) · [`src/application/usecases/steps/commit/bugbot/resolve_issue_finding.ts`](../src/application/usecases/steps/commit/bugbot/resolve_issue_finding.ts) · [`src/application/usecases/steps/commit/bugbot/synchronize_bugbot_review_presentation_use_case.ts`](../src/application/usecases/steps/commit/bugbot/synchronize_bugbot_review_presentation_use_case.ts) · [`src/application/policies/deployment_presentation_policy.ts`](../src/application/policies/deployment_presentation_policy.ts) · [`src/application/usecases/actions/recommend_steps_workflow.ts`](../src/application/usecases/actions/recommend_steps_workflow.ts) · [`src/application/usecases/actions/check_progress_workflow.ts`](../src/application/usecases/actions/check_progress_workflow.ts) · [`src/application/usecases/actions/check_progress_use_case.ts`](../src/application/usecases/actions/check_progress_use_case.ts) · [`src/application/usecases/actions/progress_analysis_workflow.ts`](../src/application/usecases/actions/progress_analysis_workflow.ts) · [`src/application/usecases/sdd/read_progress_sdd_seed.ts`](../src/application/usecases/sdd/read_progress_sdd_seed.ts) · [`src/application/policies/progress_sdd_scope_policy.ts`](../src/application/policies/progress_sdd_scope_policy.ts) · [`src/application/ports/progress_sdd_seed_ports.ts`](../src/application/ports/progress_sdd_seed_ports.ts) · [`src/data/repository/github_publication_source_repository.ts`](../src/data/repository/github_publication_source_repository.ts) · [`src/infrastructure/composition/check_progress_composition_root.ts`](../src/infrastructure/composition/check_progress_composition_root.ts) · [`src/data/repository/issue/issue_content_repository.ts`](../src/data/repository/issue/issue_content_repository.ts) · [`src/data/repository/github/github_error_policy.ts`](../src/data/repository/github/github_error_policy.ts) · [`src/infrastructure/github/ports/github_issue_provider_ports.ts`](../src/infrastructure/github/ports/github_issue_provider_ports.ts) · [`src/application/usecases/comment_automation_command_workflow.ts`](../src/application/usecases/comment_automation_command_workflow.ts) · [`src/application/usecases/steps/commit/bugbot/dismiss_bugbot_findings_use_case.ts`](../src/application/usecases/steps/commit/bugbot/dismiss_bugbot_findings_use_case.ts) · [`src/application/policies/inactivity_result_counts_projection_policy.ts`](../src/application/policies/inactivity_result_counts_projection_policy.ts) · [`src/domain/copilot_command.ts`](../src/domain/copilot_command.ts) · [`src/domain/copilot_operation.ts`](../src/domain/copilot_operation.ts) · [`src/application/policies/copilot_history_policy.ts`](../src/application/policies/copilot_history_policy.ts) · [`src/application/policies/copilot_history_projection_policy.ts`](../src/application/policies/copilot_history_projection_policy.ts) · [`src/application/policies/copilot_history_presentation_policy.ts`](../src/application/policies/copilot_history_presentation_policy.ts) · [`src/application/ports/copilot_history_ports.ts`](../src/application/ports/copilot_history_ports.ts) · [`src/application/usecases/read_copilot_history_workflow.ts`](../src/application/usecases/read_copilot_history_workflow.ts) · [`src/infrastructure/composition/copilot_history_port_factory.ts`](../src/infrastructure/composition/copilot_history_port_factory.ts) · [`src/application/ports/progress_diff_query_ports.ts`](../src/application/ports/progress_diff_query_ports.ts) · [`src/data/repository/progress_diff_repository.ts`](../src/data/repository/progress_diff_repository.ts) · [`src/application/policies/agent_activity_policy.ts`](../src/application/policies/agent_activity_policy.ts) · [`src/domain/reply_request_digest.ts`](../src/domain/reply_request_digest.ts) · [`src/application/ports/reply_request_read_ports.ts`](../src/application/ports/reply_request_read_ports.ts) · [`src/data/repository/reply_request_repository.ts`](../src/data/repository/reply_request_repository.ts) · [`src/infrastructure/composition/reply_request_composition_root.ts`](../src/infrastructure/composition/reply_request_composition_root.ts) · [`src/infrastructure/github/ports/github_reply_request_client.ts`](../src/infrastructure/github/ports/github_reply_request_client.ts) · [`src/application/policies/retired_progress_presentation_policy.ts`](../src/application/policies/retired_progress_presentation_policy.ts) · [`src/application/usecases/actions/retire_progress_use_case.ts`](../src/application/usecases/actions/retire_progress_use_case.ts) · [`src/application/usecases/actions/retire_closed_issue_cards_use_case.ts`](../src/application/usecases/actions/retire_closed_issue_cards_use_case.ts) · [`src/application/policies/progress_diff_partition_policy.ts`](../src/application/policies/progress_diff_partition_policy.ts) · [`src/application/policies/progress_partition_response_policy.ts`](../src/application/policies/progress_partition_response_policy.ts) · [`src/application/usecases/actions/summarize_progress_diff_workflow.ts`](../src/application/usecases/actions/summarize_progress_diff_workflow.ts) · [`src/data/repository/agent_json_schema_validator.ts`](../src/data/repository/agent_json_schema_validator.ts) · [`src/data/model/application_error.ts`](../src/data/model/application_error.ts) · [`src/application/policies/pull_request_title_policy.ts`](../src/application/policies/pull_request_title_policy.ts) · [`src/application/usecases/steps/common/update_title_workflow.ts`](../src/application/usecases/steps/common/update_title_workflow.ts) · [`src/data/repository/issue/issue_title_repository.ts`](../src/data/repository/issue/issue_title_repository.ts) · [`src/domain/closed_issue_reconciliation.ts`](../src/domain/closed_issue_reconciliation.ts) · [`src/application/errors/closed_issue_reconciliation_error.ts`](../src/application/errors/closed_issue_reconciliation_error.ts) · [`src/application/policies/closed_issue_reconciliation_outcome_policy.ts`](../src/application/policies/closed_issue_reconciliation_outcome_policy.ts) · [`src/domain/copilot_command_validation.ts`](../src/domain/copilot_command_validation.ts) · [`src/application/errors/comment_command_validation_error.ts`](../src/application/errors/comment_command_validation_error.ts) · [`src/application/policies/comment_command_validation_message_catalog.ts`](../src/application/policies/comment_command_validation_message_catalog.ts) · [`src/application/policies/comment_command_validation_presentation_policy.ts`](../src/application/policies/comment_command_validation_presentation_policy.ts) · [`src/domain/copilot_command_vocabulary.ts`](../src/domain/copilot_command_vocabulary.ts) · [`src/domain/sdd_validation_diagnostic.ts`](../src/domain/sdd_validation_diagnostic.ts) · [`src/application/errors/sdd_draft_preparation_failure.ts`](../src/application/errors/sdd_draft_preparation_failure.ts) · [`src/application/policies/sdd_preparation_message_catalog.ts`](../src/application/policies/sdd_preparation_message_catalog.ts) · [`src/application/policies/sdd_preparation_status_policy.ts`](../src/application/policies/sdd_preparation_status_policy.ts) · [`src/application/policies/progress_scope_policy.ts`](../src/application/policies/progress_scope_policy.ts) · [`src/prompts/progress_scope.ts`](../src/prompts/progress_scope.ts) · [`src/prompts/check_progress.ts`](../src/prompts/check_progress.ts) · [`src/application/policies/branch_sync_relationship_retirement_policy.ts`](../src/application/policies/branch_sync_relationship_retirement_policy.ts) · [`src/application/usecases/actions/retire_unrelated_branch_sync_cards.ts`](../src/application/usecases/actions/retire_unrelated_branch_sync_cards.ts) · [`src/application/policies/progress_content_evidence_policy.ts`](../src/application/policies/progress_content_evidence_policy.ts) · [`src/application/policies/progress_patch_completeness_policy.ts`](../src/application/policies/progress_patch_completeness_policy.ts) · [`src/data/repository/immutable_progress_content_repository.ts`](../src/data/repository/immutable_progress_content_repository.ts) · [`src/infrastructure/github/ports/github_progress_object_provider_port.ts`](../src/infrastructure/github/ports/github_progress_object_provider_port.ts) · [`src/application/policies/progress_comparison_source_policy.ts`](../src/application/policies/progress_comparison_source_policy.ts) · [`src/application/ports/progress_comparison_source_ports.ts`](../src/application/ports/progress_comparison_source_ports.ts) · [`src/data/repository/progress_comparison_source_repository.ts`](../src/data/repository/progress_comparison_source_repository.ts) · [`src/domain/progress_binary_evidence_diagnostic.ts`](../src/domain/progress_binary_evidence_diagnostic.ts) · [`src/domain/progress_evidence_path.ts`](../src/domain/progress_evidence_path.ts) · [`src/infrastructure/github/ports/github_progress_comparison_provider_port.ts`](../src/infrastructure/github/ports/github_progress_comparison_provider_port.ts) · [`src/application/ports/copilot_evidence_error.ts`](../src/application/ports/copilot_evidence_error.ts) · [`src/application/policies/optional_check_diagnostic_policy.ts`](../src/application/policies/optional_check_diagnostic_policy.ts) · [`src/data/repository/github/copilot_evidence_provider_failure.ts`](../src/data/repository/github/copilot_evidence_provider_failure.ts) · [`src/application/policies/progress_evidence_protocol_policy.ts`](../src/application/policies/progress_evidence_protocol_policy.ts) · [`src/application/policies/progress_partition_receipt_policy.ts`](../src/application/policies/progress_partition_receipt_policy.ts) · [`src/application/policies/progress_prompt_capacity_policy.ts`](../src/application/policies/progress_prompt_capacity_policy.ts) · [`src/application/policies/progress_recovery_capacity_policy.ts`](../src/application/policies/progress_recovery_capacity_policy.ts) · [`src/application/policies/agent_prompt_envelope_policy.ts`](../src/application/policies/agent_prompt_envelope_policy.ts) · [`src/data/repository/ai/agent_capability_adapter.ts`](../src/data/repository/ai/agent_capability_adapter.ts) · [`src/domain/progress_response_diagnostic.ts`](../src/domain/progress_response_diagnostic.ts) · [`src/domain/agent_response_schema_failure.ts`](../src/domain/agent_response_schema_failure.ts) · [`src/data/repository/progress_agent_response_policy.ts`](../src/data/repository/progress_agent_response_policy.ts) · [`src/application/policies/progress_response_rejection_policy.ts`](../src/application/policies/progress_response_rejection_policy.ts) · [`src/application/usecases/actions/query_progress_result_workflow.ts`](../src/application/usecases/actions/query_progress_result_workflow.ts) · [`src/application/policies/immutable_progress_tree_policy.ts`](../src/application/policies/immutable_progress_tree_policy.ts) · [`src/application/policies/progress_inventory_profile_policy.ts`](../src/application/policies/progress_inventory_profile_policy.ts) · [`src/application/policies/progress_inventory_error_policy.ts`](../src/application/policies/progress_inventory_error_policy.ts) · [`src/application/policies/immutable_progress_units_policy.ts`](../src/application/policies/immutable_progress_units_policy.ts) · [`src/data/repository/immutable_progress_inventory_repository.ts`](../src/data/repository/immutable_progress_inventory_repository.ts) · [`src/data/repository/complete_progress_diff_repository.ts`](../src/data/repository/complete_progress_diff_repository.ts) · [`src/domain/progress_inventory_diagnostic.ts`](../src/domain/progress_inventory_diagnostic.ts) · [`src/domain/progress_capacity_diagnostic.ts`](../src/domain/progress_capacity_diagnostic.ts) · [`src/application/policies/progress_assessment_capacity_policy.ts`](../src/application/policies/progress_assessment_capacity_policy.ts) · [`src/application/policies/progress_scope_source_policy.ts`](../src/application/policies/progress_scope_source_policy.ts) · [`src/domain/progress_partition_length_failure.ts`](../src/domain/progress_partition_length_failure.ts) · [`src/data/repository/progress_partition_length_failure.ts`](../src/data/repository/progress_partition_length_failure.ts) · [`src/application/policies/progress_partition_length_policy.ts`](../src/application/policies/progress_partition_length_policy.ts) · [`src/application/usecases/actions/query_progress_partition_workflow.ts`](../src/application/usecases/actions/query_progress_partition_workflow.ts) · [`src/domain/progress_completion_diagnostic.ts`](../src/domain/progress_completion_diagnostic.ts) · [`src/application/errors/progress_completion_mismatch.ts`](../src/application/errors/progress_completion_mismatch.ts) · [`src/application/policies/progress_completion_recovery_policy.ts`](../src/application/policies/progress_completion_recovery_policy.ts) · [`src/application/usecases/actions/query_progress_assessment_workflow.ts`](../src/application/usecases/actions/query_progress_assessment_workflow.ts) · [`src/application/errors/progress_capacity_failure.ts`](../src/application/errors/progress_capacity_failure.ts) · [`src/application/policies/progress_capacity_context_policy.ts`](../src/application/policies/progress_capacity_context_policy.ts) · [`src/application/policies/progress_capacity_source_context_policy.ts`](../src/application/policies/progress_capacity_source_context_policy.ts) · [`src/application/policies/progress_capacity_messages.ts`](../src/application/policies/progress_capacity_messages.ts) · [`src/application/policies/progress_capacity_presentation_policy.ts`](../src/application/policies/progress_capacity_presentation_policy.ts) · [`src/domain/progress_batch_diagnostic.ts`](../src/domain/progress_batch_diagnostic.ts) · [`src/application/policies/progress_batch_policy.ts`](../src/application/policies/progress_batch_policy.ts) · [`src/application/policies/progress_batch_query_policy.ts`](../src/application/policies/progress_batch_query_policy.ts) · [`src/application/policies/progress_batch_rejection_policy.ts`](../src/application/policies/progress_batch_rejection_policy.ts) · [`src/application/usecases/actions/progress_batch_workflow.ts`](../src/application/usecases/actions/progress_batch_workflow.ts) · [`src/domain/progress_assessment_length_failure.ts`](../src/domain/progress_assessment_length_failure.ts) · [`src/data/repository/progress_assessment_length_failure.ts`](../src/data/repository/progress_assessment_length_failure.ts) · [`src/application/policies/progress_assessment_length_policy.ts`](../src/application/policies/progress_assessment_length_policy.ts) · [`src/application/policies/progress_compact_assessment_policy.ts`](../src/application/policies/progress_compact_assessment_policy.ts) · [`src/application/policies/progress_partition_byte_policy.ts`](../src/application/policies/progress_partition_byte_policy.ts) · [`src/domain/bugbot/review_freshness_failure.ts`](../src/domain/bugbot/review_freshness_failure.ts) · [`src/application/errors/bugbot_freshness_error.ts`](../src/application/errors/bugbot_freshness_error.ts) · [`src/application/policies/pull_request_review_provider_code_policy.ts`](../src/application/policies/pull_request_review_provider_code_policy.ts) · [`src/application/ports/pull_request_review_errors.ts`](../src/application/ports/pull_request_review_errors.ts) · [`src/application/usecases/steps/commit/bugbot/bugbot_review_freshness.ts`](../src/application/usecases/steps/commit/bugbot/bugbot_review_freshness.ts) · [`src/data/repository/pull_request/pull_request_lifecycle_repository.ts`](../src/data/repository/pull_request/pull_request_lifecycle_repository.ts) · [`src/data/repository/pull_request/pull_request_changes_repository.ts`](../src/data/repository/pull_request/pull_request_changes_repository.ts) -- Tests: [`src/domain/__tests__/implementation_plan.test.ts`](../src/domain/__tests__/implementation_plan.test.ts) · [`src/domain/__tests__/locale.test.ts`](../src/domain/__tests__/locale.test.ts) · [`src/domain/__tests__/message_catalog.test.ts`](../src/domain/__tests__/message_catalog.test.ts) · [`src/actions/__tests__/configuration_builders.test.ts`](../src/actions/__tests__/configuration_builders.test.ts) · [`src/actions/__tests__/github_event_inputs.test.ts`](../src/actions/__tests__/github_event_inputs.test.ts) · [`src/cli/commands/__tests__/issue_command_policy.test.ts`](../src/cli/commands/__tests__/issue_command_policy.test.ts) · [`src/actions/__tests__/github_action_completion.test.ts`](../src/actions/__tests__/github_action_completion.test.ts) · [`src/data/model/__tests__/config.test.ts`](../src/data/model/__tests__/config.test.ts) · [`src/application/policies/__tests__/agent_response_schemas.test.ts`](../src/application/policies/__tests__/agent_response_schemas.test.ts) · [`src/prompts/__tests__/recommend_steps.test.ts`](../src/prompts/__tests__/recommend_steps.test.ts) · [`src/application/policies/__tests__/comment_translation_policy.test.ts`](../src/application/policies/__tests__/comment_translation_policy.test.ts) · [`src/application/policies/__tests__/action_summary_message_catalog.test.ts`](../src/application/policies/__tests__/action_summary_message_catalog.test.ts) · [`src/application/policies/__tests__/application_error_message_catalog.test.ts`](../src/application/policies/__tests__/application_error_message_catalog.test.ts) · [`src/application/policies/__tests__/application_error_presentation_policy.test.ts`](../src/application/policies/__tests__/application_error_presentation_policy.test.ts) · [`src/application/usecases/localization/__tests__/resolve_message_catalog_use_case.test.ts`](../src/application/usecases/localization/__tests__/resolve_message_catalog_use_case.test.ts) · [`src/prompts/__tests__/localize_message_catalog.test.ts`](../src/prompts/__tests__/localize_message_catalog.test.ts) · [`src/domain/__tests__/github_publication.test.ts`](../src/domain/__tests__/github_publication.test.ts) · [`src/domain/__tests__/git_object_id.test.ts`](../src/domain/__tests__/git_object_id.test.ts) · [`src/data/repository/__tests__/github_publication_source_repository.test.ts`](../src/data/repository/__tests__/github_publication_source_repository.test.ts) · [`src/application/policies/__tests__/publication_identity_policy.test.ts`](../src/application/policies/__tests__/publication_identity_policy.test.ts) · [`src/application/policies/__tests__/publication_outcome_policy.test.ts`](../src/application/policies/__tests__/publication_outcome_policy.test.ts) · [`src/application/policies/__tests__/publication_message_catalog.test.ts`](../src/application/policies/__tests__/publication_message_catalog.test.ts) · [`src/application/policies/__tests__/semantic_result_publication_policy.test.ts`](../src/application/policies/__tests__/semantic_result_publication_policy.test.ts) · [`src/application/policies/__tests__/github_comment_publication_policy.test.ts`](../src/application/policies/__tests__/github_comment_publication_policy.test.ts) · [`src/application/policies/__tests__/action_summary_policy.test.ts`](../src/application/policies/__tests__/action_summary_policy.test.ts) · [`src/application/policies/__tests__/branch_sync_notification_policy.test.ts`](../src/application/policies/__tests__/branch_sync_notification_policy.test.ts) · [`src/application/policies/__tests__/inactivity_message_catalog.test.ts`](../src/application/policies/__tests__/inactivity_message_catalog.test.ts) · [`src/application/policies/__tests__/inactivity_notification_policy.test.ts`](../src/application/policies/__tests__/inactivity_notification_policy.test.ts) · [`src/application/policies/__tests__/setup_doctor_message_catalog.test.ts`](../src/application/policies/__tests__/setup_doctor_message_catalog.test.ts) · [`src/application/policies/__tests__/setup_doctor_report_policy.test.ts`](../src/application/policies/__tests__/setup_doctor_report_policy.test.ts) · [`src/application/usecases/actions/__tests__/observe_branch_sync_use_case.test.ts`](../src/application/usecases/actions/__tests__/observe_branch_sync_use_case.test.ts) · [`src/application/usecases/setup/__tests__/doctor_use_case.test.ts`](../src/application/usecases/setup/__tests__/doctor_use_case.test.ts) · [`src/application/usecases/setup/__tests__/merge_queue_readiness_use_case.test.ts`](../src/application/usecases/setup/__tests__/merge_queue_readiness_use_case.test.ts) · [`src/application/policies/__tests__/bugbot_message_catalog.test.ts`](../src/application/policies/__tests__/bugbot_message_catalog.test.ts) · [`src/application/policies/__tests__/deployment_message_catalog.test.ts`](../src/application/policies/__tests__/deployment_message_catalog.test.ts) · [`src/application/policies/__tests__/bugbot_review_presentation_policy.test.ts`](../src/application/policies/__tests__/bugbot_review_presentation_policy.test.ts) · [`src/application/usecases/steps/commit/__tests__/detect_potential_problems_use_case.test.ts`](../src/application/usecases/steps/commit/__tests__/detect_potential_problems_use_case.test.ts) · [`src/application/usecases/steps/commit/bugbot/__tests__/dismiss_bugbot_findings_use_case.test.ts`](../src/application/usecases/steps/commit/bugbot/__tests__/dismiss_bugbot_findings_use_case.test.ts) · [`src/application/usecases/steps/commit/bugbot/__tests__/synchronize_bugbot_review_presentation_use_case.test.ts`](../src/application/usecases/steps/commit/bugbot/__tests__/synchronize_bugbot_review_presentation_use_case.test.ts) · [`src/application/policies/__tests__/deployment_presentation_policy.test.ts`](../src/application/policies/__tests__/deployment_presentation_policy.test.ts) · [`src/application/usecases/actions/__tests__/close_inactive_issues_use_case.test.ts`](../src/application/usecases/actions/__tests__/close_inactive_issues_use_case.test.ts) · [`src/application/usecases/__tests__/push_single_action_contexts.test.ts`](../src/application/usecases/__tests__/push_single_action_contexts.test.ts) · [`src/application/usecases/steps/common/__tests__/comment_language_translation_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/comment_language_translation_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/think_request_policy.test.ts`](../src/application/usecases/steps/common/__tests__/think_request_policy.test.ts) · [`src/application/usecases/steps/common/__tests__/think_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/think_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/publish_resume_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/publish_resume_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/status_card_publication_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/status_card_publication_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/reply_publication_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/reply_publication_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/transition_notification_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/transition_notification_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/duplicate_comment_cleanup_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/duplicate_comment_cleanup_workflow.test.ts) · [`src/data/repository/issue/__tests__/issue_content_repository.test.ts`](../src/data/repository/issue/__tests__/issue_content_repository.test.ts) · [`src/data/repository/deployment/__tests__/deployment_presentation_repository.test.ts`](../src/data/repository/deployment/__tests__/deployment_presentation_repository.test.ts) · [`src/data/repository/__tests__/github_error_policy.test.ts`](../src/data/repository/__tests__/github_error_policy.test.ts) · [`src/application/usecases/steps/issue/__tests__/answer_issue_help_use_case.test.ts`](../src/application/usecases/steps/issue/__tests__/answer_issue_help_use_case.test.ts) · [`src/application/usecases/__tests__/issue_use_case.test.ts`](../src/application/usecases/__tests__/issue_use_case.test.ts) · [`src/application/usecases/__tests__/issue_pull_request_context_projection.test.ts`](../src/application/usecases/__tests__/issue_pull_request_context_projection.test.ts) · [`src/actions/__tests__/local_action.test.ts`](../src/actions/__tests__/local_action.test.ts) · [`src/actions/__tests__/github_action.test.ts`](../src/actions/__tests__/github_action.test.ts) · [`src/data/repository/__tests__/actor_modification_policy.test.ts`](../src/data/repository/__tests__/actor_modification_policy.test.ts) · [`src/data/repository/organization/__tests__/actor_authorization_repository.test.ts`](../src/data/repository/organization/__tests__/actor_authorization_repository.test.ts) · [`src/__tests__/cli.test.ts`](../src/__tests__/cli.test.ts) · [`src/cli/commands/__tests__/think_command_handler.test.ts`](../src/cli/commands/__tests__/think_command_handler.test.ts) · [`src/infrastructure/composition/__tests__/local_action_composition_root.test.ts`](../src/infrastructure/composition/__tests__/local_action_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/main_run_route_composition_root.test.ts`](../src/infrastructure/composition/__tests__/main_run_route_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/issue_use_case_composition_root.test.ts`](../src/infrastructure/composition/__tests__/issue_use_case_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/shared_capability_port_binding.test.ts`](../src/infrastructure/composition/__tests__/shared_capability_port_binding.test.ts) · [`src/infrastructure/composition/__tests__/pull_request_use_case_composition_root.test.ts`](../src/infrastructure/composition/__tests__/pull_request_use_case_composition_root.test.ts) · [`src/architecture/__tests__/github_publication_boundaries.test.ts`](../src/architecture/__tests__/github_publication_boundaries.test.ts) · [`src/application/usecases/steps/common/__tests__/publication_concurrency.integration.test.ts`](../src/application/usecases/steps/common/__tests__/publication_concurrency.integration.test.ts) · [`src/tooling/__tests__/validate_github_communication_test_budget.test.ts`](../src/tooling/__tests__/validate_github_communication_test_budget.test.ts) · [`src/tooling/__tests__/validate_workflow_contract.test.ts`](../src/tooling/__tests__/validate_workflow_contract.test.ts) · [`src/application/usecases/actions/__tests__/recommend_steps_use_case.test.ts`](../src/application/usecases/actions/__tests__/recommend_steps_use_case.test.ts) · [`src/application/usecases/actions/__tests__/check_progress_use_case.test.ts`](../src/application/usecases/actions/__tests__/check_progress_use_case.test.ts) · [`src/application/usecases/__tests__/comment_automation_use_case.test.ts`](../src/application/usecases/__tests__/comment_automation_use_case.test.ts) · [`src/domain/__tests__/copilot_operation.test.ts`](../src/domain/__tests__/copilot_operation.test.ts) · [`src/application/policies/__tests__/copilot_history_policy.test.ts`](../src/application/policies/__tests__/copilot_history_policy.test.ts) · [`src/application/policies/__tests__/copilot_history_presentation_policy.test.ts`](../src/application/policies/__tests__/copilot_history_presentation_policy.test.ts) · [`src/application/policies/__tests__/copilot_operation_publication.test.ts`](../src/application/policies/__tests__/copilot_operation_publication.test.ts) · [`src/application/usecases/__tests__/copilot_history_route.test.ts`](../src/application/usecases/__tests__/copilot_history_route.test.ts) · [`src/application/usecases/__tests__/copilot_history_workflow.test.ts`](../src/application/usecases/__tests__/copilot_history_workflow.test.ts) · [`src/infrastructure/composition/__tests__/copilot_history_port_factory.test.ts`](../src/infrastructure/composition/__tests__/copilot_history_port_factory.test.ts) · [`src/data/repository/__tests__/progress_diff_repository.test.ts`](../src/data/repository/__tests__/progress_diff_repository.test.ts) · [`src/application/policies/__tests__/agent_activity_policy.test.ts`](../src/application/policies/__tests__/agent_activity_policy.test.ts) · [`src/data/repository/__tests__/reply_request_repository.test.ts`](../src/data/repository/__tests__/reply_request_repository.test.ts) · [`src/application/usecases/steps/common/__tests__/reply_request_publication.test.ts`](../src/application/usecases/steps/common/__tests__/reply_request_publication.test.ts) · [`src/infrastructure/composition/__tests__/reply_request_composition_root.test.ts`](../src/infrastructure/composition/__tests__/reply_request_composition_root.test.ts) · [`src/application/policies/__tests__/retired_progress_presentation_policy.test.ts`](../src/application/policies/__tests__/retired_progress_presentation_policy.test.ts) · [`src/application/usecases/actions/__tests__/retire_progress_use_case.test.ts`](../src/application/usecases/actions/__tests__/retire_progress_use_case.test.ts) · [`src/application/usecases/actions/__tests__/retire_closed_issue_cards_use_case.test.ts`](../src/application/usecases/actions/__tests__/retire_closed_issue_cards_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/retired_progress_publication.integration.test.ts`](../src/application/usecases/steps/common/__tests__/retired_progress_publication.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_native_closure.test.ts`](../src/application/usecases/actions/__tests__/progress_native_closure.test.ts) · [`src/application/policies/__tests__/progress_diff_partition_policy.test.ts`](../src/application/policies/__tests__/progress_diff_partition_policy.test.ts) · [`src/application/policies/__tests__/progress_partition_response_policy.test.ts`](../src/application/policies/__tests__/progress_partition_response_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_multipart.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_multipart.integration.test.ts) · [`src/tooling/__tests__/progress_capacity_failure.test.ts`](../src/tooling/__tests__/progress_capacity_failure.test.ts) · [`src/domain/__tests__/progress_capacity_diagnostic.test.ts`](../src/domain/__tests__/progress_capacity_diagnostic.test.ts) · [`src/data/repository/__tests__/agent_json_schema_validator.test.ts`](../src/data/repository/__tests__/agent_json_schema_validator.test.ts) · [`src/application/errors/__tests__/application_error.test.ts`](../src/application/errors/__tests__/application_error.test.ts) · [`src/application/policies/__tests__/pull_request_title_policy.test.ts`](../src/application/policies/__tests__/pull_request_title_policy.test.ts) · [`src/application/usecases/steps/common/__tests__/pull_request_title_compatibility.test.ts`](../src/application/usecases/steps/common/__tests__/pull_request_title_compatibility.test.ts) · [`src/application/usecases/steps/common/__tests__/update_title_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/update_title_use_case.test.ts) · [`src/data/repository/issue/__tests__/issue_title_repository.test.ts`](../src/data/repository/issue/__tests__/issue_title_repository.test.ts) · [`src/domain/__tests__/copilot_command_validation.test.ts`](../src/domain/__tests__/copilot_command_validation.test.ts) · [`src/application/policies/__tests__/comment_command_validation_presentation.test.ts`](../src/application/policies/__tests__/comment_command_validation_presentation.test.ts) · [`src/application/usecases/__tests__/command_validation_diagnostics.test.ts`](../src/application/usecases/__tests__/command_validation_diagnostics.test.ts) · [`src/domain/__tests__/sdd_validation_diagnostic.test.ts`](../src/domain/__tests__/sdd_validation_diagnostic.test.ts) · [`src/application/policies/__tests__/sdd_preparation_status_policy.test.ts`](../src/application/policies/__tests__/sdd_preparation_status_policy.test.ts) · [`src/application/policies/__tests__/progress_scope_policy.test.ts`](../src/application/policies/__tests__/progress_scope_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_scope.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_scope.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_response.test.ts`](../src/application/usecases/actions/__tests__/progress_response.test.ts) · [`src/prompts/__tests__/check_progress.test.ts`](../src/prompts/__tests__/check_progress.test.ts) · [`src/prompts/__tests__/progress_scope.test.ts`](../src/prompts/__tests__/progress_scope.test.ts) · [`src/application/usecases/actions/__tests__/retire_unrelated_branch_sync_cards.test.ts`](../src/application/usecases/actions/__tests__/retire_unrelated_branch_sync_cards.test.ts) · [`src/application/policies/__tests__/progress_content_evidence_policy.test.ts`](../src/application/policies/__tests__/progress_content_evidence_policy.test.ts) · [`src/application/policies/__tests__/progress_patch_completeness_policy.test.ts`](../src/application/policies/__tests__/progress_patch_completeness_policy.test.ts) · [`src/data/repository/__tests__/immutable_progress_content_repository.test.ts`](../src/data/repository/__tests__/immutable_progress_content_repository.test.ts) · [`src/data/repository/__tests__/progress_diff_recovery.test.ts`](../src/data/repository/__tests__/progress_diff_recovery.test.ts) · [`src/application/policies/__tests__/progress_comparison_source_policy.test.ts`](../src/application/policies/__tests__/progress_comparison_source_policy.test.ts) · [`src/data/repository/__tests__/progress_comparison_source_repository.test.ts`](../src/data/repository/__tests__/progress_comparison_source_repository.test.ts) · [`src/application/usecases/actions/__tests__/progress_comparison_source.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_comparison_source.integration.test.ts) · [`src/domain/__tests__/progress_binary_evidence_diagnostic.test.ts`](../src/domain/__tests__/progress_binary_evidence_diagnostic.test.ts) · [`src/data/repository/__tests__/progress_binary_evidence.test.ts`](../src/data/repository/__tests__/progress_binary_evidence.test.ts) · [`src/infrastructure/composition/__tests__/progress_comparison_binding.test.ts`](../src/infrastructure/composition/__tests__/progress_comparison_binding.test.ts) · [`src/application/policies/__tests__/optional_check_diagnostic_policy.test.ts`](../src/application/policies/__tests__/optional_check_diagnostic_policy.test.ts) · [`src/data/repository/__tests__/copilot_evidence_failure.test.ts`](../src/data/repository/__tests__/copilot_evidence_failure.test.ts) · [`src/actions/__tests__/optional_check_completion.test.ts`](../src/actions/__tests__/optional_check_completion.test.ts) · [`src/architecture/__tests__/raw_error_logging_boundaries.test.ts`](../src/architecture/__tests__/raw_error_logging_boundaries.test.ts) · [`src/data/repository/__tests__/progress_framed_recovery.test.ts`](../src/data/repository/__tests__/progress_framed_recovery.test.ts) · [`src/application/usecases/actions/__tests__/progress_framed_protocol.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_framed_protocol.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_large_comparison.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_large_comparison.integration.test.ts) · [`src/application/policies/__tests__/progress_framed_diagnostics.test.ts`](../src/application/policies/__tests__/progress_framed_diagnostics.test.ts) · [`src/application/policies/__tests__/progress_partition_receipt_policy.test.ts`](../src/application/policies/__tests__/progress_partition_receipt_policy.test.ts) · [`src/application/policies/__tests__/progress_prompt_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_prompt_capacity_policy.test.ts) · [`src/application/policies/__tests__/progress_evidence_protocol_policy.test.ts`](../src/application/policies/__tests__/progress_evidence_protocol_policy.test.ts) · [`src/application/policies/__tests__/progress_recovery_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_recovery_capacity_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_prompt_preflight.test.ts`](../src/application/usecases/actions/__tests__/progress_prompt_preflight.test.ts) · [`src/application/usecases/actions/__tests__/progress_agent_prompt_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_agent_prompt_capacity.integration.test.ts) · [`src/domain/__tests__/progress_response_diagnostic.test.ts`](../src/domain/__tests__/progress_response_diagnostic.test.ts) · [`src/data/repository/__tests__/progress_agent_response_policy.test.ts`](../src/data/repository/__tests__/progress_agent_response_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_result_rejection.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_result_rejection.integration.test.ts) · [`src/application/policies/__tests__/progress_rejection_diagnostics.test.ts`](../src/application/policies/__tests__/progress_rejection_diagnostics.test.ts) · [`src/application/policies/__tests__/progress_response_error_presentation.test.ts`](../src/application/policies/__tests__/progress_response_error_presentation.test.ts) · [`src/application/policies/__tests__/immutable_progress_units_policy.test.ts`](../src/application/policies/__tests__/immutable_progress_units_policy.test.ts) · [`src/application/policies/__tests__/immutable_progress_tree_policy.test.ts`](../src/application/policies/__tests__/immutable_progress_tree_policy.test.ts) · [`src/application/policies/__tests__/progress_inventory_profile_policy.test.ts`](../src/application/policies/__tests__/progress_inventory_profile_policy.test.ts) · [`src/application/usecases/actions/__tests__/complete_progress_inventory.integration.test.ts`](../src/application/usecases/actions/__tests__/complete_progress_inventory.integration.test.ts) · [`src/data/repository/__tests__/immutable_progress_inventory_repository.test.ts`](../src/data/repository/__tests__/immutable_progress_inventory_repository.test.ts) · [`src/data/repository/__tests__/complete_progress_diff_repository.test.ts`](../src/data/repository/__tests__/complete_progress_diff_repository.test.ts) · [`src/data/repository/__tests__/support/immutable_progress_inventory_fixture.ts`](../src/data/repository/__tests__/support/immutable_progress_inventory_fixture.ts) · [`src/domain/__tests__/progress_inventory_diagnostic.test.ts`](../src/domain/__tests__/progress_inventory_diagnostic.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/complete_inventory_workflow_fixture.ts`](../src/application/usecases/actions/__tests__/fixtures/complete_inventory_workflow_fixture.ts) · [`src/data/repository/__tests__/support/large_complete_progress_fixture.ts`](../src/data/repository/__tests__/support/large_complete_progress_fixture.ts) · [`src/application/policies/__tests__/progress_assessment_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_assessment_capacity_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_assessment_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_assessment_capacity.integration.test.ts) · [`src/application/policies/__tests__/progress_scope_ownership.test.ts`](../src/application/policies/__tests__/progress_scope_ownership.test.ts) · [`src/application/policies/__tests__/progress_scope_capacity_diagnostic.test.ts`](../src/application/policies/__tests__/progress_scope_capacity_diagnostic.test.ts) · [`src/application/usecases/actions/__tests__/progress_scope_ownership.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_scope_ownership.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_sdd_seed.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_sdd_seed.integration.test.ts) · [`src/application/policies/__tests__/progress_partition_length_policy.test.ts`](../src/application/policies/__tests__/progress_partition_length_policy.test.ts) · [`src/application/policies/__tests__/progress_partition_length_presentation.test.ts`](../src/application/policies/__tests__/progress_partition_length_presentation.test.ts) · [`src/data/repository/__tests__/progress_partition_length_failure.test.ts`](../src/data/repository/__tests__/progress_partition_length_failure.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_length.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_length.integration.test.ts) · [`src/application/usecases/actions/__tests__/query_progress_partition_workflow.test.ts`](../src/application/usecases/actions/__tests__/query_progress_partition_workflow.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_length_publication.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_length_publication.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_repair_preflight.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_repair_preflight.test.ts) · [`src/domain/__tests__/progress_completion_diagnostic.test.ts`](../src/domain/__tests__/progress_completion_diagnostic.test.ts) · [`src/application/policies/__tests__/progress_completion_recovery_policy.test.ts`](../src/application/policies/__tests__/progress_completion_recovery_policy.test.ts) · [`src/application/usecases/actions/__tests__/query_progress_assessment_workflow.test.ts`](../src/application/usecases/actions/__tests__/query_progress_assessment_workflow.test.ts) · [`src/application/usecases/actions/__tests__/progress_completion_recovery.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_completion_recovery.integration.test.ts) · [`src/application/policies/__tests__/progress_completion_recovery_presentation.test.ts`](../src/application/policies/__tests__/progress_completion_recovery_presentation.test.ts) · [`src/application/usecases/actions/__tests__/progress_recovery_composition.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_recovery_composition.integration.test.ts) · [`src/application/policies/__tests__/progress_capacity_context.test.ts`](../src/application/policies/__tests__/progress_capacity_context.test.ts) · [`src/application/policies/__tests__/progress_capacity_boundaries.test.ts`](../src/application/policies/__tests__/progress_capacity_boundaries.test.ts) · [`src/application/policies/__tests__/progress_capacity_public.test.ts`](../src/application/policies/__tests__/progress_capacity_public.test.ts) · [`src/application/policies/__tests__/progress_capacity_profiles.test.ts`](../src/application/policies/__tests__/progress_capacity_profiles.test.ts) · [`src/application/usecases/actions/__tests__/progress_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_capacity.integration.test.ts) · [`src/data/repository/__tests__/progress_capacity_adapter.test.ts`](../src/data/repository/__tests__/progress_capacity_adapter.test.ts) · [`src/application/policies/__tests__/progress_batch_policy.test.ts`](../src/application/policies/__tests__/progress_batch_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_batches.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_batches.integration.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/domus-29-immutable-replay.json.gz.hex`](../src/application/usecases/actions/__tests__/fixtures/domus-29-immutable-replay.json.gz.hex) · [`src/application/usecases/actions/__tests__/support/progress_batch_response.ts`](../src/application/usecases/actions/__tests__/support/progress_batch_response.ts) · [`src/application/usecases/actions/__tests__/progress_assessment_length_recovery.test.ts`](../src/application/usecases/actions/__tests__/progress_assessment_length_recovery.test.ts) · [`src/application/policies/__tests__/progress_assessment_length_policy.test.ts`](../src/application/policies/__tests__/progress_assessment_length_policy.test.ts) · [`src/application/policies/__tests__/progress_assessment_length_presentation.test.ts`](../src/application/policies/__tests__/progress_assessment_length_presentation.test.ts) · [`src/data/repository/__tests__/progress_assessment_length_failure.test.ts`](../src/data/repository/__tests__/progress_assessment_length_failure.test.ts) · [`src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/domus-29-native-937.json.gz.hex`](../src/application/usecases/actions/__tests__/fixtures/domus-29-native-937.json.gz.hex) · [`src/application/policies/__tests__/progress_compact_assessment_policy.test.ts`](../src/application/policies/__tests__/progress_compact_assessment_policy.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/progress_assessment_wire_fixture.ts`](../src/application/usecases/actions/__tests__/fixtures/progress_assessment_wire_fixture.ts) · [`src/application/policies/__tests__/progress_partition_byte_recovery.test.ts`](../src/application/policies/__tests__/progress_partition_byte_recovery.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_byte_publication.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_byte_publication.integration.test.ts) · [`src/application/policies/__tests__/bugbot_freshness_diagnostics.test.ts`](../src/application/policies/__tests__/bugbot_freshness_diagnostics.test.ts) · [`src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts`](../src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts) +- Core code: [`scripts/coverage-budgets.json`](../scripts/coverage-budgets.json) · [`scripts/validate-github-communication-test-budget.cjs`](../scripts/validate-github-communication-test-budget.cjs) · [`src/architecture/github_communication_test_budget.json`](../src/architecture/github_communication_test_budget.json) · [`src/domain/implementation_plan.ts`](../src/domain/implementation_plan.ts) · [`src/domain/locale.ts`](../src/domain/locale.ts) · [`src/domain/message_catalog.ts`](../src/domain/message_catalog.ts) · [`src/data/model/locale.ts`](../src/data/model/locale.ts) · [`src/actions/github_action_locale_inputs.ts`](../src/actions/github_action_locale_inputs.ts) · [`src/application/ports/message_catalog_ports.ts`](../src/application/ports/message_catalog_ports.ts) · [`src/application/policies/resolved_message_catalog_policy.ts`](../src/application/policies/resolved_message_catalog_policy.ts) · [`src/application/policies/action_summary_message_catalog.ts`](../src/application/policies/action_summary_message_catalog.ts) · [`src/application/policies/branch_sync_message_catalog.ts`](../src/application/policies/branch_sync_message_catalog.ts) · [`src/application/policies/inactivity_message_catalog.ts`](../src/application/policies/inactivity_message_catalog.ts) · [`src/application/policies/inactivity_notification_policy.ts`](../src/application/policies/inactivity_notification_policy.ts) · [`src/application/policies/merge_queue_message_catalog.ts`](../src/application/policies/merge_queue_message_catalog.ts) · [`src/application/policies/setup_doctor_message_catalog.ts`](../src/application/policies/setup_doctor_message_catalog.ts) · [`src/application/policies/setup_doctor_report_policy.ts`](../src/application/policies/setup_doctor_report_policy.ts) · [`src/application/usecases/localization/resolve_message_catalog_use_case.ts`](../src/application/usecases/localization/resolve_message_catalog_use_case.ts) · [`src/application/usecases/setup/doctor_use_case.ts`](../src/application/usecases/setup/doctor_use_case.ts) · [`src/application/usecases/setup/merge_queue_readiness_use_case.ts`](../src/application/usecases/setup/merge_queue_readiness_use_case.ts) · [`src/application/usecases/steps/common/comment_language_translation_workflow.ts`](../src/application/usecases/steps/common/comment_language_translation_workflow.ts) · [`src/application/policies/comment_translation_policy.ts`](../src/application/policies/comment_translation_policy.ts) · [`src/application/usecases/steps/common/think_request_policy.ts`](../src/application/usecases/steps/common/think_request_policy.ts) · [`src/application/usecases/steps/common/think_workflow.ts`](../src/application/usecases/steps/common/think_workflow.ts) · [`src/application/usecases/steps/common/think_answer_workflow.ts`](../src/application/usecases/steps/common/think_answer_workflow.ts) · [`src/application/usecases/steps/common/think_use_case.ts`](../src/application/usecases/steps/common/think_use_case.ts) · [`src/application/usecases/comment_automation_use_case.ts`](../src/application/usecases/comment_automation_use_case.ts) · [`src/application/usecases/steps/common/publish_resume_workflow.ts`](../src/application/usecases/steps/common/publish_resume_workflow.ts) · [`src/domain/github_publication.ts`](../src/domain/github_publication.ts) · [`src/domain/git_object_id.ts`](../src/domain/git_object_id.ts) · [`src/application/ports/publication_freshness_ports.ts`](../src/application/ports/publication_freshness_ports.ts) · [`src/application/policies/publication_identity_policy.ts`](../src/application/policies/publication_identity_policy.ts) · [`src/application/policies/copilot_interaction_policy.ts`](../src/application/policies/copilot_interaction_policy.ts) · [`src/application/policies/recommendation_policy.ts`](../src/application/policies/recommendation_policy.ts) · [`src/application/ports/actor_authorization_ports.ts`](../src/application/ports/actor_authorization_ports.ts) · [`src/data/repository/actor_modification_policy.ts`](../src/data/repository/actor_modification_policy.ts) · [`src/data/repository/organization/actor_authorization_repository.ts`](../src/data/repository/organization/actor_authorization_repository.ts) · [`src/application/policies/publication_outcome_policy.ts`](../src/application/policies/publication_outcome_policy.ts) · [`src/application/policies/publication_message_catalog.ts`](../src/application/policies/publication_message_catalog.ts) · [`src/application/policies/semantic_result_publication_policy.ts`](../src/application/policies/semantic_result_publication_policy.ts) · [`src/application/policies/github_comment_publication_policy.ts`](../src/application/policies/github_comment_publication_policy.ts) · [`src/application/policies/agent_response_schemas.ts`](../src/application/policies/agent_response_schemas.ts) · [`src/application/usecases/actions/recommend_steps_result_policy.ts`](../src/application/usecases/actions/recommend_steps_result_policy.ts) · [`src/application/usecases/actions/publish_issue_comment_workflow.ts`](../src/application/usecases/actions/publish_issue_comment_workflow.ts) · [`src/data/model/recommendation_state.ts`](../src/data/model/recommendation_state.ts) · [`src/data/model/config.ts`](../src/data/model/config.ts) · [`src/prompts/recommend_steps.ts`](../src/prompts/recommend_steps.ts) · [`src/application/usecases/issue_use_case.ts`](../src/application/usecases/issue_use_case.ts) · [`src/application/usecases/issue_workflow.ts`](../src/application/usecases/issue_workflow.ts) · [`src/application/usecases/issue_workflow_context.ts`](../src/application/usecases/issue_workflow_context.ts) · [`src/application/usecases/steps/issue/answer_issue_help_use_case.ts`](../src/application/usecases/steps/issue/answer_issue_help_use_case.ts) · [`src/application/usecases/steps/issue/answer_issue_help_workflow.ts`](../src/application/usecases/steps/issue/answer_issue_help_workflow.ts) · [`src/application/ports/issue_lifecycle_ports.ts`](../src/application/ports/issue_lifecycle_ports.ts) · [`src/application/usecases/steps/common/status_card_publication_workflow.ts`](../src/application/usecases/steps/common/status_card_publication_workflow.ts) · [`src/application/usecases/steps/common/reply_publication_workflow.ts`](../src/application/usecases/steps/common/reply_publication_workflow.ts) · [`src/application/usecases/steps/common/transition_notification_workflow.ts`](../src/application/usecases/steps/common/transition_notification_workflow.ts) · [`src/application/usecases/steps/common/duplicate_comment_cleanup_workflow.ts`](../src/application/usecases/steps/common/duplicate_comment_cleanup_workflow.ts) · [`src/actions/local_action.ts`](../src/actions/local_action.ts) · [`src/actions/local_action_output.ts`](../src/actions/local_action_output.ts) · [`src/cli/commands/think.ts`](../src/cli/commands/think.ts) · [`src/cli/commands/think_command_handler.ts`](../src/cli/commands/think_command_handler.ts) · [`src/infrastructure/composition/local_action_composition_root.ts`](../src/infrastructure/composition/local_action_composition_root.ts) · [`src/infrastructure/composition/main_run_route_composition_root.ts`](../src/infrastructure/composition/main_run_route_composition_root.ts) · [`src/infrastructure/composition/issue_use_case_composition_root.ts`](../src/infrastructure/composition/issue_use_case_composition_root.ts) · [`src/infrastructure/composition/shared_capability_port_binding.ts`](../src/infrastructure/composition/shared_capability_port_binding.ts) · [`src/architecture/github_publication_mutation_baseline.json`](../src/architecture/github_publication_mutation_baseline.json) · [`src/application/policies/action_summary_policy.ts`](../src/application/policies/action_summary_policy.ts) · [`src/application/policies/application_error_message_catalog.ts`](../src/application/policies/application_error_message_catalog.ts) · [`src/application/policies/application_error_presentation_policy.ts`](../src/application/policies/application_error_presentation_policy.ts) · [`src/application/policies/branch_sync_notification_policy.ts`](../src/application/policies/branch_sync_notification_policy.ts) · [`src/application/policies/bugbot_message_catalog.ts`](../src/application/policies/bugbot_message_catalog.ts) · [`src/application/policies/deployment_message_catalog.ts`](../src/application/policies/deployment_message_catalog.ts) · [`src/application/usecases/actions/observe_branch_sync_use_case.ts`](../src/application/usecases/actions/observe_branch_sync_use_case.ts) · [`src/application/usecases/actions/close_inactive_issues_use_case.ts`](../src/application/usecases/actions/close_inactive_issues_use_case.ts) · [`src/application/usecases/actions/close_inactive_issues_workflow.ts`](../src/application/usecases/actions/close_inactive_issues_workflow.ts) · [`src/application/usecases/push_single_action_contexts.ts`](../src/application/usecases/push_single_action_contexts.ts) · [`src/infrastructure/composition/issue_inactivity_composition_root.ts`](../src/infrastructure/composition/issue_inactivity_composition_root.ts) · [`src/application/policies/bugbot_review_presentation_policy.ts`](../src/application/policies/bugbot_review_presentation_policy.ts) · [`src/application/usecases/steps/commit/detect_potential_problems_workflow.ts`](../src/application/usecases/steps/commit/detect_potential_problems_workflow.ts) · [`src/application/usecases/steps/commit/bugbot/publish_pr_review_comments.ts`](../src/application/usecases/steps/commit/bugbot/publish_pr_review_comments.ts) · [`src/application/usecases/steps/commit/bugbot/resolve_issue_finding.ts`](../src/application/usecases/steps/commit/bugbot/resolve_issue_finding.ts) · [`src/application/usecases/steps/commit/bugbot/synchronize_bugbot_review_presentation_use_case.ts`](../src/application/usecases/steps/commit/bugbot/synchronize_bugbot_review_presentation_use_case.ts) · [`src/application/policies/deployment_presentation_policy.ts`](../src/application/policies/deployment_presentation_policy.ts) · [`src/application/usecases/actions/recommend_steps_workflow.ts`](../src/application/usecases/actions/recommend_steps_workflow.ts) · [`src/application/usecases/actions/check_progress_workflow.ts`](../src/application/usecases/actions/check_progress_workflow.ts) · [`src/application/usecases/actions/check_progress_use_case.ts`](../src/application/usecases/actions/check_progress_use_case.ts) · [`src/application/usecases/actions/progress_analysis_workflow.ts`](../src/application/usecases/actions/progress_analysis_workflow.ts) · [`src/application/usecases/sdd/read_progress_sdd_seed.ts`](../src/application/usecases/sdd/read_progress_sdd_seed.ts) · [`src/application/policies/progress_sdd_scope_policy.ts`](../src/application/policies/progress_sdd_scope_policy.ts) · [`src/application/ports/progress_sdd_seed_ports.ts`](../src/application/ports/progress_sdd_seed_ports.ts) · [`src/data/repository/github_publication_source_repository.ts`](../src/data/repository/github_publication_source_repository.ts) · [`src/infrastructure/composition/check_progress_composition_root.ts`](../src/infrastructure/composition/check_progress_composition_root.ts) · [`src/data/repository/issue/issue_content_repository.ts`](../src/data/repository/issue/issue_content_repository.ts) · [`src/data/repository/github/github_error_policy.ts`](../src/data/repository/github/github_error_policy.ts) · [`src/infrastructure/github/ports/github_issue_provider_ports.ts`](../src/infrastructure/github/ports/github_issue_provider_ports.ts) · [`src/application/usecases/comment_automation_command_workflow.ts`](../src/application/usecases/comment_automation_command_workflow.ts) · [`src/application/usecases/steps/commit/bugbot/dismiss_bugbot_findings_use_case.ts`](../src/application/usecases/steps/commit/bugbot/dismiss_bugbot_findings_use_case.ts) · [`src/application/policies/inactivity_result_counts_projection_policy.ts`](../src/application/policies/inactivity_result_counts_projection_policy.ts) · [`src/domain/copilot_command.ts`](../src/domain/copilot_command.ts) · [`src/domain/copilot_operation.ts`](../src/domain/copilot_operation.ts) · [`src/application/policies/copilot_history_policy.ts`](../src/application/policies/copilot_history_policy.ts) · [`src/application/policies/copilot_history_projection_policy.ts`](../src/application/policies/copilot_history_projection_policy.ts) · [`src/application/policies/copilot_history_presentation_policy.ts`](../src/application/policies/copilot_history_presentation_policy.ts) · [`src/application/ports/copilot_history_ports.ts`](../src/application/ports/copilot_history_ports.ts) · [`src/application/usecases/read_copilot_history_workflow.ts`](../src/application/usecases/read_copilot_history_workflow.ts) · [`src/infrastructure/composition/copilot_history_port_factory.ts`](../src/infrastructure/composition/copilot_history_port_factory.ts) · [`src/application/ports/progress_diff_query_ports.ts`](../src/application/ports/progress_diff_query_ports.ts) · [`src/data/repository/progress_diff_repository.ts`](../src/data/repository/progress_diff_repository.ts) · [`src/application/policies/agent_activity_policy.ts`](../src/application/policies/agent_activity_policy.ts) · [`src/domain/reply_request_digest.ts`](../src/domain/reply_request_digest.ts) · [`src/application/ports/reply_request_read_ports.ts`](../src/application/ports/reply_request_read_ports.ts) · [`src/data/repository/reply_request_repository.ts`](../src/data/repository/reply_request_repository.ts) · [`src/infrastructure/composition/reply_request_composition_root.ts`](../src/infrastructure/composition/reply_request_composition_root.ts) · [`src/infrastructure/github/ports/github_reply_request_client.ts`](../src/infrastructure/github/ports/github_reply_request_client.ts) · [`src/application/policies/retired_progress_presentation_policy.ts`](../src/application/policies/retired_progress_presentation_policy.ts) · [`src/application/usecases/actions/retire_progress_use_case.ts`](../src/application/usecases/actions/retire_progress_use_case.ts) · [`src/application/usecases/actions/retire_closed_issue_cards_use_case.ts`](../src/application/usecases/actions/retire_closed_issue_cards_use_case.ts) · [`src/application/policies/progress_diff_partition_policy.ts`](../src/application/policies/progress_diff_partition_policy.ts) · [`src/application/policies/progress_partition_response_policy.ts`](../src/application/policies/progress_partition_response_policy.ts) · [`src/application/usecases/actions/summarize_progress_diff_workflow.ts`](../src/application/usecases/actions/summarize_progress_diff_workflow.ts) · [`src/data/repository/agent_json_schema_validator.ts`](../src/data/repository/agent_json_schema_validator.ts) · [`src/data/model/application_error.ts`](../src/data/model/application_error.ts) · [`src/application/policies/pull_request_title_policy.ts`](../src/application/policies/pull_request_title_policy.ts) · [`src/application/usecases/steps/common/update_title_workflow.ts`](../src/application/usecases/steps/common/update_title_workflow.ts) · [`src/data/repository/issue/issue_title_repository.ts`](../src/data/repository/issue/issue_title_repository.ts) · [`src/domain/closed_issue_reconciliation.ts`](../src/domain/closed_issue_reconciliation.ts) · [`src/application/errors/closed_issue_reconciliation_error.ts`](../src/application/errors/closed_issue_reconciliation_error.ts) · [`src/application/policies/closed_issue_reconciliation_outcome_policy.ts`](../src/application/policies/closed_issue_reconciliation_outcome_policy.ts) · [`src/domain/copilot_command_validation.ts`](../src/domain/copilot_command_validation.ts) · [`src/application/errors/comment_command_validation_error.ts`](../src/application/errors/comment_command_validation_error.ts) · [`src/application/policies/comment_command_validation_message_catalog.ts`](../src/application/policies/comment_command_validation_message_catalog.ts) · [`src/application/policies/comment_command_validation_presentation_policy.ts`](../src/application/policies/comment_command_validation_presentation_policy.ts) · [`src/domain/copilot_command_vocabulary.ts`](../src/domain/copilot_command_vocabulary.ts) · [`src/domain/sdd_validation_diagnostic.ts`](../src/domain/sdd_validation_diagnostic.ts) · [`src/application/errors/sdd_draft_preparation_failure.ts`](../src/application/errors/sdd_draft_preparation_failure.ts) · [`src/application/policies/sdd_preparation_message_catalog.ts`](../src/application/policies/sdd_preparation_message_catalog.ts) · [`src/application/policies/sdd_preparation_status_policy.ts`](../src/application/policies/sdd_preparation_status_policy.ts) · [`src/application/policies/progress_scope_policy.ts`](../src/application/policies/progress_scope_policy.ts) · [`src/prompts/progress_scope.ts`](../src/prompts/progress_scope.ts) · [`src/prompts/check_progress.ts`](../src/prompts/check_progress.ts) · [`src/application/policies/branch_sync_relationship_retirement_policy.ts`](../src/application/policies/branch_sync_relationship_retirement_policy.ts) · [`src/application/usecases/actions/retire_unrelated_branch_sync_cards.ts`](../src/application/usecases/actions/retire_unrelated_branch_sync_cards.ts) · [`src/application/policies/progress_content_evidence_policy.ts`](../src/application/policies/progress_content_evidence_policy.ts) · [`src/application/policies/progress_patch_completeness_policy.ts`](../src/application/policies/progress_patch_completeness_policy.ts) · [`src/data/repository/immutable_progress_content_repository.ts`](../src/data/repository/immutable_progress_content_repository.ts) · [`src/infrastructure/github/ports/github_progress_object_provider_port.ts`](../src/infrastructure/github/ports/github_progress_object_provider_port.ts) · [`src/application/policies/progress_comparison_source_policy.ts`](../src/application/policies/progress_comparison_source_policy.ts) · [`src/application/ports/progress_comparison_source_ports.ts`](../src/application/ports/progress_comparison_source_ports.ts) · [`src/data/repository/progress_comparison_source_repository.ts`](../src/data/repository/progress_comparison_source_repository.ts) · [`src/domain/progress_binary_evidence_diagnostic.ts`](../src/domain/progress_binary_evidence_diagnostic.ts) · [`src/domain/progress_evidence_path.ts`](../src/domain/progress_evidence_path.ts) · [`src/infrastructure/github/ports/github_progress_comparison_provider_port.ts`](../src/infrastructure/github/ports/github_progress_comparison_provider_port.ts) · [`src/application/ports/copilot_evidence_error.ts`](../src/application/ports/copilot_evidence_error.ts) · [`src/application/policies/optional_check_diagnostic_policy.ts`](../src/application/policies/optional_check_diagnostic_policy.ts) · [`src/data/repository/github/copilot_evidence_provider_failure.ts`](../src/data/repository/github/copilot_evidence_provider_failure.ts) · [`src/application/policies/progress_evidence_protocol_policy.ts`](../src/application/policies/progress_evidence_protocol_policy.ts) · [`src/application/policies/progress_partition_receipt_policy.ts`](../src/application/policies/progress_partition_receipt_policy.ts) · [`src/application/policies/progress_prompt_capacity_policy.ts`](../src/application/policies/progress_prompt_capacity_policy.ts) · [`src/application/policies/progress_recovery_capacity_policy.ts`](../src/application/policies/progress_recovery_capacity_policy.ts) · [`src/application/policies/agent_prompt_envelope_policy.ts`](../src/application/policies/agent_prompt_envelope_policy.ts) · [`src/data/repository/ai/agent_capability_adapter.ts`](../src/data/repository/ai/agent_capability_adapter.ts) · [`src/domain/progress_response_diagnostic.ts`](../src/domain/progress_response_diagnostic.ts) · [`src/domain/agent_response_schema_failure.ts`](../src/domain/agent_response_schema_failure.ts) · [`src/data/repository/progress_agent_response_policy.ts`](../src/data/repository/progress_agent_response_policy.ts) · [`src/application/policies/progress_response_rejection_policy.ts`](../src/application/policies/progress_response_rejection_policy.ts) · [`src/application/usecases/actions/query_progress_result_workflow.ts`](../src/application/usecases/actions/query_progress_result_workflow.ts) · [`src/application/policies/immutable_progress_tree_policy.ts`](../src/application/policies/immutable_progress_tree_policy.ts) · [`src/application/policies/progress_inventory_profile_policy.ts`](../src/application/policies/progress_inventory_profile_policy.ts) · [`src/application/policies/progress_inventory_error_policy.ts`](../src/application/policies/progress_inventory_error_policy.ts) · [`src/application/policies/immutable_progress_units_policy.ts`](../src/application/policies/immutable_progress_units_policy.ts) · [`src/data/repository/immutable_progress_inventory_repository.ts`](../src/data/repository/immutable_progress_inventory_repository.ts) · [`src/data/repository/complete_progress_diff_repository.ts`](../src/data/repository/complete_progress_diff_repository.ts) · [`src/domain/progress_inventory_diagnostic.ts`](../src/domain/progress_inventory_diagnostic.ts) · [`src/domain/progress_capacity_diagnostic.ts`](../src/domain/progress_capacity_diagnostic.ts) · [`src/application/policies/progress_assessment_capacity_policy.ts`](../src/application/policies/progress_assessment_capacity_policy.ts) · [`src/application/policies/progress_scope_source_policy.ts`](../src/application/policies/progress_scope_source_policy.ts) · [`src/domain/progress_partition_length_failure.ts`](../src/domain/progress_partition_length_failure.ts) · [`src/data/repository/progress_partition_length_failure.ts`](../src/data/repository/progress_partition_length_failure.ts) · [`src/application/policies/progress_partition_length_policy.ts`](../src/application/policies/progress_partition_length_policy.ts) · [`src/application/usecases/actions/query_progress_partition_workflow.ts`](../src/application/usecases/actions/query_progress_partition_workflow.ts) · [`src/domain/progress_completion_diagnostic.ts`](../src/domain/progress_completion_diagnostic.ts) · [`src/application/errors/progress_completion_mismatch.ts`](../src/application/errors/progress_completion_mismatch.ts) · [`src/application/policies/progress_completion_recovery_policy.ts`](../src/application/policies/progress_completion_recovery_policy.ts) · [`src/application/usecases/actions/query_progress_assessment_workflow.ts`](../src/application/usecases/actions/query_progress_assessment_workflow.ts) · [`src/application/errors/progress_capacity_failure.ts`](../src/application/errors/progress_capacity_failure.ts) · [`src/application/policies/progress_capacity_context_policy.ts`](../src/application/policies/progress_capacity_context_policy.ts) · [`src/application/policies/progress_capacity_source_context_policy.ts`](../src/application/policies/progress_capacity_source_context_policy.ts) · [`src/application/policies/progress_capacity_messages.ts`](../src/application/policies/progress_capacity_messages.ts) · [`src/application/policies/progress_capacity_presentation_policy.ts`](../src/application/policies/progress_capacity_presentation_policy.ts) · [`src/domain/progress_batch_diagnostic.ts`](../src/domain/progress_batch_diagnostic.ts) · [`src/application/policies/progress_batch_policy.ts`](../src/application/policies/progress_batch_policy.ts) · [`src/application/policies/progress_batch_query_policy.ts`](../src/application/policies/progress_batch_query_policy.ts) · [`src/application/policies/progress_batch_rejection_policy.ts`](../src/application/policies/progress_batch_rejection_policy.ts) · [`src/application/usecases/actions/progress_batch_workflow.ts`](../src/application/usecases/actions/progress_batch_workflow.ts) · [`src/domain/progress_assessment_length_failure.ts`](../src/domain/progress_assessment_length_failure.ts) · [`src/data/repository/progress_assessment_length_failure.ts`](../src/data/repository/progress_assessment_length_failure.ts) · [`src/application/policies/progress_assessment_length_policy.ts`](../src/application/policies/progress_assessment_length_policy.ts) · [`src/application/policies/progress_compact_assessment_policy.ts`](../src/application/policies/progress_compact_assessment_policy.ts) · [`src/application/policies/progress_partition_byte_policy.ts`](../src/application/policies/progress_partition_byte_policy.ts) · [`src/domain/bugbot/review_freshness_failure.ts`](../src/domain/bugbot/review_freshness_failure.ts) · [`src/application/errors/bugbot_freshness_error.ts`](../src/application/errors/bugbot_freshness_error.ts) · [`src/application/policies/pull_request_review_provider_code_policy.ts`](../src/application/policies/pull_request_review_provider_code_policy.ts) · [`src/application/ports/pull_request_review_errors.ts`](../src/application/ports/pull_request_review_errors.ts) · [`src/application/usecases/steps/commit/bugbot/bugbot_review_freshness.ts`](../src/application/usecases/steps/commit/bugbot/bugbot_review_freshness.ts) · [`src/data/repository/pull_request/pull_request_lifecycle_repository.ts`](../src/data/repository/pull_request/pull_request_lifecycle_repository.ts) · [`src/data/repository/pull_request/pull_request_changes_repository.ts`](../src/data/repository/pull_request/pull_request_changes_repository.ts) · [`src/domain/progress_citation_repetition.ts`](../src/domain/progress_citation_repetition.ts) · [`src/application/policies/progress_citation_recovery_policy.ts`](../src/application/policies/progress_citation_recovery_policy.ts) +- Tests: [`src/domain/__tests__/implementation_plan.test.ts`](../src/domain/__tests__/implementation_plan.test.ts) · [`src/domain/__tests__/locale.test.ts`](../src/domain/__tests__/locale.test.ts) · [`src/domain/__tests__/message_catalog.test.ts`](../src/domain/__tests__/message_catalog.test.ts) · [`src/actions/__tests__/configuration_builders.test.ts`](../src/actions/__tests__/configuration_builders.test.ts) · [`src/actions/__tests__/github_event_inputs.test.ts`](../src/actions/__tests__/github_event_inputs.test.ts) · [`src/cli/commands/__tests__/issue_command_policy.test.ts`](../src/cli/commands/__tests__/issue_command_policy.test.ts) · [`src/actions/__tests__/github_action_completion.test.ts`](../src/actions/__tests__/github_action_completion.test.ts) · [`src/data/model/__tests__/config.test.ts`](../src/data/model/__tests__/config.test.ts) · [`src/application/policies/__tests__/agent_response_schemas.test.ts`](../src/application/policies/__tests__/agent_response_schemas.test.ts) · [`src/prompts/__tests__/recommend_steps.test.ts`](../src/prompts/__tests__/recommend_steps.test.ts) · [`src/application/policies/__tests__/comment_translation_policy.test.ts`](../src/application/policies/__tests__/comment_translation_policy.test.ts) · [`src/application/policies/__tests__/action_summary_message_catalog.test.ts`](../src/application/policies/__tests__/action_summary_message_catalog.test.ts) · [`src/application/policies/__tests__/application_error_message_catalog.test.ts`](../src/application/policies/__tests__/application_error_message_catalog.test.ts) · [`src/application/policies/__tests__/application_error_presentation_policy.test.ts`](../src/application/policies/__tests__/application_error_presentation_policy.test.ts) · [`src/application/usecases/localization/__tests__/resolve_message_catalog_use_case.test.ts`](../src/application/usecases/localization/__tests__/resolve_message_catalog_use_case.test.ts) · [`src/prompts/__tests__/localize_message_catalog.test.ts`](../src/prompts/__tests__/localize_message_catalog.test.ts) · [`src/domain/__tests__/github_publication.test.ts`](../src/domain/__tests__/github_publication.test.ts) · [`src/domain/__tests__/git_object_id.test.ts`](../src/domain/__tests__/git_object_id.test.ts) · [`src/data/repository/__tests__/github_publication_source_repository.test.ts`](../src/data/repository/__tests__/github_publication_source_repository.test.ts) · [`src/application/policies/__tests__/publication_identity_policy.test.ts`](../src/application/policies/__tests__/publication_identity_policy.test.ts) · [`src/application/policies/__tests__/publication_outcome_policy.test.ts`](../src/application/policies/__tests__/publication_outcome_policy.test.ts) · [`src/application/policies/__tests__/publication_message_catalog.test.ts`](../src/application/policies/__tests__/publication_message_catalog.test.ts) · [`src/application/policies/__tests__/semantic_result_publication_policy.test.ts`](../src/application/policies/__tests__/semantic_result_publication_policy.test.ts) · [`src/application/policies/__tests__/github_comment_publication_policy.test.ts`](../src/application/policies/__tests__/github_comment_publication_policy.test.ts) · [`src/application/policies/__tests__/action_summary_policy.test.ts`](../src/application/policies/__tests__/action_summary_policy.test.ts) · [`src/application/policies/__tests__/branch_sync_notification_policy.test.ts`](../src/application/policies/__tests__/branch_sync_notification_policy.test.ts) · [`src/application/policies/__tests__/inactivity_message_catalog.test.ts`](../src/application/policies/__tests__/inactivity_message_catalog.test.ts) · [`src/application/policies/__tests__/inactivity_notification_policy.test.ts`](../src/application/policies/__tests__/inactivity_notification_policy.test.ts) · [`src/application/policies/__tests__/setup_doctor_message_catalog.test.ts`](../src/application/policies/__tests__/setup_doctor_message_catalog.test.ts) · [`src/application/policies/__tests__/setup_doctor_report_policy.test.ts`](../src/application/policies/__tests__/setup_doctor_report_policy.test.ts) · [`src/application/usecases/actions/__tests__/observe_branch_sync_use_case.test.ts`](../src/application/usecases/actions/__tests__/observe_branch_sync_use_case.test.ts) · [`src/application/usecases/setup/__tests__/doctor_use_case.test.ts`](../src/application/usecases/setup/__tests__/doctor_use_case.test.ts) · [`src/application/usecases/setup/__tests__/merge_queue_readiness_use_case.test.ts`](../src/application/usecases/setup/__tests__/merge_queue_readiness_use_case.test.ts) · [`src/application/policies/__tests__/bugbot_message_catalog.test.ts`](../src/application/policies/__tests__/bugbot_message_catalog.test.ts) · [`src/application/policies/__tests__/deployment_message_catalog.test.ts`](../src/application/policies/__tests__/deployment_message_catalog.test.ts) · [`src/application/policies/__tests__/bugbot_review_presentation_policy.test.ts`](../src/application/policies/__tests__/bugbot_review_presentation_policy.test.ts) · [`src/application/usecases/steps/commit/__tests__/detect_potential_problems_use_case.test.ts`](../src/application/usecases/steps/commit/__tests__/detect_potential_problems_use_case.test.ts) · [`src/application/usecases/steps/commit/bugbot/__tests__/dismiss_bugbot_findings_use_case.test.ts`](../src/application/usecases/steps/commit/bugbot/__tests__/dismiss_bugbot_findings_use_case.test.ts) · [`src/application/usecases/steps/commit/bugbot/__tests__/synchronize_bugbot_review_presentation_use_case.test.ts`](../src/application/usecases/steps/commit/bugbot/__tests__/synchronize_bugbot_review_presentation_use_case.test.ts) · [`src/application/policies/__tests__/deployment_presentation_policy.test.ts`](../src/application/policies/__tests__/deployment_presentation_policy.test.ts) · [`src/application/usecases/actions/__tests__/close_inactive_issues_use_case.test.ts`](../src/application/usecases/actions/__tests__/close_inactive_issues_use_case.test.ts) · [`src/application/usecases/__tests__/push_single_action_contexts.test.ts`](../src/application/usecases/__tests__/push_single_action_contexts.test.ts) · [`src/application/usecases/steps/common/__tests__/comment_language_translation_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/comment_language_translation_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/think_request_policy.test.ts`](../src/application/usecases/steps/common/__tests__/think_request_policy.test.ts) · [`src/application/usecases/steps/common/__tests__/think_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/think_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/publish_resume_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/publish_resume_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/status_card_publication_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/status_card_publication_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/reply_publication_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/reply_publication_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/transition_notification_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/transition_notification_workflow.test.ts) · [`src/application/usecases/steps/common/__tests__/duplicate_comment_cleanup_workflow.test.ts`](../src/application/usecases/steps/common/__tests__/duplicate_comment_cleanup_workflow.test.ts) · [`src/data/repository/issue/__tests__/issue_content_repository.test.ts`](../src/data/repository/issue/__tests__/issue_content_repository.test.ts) · [`src/data/repository/deployment/__tests__/deployment_presentation_repository.test.ts`](../src/data/repository/deployment/__tests__/deployment_presentation_repository.test.ts) · [`src/data/repository/__tests__/github_error_policy.test.ts`](../src/data/repository/__tests__/github_error_policy.test.ts) · [`src/application/usecases/steps/issue/__tests__/answer_issue_help_use_case.test.ts`](../src/application/usecases/steps/issue/__tests__/answer_issue_help_use_case.test.ts) · [`src/application/usecases/__tests__/issue_use_case.test.ts`](../src/application/usecases/__tests__/issue_use_case.test.ts) · [`src/application/usecases/__tests__/issue_pull_request_context_projection.test.ts`](../src/application/usecases/__tests__/issue_pull_request_context_projection.test.ts) · [`src/actions/__tests__/local_action.test.ts`](../src/actions/__tests__/local_action.test.ts) · [`src/actions/__tests__/github_action.test.ts`](../src/actions/__tests__/github_action.test.ts) · [`src/data/repository/__tests__/actor_modification_policy.test.ts`](../src/data/repository/__tests__/actor_modification_policy.test.ts) · [`src/data/repository/organization/__tests__/actor_authorization_repository.test.ts`](../src/data/repository/organization/__tests__/actor_authorization_repository.test.ts) · [`src/__tests__/cli.test.ts`](../src/__tests__/cli.test.ts) · [`src/cli/commands/__tests__/think_command_handler.test.ts`](../src/cli/commands/__tests__/think_command_handler.test.ts) · [`src/infrastructure/composition/__tests__/local_action_composition_root.test.ts`](../src/infrastructure/composition/__tests__/local_action_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/main_run_route_composition_root.test.ts`](../src/infrastructure/composition/__tests__/main_run_route_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/issue_use_case_composition_root.test.ts`](../src/infrastructure/composition/__tests__/issue_use_case_composition_root.test.ts) · [`src/infrastructure/composition/__tests__/shared_capability_port_binding.test.ts`](../src/infrastructure/composition/__tests__/shared_capability_port_binding.test.ts) · [`src/infrastructure/composition/__tests__/pull_request_use_case_composition_root.test.ts`](../src/infrastructure/composition/__tests__/pull_request_use_case_composition_root.test.ts) · [`src/architecture/__tests__/github_publication_boundaries.test.ts`](../src/architecture/__tests__/github_publication_boundaries.test.ts) · [`src/application/usecases/steps/common/__tests__/publication_concurrency.integration.test.ts`](../src/application/usecases/steps/common/__tests__/publication_concurrency.integration.test.ts) · [`src/tooling/__tests__/validate_github_communication_test_budget.test.ts`](../src/tooling/__tests__/validate_github_communication_test_budget.test.ts) · [`src/tooling/__tests__/validate_workflow_contract.test.ts`](../src/tooling/__tests__/validate_workflow_contract.test.ts) · [`src/application/usecases/actions/__tests__/recommend_steps_use_case.test.ts`](../src/application/usecases/actions/__tests__/recommend_steps_use_case.test.ts) · [`src/application/usecases/actions/__tests__/check_progress_use_case.test.ts`](../src/application/usecases/actions/__tests__/check_progress_use_case.test.ts) · [`src/application/usecases/__tests__/comment_automation_use_case.test.ts`](../src/application/usecases/__tests__/comment_automation_use_case.test.ts) · [`src/domain/__tests__/copilot_operation.test.ts`](../src/domain/__tests__/copilot_operation.test.ts) · [`src/application/policies/__tests__/copilot_history_policy.test.ts`](../src/application/policies/__tests__/copilot_history_policy.test.ts) · [`src/application/policies/__tests__/copilot_history_presentation_policy.test.ts`](../src/application/policies/__tests__/copilot_history_presentation_policy.test.ts) · [`src/application/policies/__tests__/copilot_operation_publication.test.ts`](../src/application/policies/__tests__/copilot_operation_publication.test.ts) · [`src/application/usecases/__tests__/copilot_history_route.test.ts`](../src/application/usecases/__tests__/copilot_history_route.test.ts) · [`src/application/usecases/__tests__/copilot_history_workflow.test.ts`](../src/application/usecases/__tests__/copilot_history_workflow.test.ts) · [`src/infrastructure/composition/__tests__/copilot_history_port_factory.test.ts`](../src/infrastructure/composition/__tests__/copilot_history_port_factory.test.ts) · [`src/data/repository/__tests__/progress_diff_repository.test.ts`](../src/data/repository/__tests__/progress_diff_repository.test.ts) · [`src/application/policies/__tests__/agent_activity_policy.test.ts`](../src/application/policies/__tests__/agent_activity_policy.test.ts) · [`src/data/repository/__tests__/reply_request_repository.test.ts`](../src/data/repository/__tests__/reply_request_repository.test.ts) · [`src/application/usecases/steps/common/__tests__/reply_request_publication.test.ts`](../src/application/usecases/steps/common/__tests__/reply_request_publication.test.ts) · [`src/infrastructure/composition/__tests__/reply_request_composition_root.test.ts`](../src/infrastructure/composition/__tests__/reply_request_composition_root.test.ts) · [`src/application/policies/__tests__/retired_progress_presentation_policy.test.ts`](../src/application/policies/__tests__/retired_progress_presentation_policy.test.ts) · [`src/application/usecases/actions/__tests__/retire_progress_use_case.test.ts`](../src/application/usecases/actions/__tests__/retire_progress_use_case.test.ts) · [`src/application/usecases/actions/__tests__/retire_closed_issue_cards_use_case.test.ts`](../src/application/usecases/actions/__tests__/retire_closed_issue_cards_use_case.test.ts) · [`src/application/usecases/steps/common/__tests__/retired_progress_publication.integration.test.ts`](../src/application/usecases/steps/common/__tests__/retired_progress_publication.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_native_closure.test.ts`](../src/application/usecases/actions/__tests__/progress_native_closure.test.ts) · [`src/application/policies/__tests__/progress_diff_partition_policy.test.ts`](../src/application/policies/__tests__/progress_diff_partition_policy.test.ts) · [`src/application/policies/__tests__/progress_partition_response_policy.test.ts`](../src/application/policies/__tests__/progress_partition_response_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_multipart.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_multipart.integration.test.ts) · [`src/tooling/__tests__/progress_capacity_failure.test.ts`](../src/tooling/__tests__/progress_capacity_failure.test.ts) · [`src/domain/__tests__/progress_capacity_diagnostic.test.ts`](../src/domain/__tests__/progress_capacity_diagnostic.test.ts) · [`src/data/repository/__tests__/agent_json_schema_validator.test.ts`](../src/data/repository/__tests__/agent_json_schema_validator.test.ts) · [`src/application/errors/__tests__/application_error.test.ts`](../src/application/errors/__tests__/application_error.test.ts) · [`src/application/policies/__tests__/pull_request_title_policy.test.ts`](../src/application/policies/__tests__/pull_request_title_policy.test.ts) · [`src/application/usecases/steps/common/__tests__/pull_request_title_compatibility.test.ts`](../src/application/usecases/steps/common/__tests__/pull_request_title_compatibility.test.ts) · [`src/application/usecases/steps/common/__tests__/update_title_use_case.test.ts`](../src/application/usecases/steps/common/__tests__/update_title_use_case.test.ts) · [`src/data/repository/issue/__tests__/issue_title_repository.test.ts`](../src/data/repository/issue/__tests__/issue_title_repository.test.ts) · [`src/domain/__tests__/copilot_command_validation.test.ts`](../src/domain/__tests__/copilot_command_validation.test.ts) · [`src/application/policies/__tests__/comment_command_validation_presentation.test.ts`](../src/application/policies/__tests__/comment_command_validation_presentation.test.ts) · [`src/application/usecases/__tests__/command_validation_diagnostics.test.ts`](../src/application/usecases/__tests__/command_validation_diagnostics.test.ts) · [`src/domain/__tests__/sdd_validation_diagnostic.test.ts`](../src/domain/__tests__/sdd_validation_diagnostic.test.ts) · [`src/application/policies/__tests__/sdd_preparation_status_policy.test.ts`](../src/application/policies/__tests__/sdd_preparation_status_policy.test.ts) · [`src/application/policies/__tests__/progress_scope_policy.test.ts`](../src/application/policies/__tests__/progress_scope_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_scope.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_scope.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_response.test.ts`](../src/application/usecases/actions/__tests__/progress_response.test.ts) · [`src/prompts/__tests__/check_progress.test.ts`](../src/prompts/__tests__/check_progress.test.ts) · [`src/prompts/__tests__/progress_scope.test.ts`](../src/prompts/__tests__/progress_scope.test.ts) · [`src/application/usecases/actions/__tests__/retire_unrelated_branch_sync_cards.test.ts`](../src/application/usecases/actions/__tests__/retire_unrelated_branch_sync_cards.test.ts) · [`src/application/policies/__tests__/progress_content_evidence_policy.test.ts`](../src/application/policies/__tests__/progress_content_evidence_policy.test.ts) · [`src/application/policies/__tests__/progress_patch_completeness_policy.test.ts`](../src/application/policies/__tests__/progress_patch_completeness_policy.test.ts) · [`src/data/repository/__tests__/immutable_progress_content_repository.test.ts`](../src/data/repository/__tests__/immutable_progress_content_repository.test.ts) · [`src/data/repository/__tests__/progress_diff_recovery.test.ts`](../src/data/repository/__tests__/progress_diff_recovery.test.ts) · [`src/application/policies/__tests__/progress_comparison_source_policy.test.ts`](../src/application/policies/__tests__/progress_comparison_source_policy.test.ts) · [`src/data/repository/__tests__/progress_comparison_source_repository.test.ts`](../src/data/repository/__tests__/progress_comparison_source_repository.test.ts) · [`src/application/usecases/actions/__tests__/progress_comparison_source.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_comparison_source.integration.test.ts) · [`src/domain/__tests__/progress_binary_evidence_diagnostic.test.ts`](../src/domain/__tests__/progress_binary_evidence_diagnostic.test.ts) · [`src/data/repository/__tests__/progress_binary_evidence.test.ts`](../src/data/repository/__tests__/progress_binary_evidence.test.ts) · [`src/infrastructure/composition/__tests__/progress_comparison_binding.test.ts`](../src/infrastructure/composition/__tests__/progress_comparison_binding.test.ts) · [`src/application/policies/__tests__/optional_check_diagnostic_policy.test.ts`](../src/application/policies/__tests__/optional_check_diagnostic_policy.test.ts) · [`src/data/repository/__tests__/copilot_evidence_failure.test.ts`](../src/data/repository/__tests__/copilot_evidence_failure.test.ts) · [`src/actions/__tests__/optional_check_completion.test.ts`](../src/actions/__tests__/optional_check_completion.test.ts) · [`src/architecture/__tests__/raw_error_logging_boundaries.test.ts`](../src/architecture/__tests__/raw_error_logging_boundaries.test.ts) · [`src/data/repository/__tests__/progress_framed_recovery.test.ts`](../src/data/repository/__tests__/progress_framed_recovery.test.ts) · [`src/application/usecases/actions/__tests__/progress_framed_protocol.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_framed_protocol.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_large_comparison.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_large_comparison.integration.test.ts) · [`src/application/policies/__tests__/progress_framed_diagnostics.test.ts`](../src/application/policies/__tests__/progress_framed_diagnostics.test.ts) · [`src/application/policies/__tests__/progress_partition_receipt_policy.test.ts`](../src/application/policies/__tests__/progress_partition_receipt_policy.test.ts) · [`src/application/policies/__tests__/progress_prompt_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_prompt_capacity_policy.test.ts) · [`src/application/policies/__tests__/progress_evidence_protocol_policy.test.ts`](../src/application/policies/__tests__/progress_evidence_protocol_policy.test.ts) · [`src/application/policies/__tests__/progress_recovery_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_recovery_capacity_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_prompt_preflight.test.ts`](../src/application/usecases/actions/__tests__/progress_prompt_preflight.test.ts) · [`src/application/usecases/actions/__tests__/progress_agent_prompt_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_agent_prompt_capacity.integration.test.ts) · [`src/domain/__tests__/progress_response_diagnostic.test.ts`](../src/domain/__tests__/progress_response_diagnostic.test.ts) · [`src/data/repository/__tests__/progress_agent_response_policy.test.ts`](../src/data/repository/__tests__/progress_agent_response_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_result_rejection.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_result_rejection.integration.test.ts) · [`src/application/policies/__tests__/progress_rejection_diagnostics.test.ts`](../src/application/policies/__tests__/progress_rejection_diagnostics.test.ts) · [`src/application/policies/__tests__/progress_response_error_presentation.test.ts`](../src/application/policies/__tests__/progress_response_error_presentation.test.ts) · [`src/application/policies/__tests__/immutable_progress_units_policy.test.ts`](../src/application/policies/__tests__/immutable_progress_units_policy.test.ts) · [`src/application/policies/__tests__/immutable_progress_tree_policy.test.ts`](../src/application/policies/__tests__/immutable_progress_tree_policy.test.ts) · [`src/application/policies/__tests__/progress_inventory_profile_policy.test.ts`](../src/application/policies/__tests__/progress_inventory_profile_policy.test.ts) · [`src/application/usecases/actions/__tests__/complete_progress_inventory.integration.test.ts`](../src/application/usecases/actions/__tests__/complete_progress_inventory.integration.test.ts) · [`src/data/repository/__tests__/immutable_progress_inventory_repository.test.ts`](../src/data/repository/__tests__/immutable_progress_inventory_repository.test.ts) · [`src/data/repository/__tests__/complete_progress_diff_repository.test.ts`](../src/data/repository/__tests__/complete_progress_diff_repository.test.ts) · [`src/data/repository/__tests__/support/immutable_progress_inventory_fixture.ts`](../src/data/repository/__tests__/support/immutable_progress_inventory_fixture.ts) · [`src/domain/__tests__/progress_inventory_diagnostic.test.ts`](../src/domain/__tests__/progress_inventory_diagnostic.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/complete_inventory_workflow_fixture.ts`](../src/application/usecases/actions/__tests__/fixtures/complete_inventory_workflow_fixture.ts) · [`src/data/repository/__tests__/support/large_complete_progress_fixture.ts`](../src/data/repository/__tests__/support/large_complete_progress_fixture.ts) · [`src/application/policies/__tests__/progress_assessment_capacity_policy.test.ts`](../src/application/policies/__tests__/progress_assessment_capacity_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_assessment_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_assessment_capacity.integration.test.ts) · [`src/application/policies/__tests__/progress_scope_ownership.test.ts`](../src/application/policies/__tests__/progress_scope_ownership.test.ts) · [`src/application/policies/__tests__/progress_scope_capacity_diagnostic.test.ts`](../src/application/policies/__tests__/progress_scope_capacity_diagnostic.test.ts) · [`src/application/usecases/actions/__tests__/progress_scope_ownership.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_scope_ownership.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_sdd_seed.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_sdd_seed.integration.test.ts) · [`src/application/policies/__tests__/progress_partition_length_policy.test.ts`](../src/application/policies/__tests__/progress_partition_length_policy.test.ts) · [`src/application/policies/__tests__/progress_partition_length_presentation.test.ts`](../src/application/policies/__tests__/progress_partition_length_presentation.test.ts) · [`src/data/repository/__tests__/progress_partition_length_failure.test.ts`](../src/data/repository/__tests__/progress_partition_length_failure.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_length.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_length.integration.test.ts) · [`src/application/usecases/actions/__tests__/query_progress_partition_workflow.test.ts`](../src/application/usecases/actions/__tests__/query_progress_partition_workflow.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_length_publication.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_length_publication.integration.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_repair_preflight.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_repair_preflight.test.ts) · [`src/domain/__tests__/progress_completion_diagnostic.test.ts`](../src/domain/__tests__/progress_completion_diagnostic.test.ts) · [`src/application/policies/__tests__/progress_completion_recovery_policy.test.ts`](../src/application/policies/__tests__/progress_completion_recovery_policy.test.ts) · [`src/application/usecases/actions/__tests__/query_progress_assessment_workflow.test.ts`](../src/application/usecases/actions/__tests__/query_progress_assessment_workflow.test.ts) · [`src/application/usecases/actions/__tests__/progress_completion_recovery.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_completion_recovery.integration.test.ts) · [`src/application/policies/__tests__/progress_completion_recovery_presentation.test.ts`](../src/application/policies/__tests__/progress_completion_recovery_presentation.test.ts) · [`src/application/usecases/actions/__tests__/progress_recovery_composition.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_recovery_composition.integration.test.ts) · [`src/application/policies/__tests__/progress_capacity_context.test.ts`](../src/application/policies/__tests__/progress_capacity_context.test.ts) · [`src/application/policies/__tests__/progress_capacity_boundaries.test.ts`](../src/application/policies/__tests__/progress_capacity_boundaries.test.ts) · [`src/application/policies/__tests__/progress_capacity_public.test.ts`](../src/application/policies/__tests__/progress_capacity_public.test.ts) · [`src/application/policies/__tests__/progress_capacity_profiles.test.ts`](../src/application/policies/__tests__/progress_capacity_profiles.test.ts) · [`src/application/usecases/actions/__tests__/progress_capacity.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_capacity.integration.test.ts) · [`src/data/repository/__tests__/progress_capacity_adapter.test.ts`](../src/data/repository/__tests__/progress_capacity_adapter.test.ts) · [`src/application/policies/__tests__/progress_batch_policy.test.ts`](../src/application/policies/__tests__/progress_batch_policy.test.ts) · [`src/application/usecases/actions/__tests__/progress_batches.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_batches.integration.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/domus-29-immutable-replay.json.gz.hex`](../src/application/usecases/actions/__tests__/fixtures/domus-29-immutable-replay.json.gz.hex) · [`src/application/usecases/actions/__tests__/support/progress_batch_response.ts`](../src/application/usecases/actions/__tests__/support/progress_batch_response.ts) · [`src/application/usecases/actions/__tests__/progress_assessment_length_recovery.test.ts`](../src/application/usecases/actions/__tests__/progress_assessment_length_recovery.test.ts) · [`src/application/policies/__tests__/progress_assessment_length_policy.test.ts`](../src/application/policies/__tests__/progress_assessment_length_policy.test.ts) · [`src/application/policies/__tests__/progress_assessment_length_presentation.test.ts`](../src/application/policies/__tests__/progress_assessment_length_presentation.test.ts) · [`src/data/repository/__tests__/progress_assessment_length_failure.test.ts`](../src/data/repository/__tests__/progress_assessment_length_failure.test.ts) · [`src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/domus-29-native-937.json.gz.hex`](../src/application/usecases/actions/__tests__/fixtures/domus-29-native-937.json.gz.hex) · [`src/application/policies/__tests__/progress_compact_assessment_policy.test.ts`](../src/application/policies/__tests__/progress_compact_assessment_policy.test.ts) · [`src/application/usecases/actions/__tests__/fixtures/progress_assessment_wire_fixture.ts`](../src/application/usecases/actions/__tests__/fixtures/progress_assessment_wire_fixture.ts) · [`src/application/policies/__tests__/progress_partition_byte_recovery.test.ts`](../src/application/policies/__tests__/progress_partition_byte_recovery.test.ts) · [`src/application/usecases/actions/__tests__/progress_partition_byte_publication.integration.test.ts`](../src/application/usecases/actions/__tests__/progress_partition_byte_publication.integration.test.ts) · [`src/application/policies/__tests__/bugbot_freshness_diagnostics.test.ts`](../src/application/policies/__tests__/bugbot_freshness_diagnostics.test.ts) · [`src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts`](../src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts) · [`src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts`](../src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts) - User documentation: [`docs/configuration.mdx`](../docs/configuration.mdx) · [`docs/configuration-checklist.mdx`](../docs/configuration-checklist.mdx) · [`docs/features.mdx`](../docs/features.mdx) · [`docs/issues/configuration.mdx`](../docs/issues/configuration.mdx) · [`docs/issues/comment-commands.mdx`](../docs/issues/comment-commands.mdx) · [`docs/issues/notifications-and-auto-close.mdx`](../docs/issues/notifications-and-auto-close.mdx) · [`docs/issues/branch-synchronization.mdx`](../docs/issues/branch-synchronization.mdx) · [`docs/issues/type/feature.mdx`](../docs/issues/type/feature.mdx) · [`docs/issues/type/bugfix.mdx`](../docs/issues/type/bugfix.mdx) · [`docs/issues/type/docs.mdx`](../docs/issues/type/docs.mdx) · [`docs/issues/type/chore.mdx`](../docs/issues/type/chore.mdx) · [`docs/issues/type/hotfix.mdx`](../docs/issues/type/hotfix.mdx) · [`docs/issues/type/release.mdx`](../docs/issues/type/release.mdx) · [`docs/issues/deployment-orchestration.mdx`](../docs/issues/deployment-orchestration.mdx) · [`docs/pull-requests/configuration.mdx`](../docs/pull-requests/configuration.mdx) · [`docs/pull-requests/capabilities.mdx`](../docs/pull-requests/capabilities.mdx) · [`docs/pull-requests/workflow-setup.mdx`](../docs/pull-requests/workflow-setup.mdx) · [`docs/pull-requests/examples.mdx`](../docs/pull-requests/examples.mdx) · [`docs/bugbot/configuration.mdx`](../docs/bugbot/configuration.mdx) · [`docs/bugbot/finding-publication.mdx`](../docs/bugbot/finding-publication.mdx) · [`docs/bugbot/detection.mdx`](../docs/bugbot/detection.mdx) · [`docs/bugbot/how-it-works.mdx`](../docs/bugbot/how-it-works.mdx) · [`docs/bugbot/programmatic-api.mdx`](../docs/bugbot/programmatic-api.mdx) · [`docs/bugbot/quality-observability.mdx`](../docs/bugbot/quality-observability.mdx) · [`docs/bugbot/failure-scenarios.mdx`](../docs/bugbot/failure-scenarios.mdx) · [`docs/bugbot/examples.mdx`](../docs/bugbot/examples.mdx) · [`docs/single-actions/configuration.mdx`](../docs/single-actions/configuration.mdx) · [`docs/single-actions/available-actions.mdx`](../docs/single-actions/available-actions.mdx) · [`docs/single-actions/workflow-and-cli.mdx`](../docs/single-actions/workflow-and-cli.mdx) · [`docs/single-actions/examples.mdx`](../docs/single-actions/examples.mdx) · [`docs/security-operations/security/prompt-injection.mdx`](../docs/security-operations/security/prompt-injection.mdx) · [`docs/security-operations/operations/verification.mdx`](../docs/security-operations/operations/verification.mdx) · [`docs/development/architecture.mdx`](../docs/development/architecture.mdx) · [`docs/development/testing.mdx`](../docs/development/testing.mdx) · [`docs/issues/branch-management.mdx`](../docs/issues/branch-management.mdx) · [`docs/agents/execution-contract.mdx`](../docs/agents/execution-contract.mdx) · [`docs/security-operations/operations/error-reference.mdx`](../docs/security-operations/operations/error-reference.mdx) · [`docs/issues/pre-branch-sdds.mdx`](../docs/issues/pre-branch-sdds.mdx) · [`docs/development/specifications.mdx`](../docs/development/specifications.mdx) · [`docs/security-operations/operations/troubleshooting.mdx`](../docs/security-operations/operations/troubleshooting.mdx) ### `release-orchestration` — Configurable production-first release orchestration diff --git a/specs/catalog.json b/specs/catalog.json index bce101c53..c46316220 100644 --- a/specs/catalog.json +++ b/specs/catalog.json @@ -5,7 +5,7 @@ "id": "github-communication-experience", "title": "Semantic GitHub communication and repository localization", "status": "implemented", - "scope": "English-default, localized, semantic, bounded and idempotent product messages across GitHub and repository-aware operator surfaces; complete acceptance batches and cards with stable source identities, verified published SDD provenance, shared complete-inventory text allocation, precise response diagnostics and same-head requirement evidence before Commit progress publication; shared bounded complete-batch recovery for attributable completed acceptance-field length or completion failures; bounded closed-fact recovery and compact large-inventory assessment, exact original hard allocations, explicit admission counts and non-retryable length exhaustion with separate live-provider qualification; exact JSON-byte allocation and one shared source-part size replacement for both framed profiles, captured request contracts, receipt quota revalidation and nonretryable unit-specific exhaustion", + "scope": "English-default, localized, semantic, bounded and idempotent product messages across GitHub and repository-aware operator surfaces; complete acceptance batches and cards with stable source identities, verified published SDD provenance, shared complete-inventory text allocation, precise response diagnostics and same-head requirement evidence before Commit progress publication; shared bounded complete-batch recovery for attributable completed acceptance-field length or completion failures; bounded closed-fact recovery and compact large-inventory assessment, exact original hard allocations, explicit admission counts and non-retryable length exhaustion with separate live-provider qualification; exact JSON-byte allocation and one shared source-part size replacement for both framed profiles, captured request contracts, receipt quota revalidation and nonretryable unit-specific exhaustion; shared same-profile complete-batch correction for otherwise-valid repeated citations with current-request origin binding, unchanged evidence gates and nonretryable citation exhaustion", "owner": "Copilot maintainers", "lastVerified": "2026-11-08", "specs": [ @@ -249,7 +249,9 @@ "src/application/ports/pull_request_review_errors.ts", "src/application/usecases/steps/commit/bugbot/bugbot_review_freshness.ts", "src/data/repository/pull_request/pull_request_lifecycle_repository.ts", - "src/data/repository/pull_request/pull_request_changes_repository.ts" + "src/data/repository/pull_request/pull_request_changes_repository.ts", + "src/domain/progress_citation_repetition.ts", + "src/application/policies/progress_citation_recovery_policy.ts" ], "tests": [ "src/domain/__tests__/implementation_plan.test.ts", @@ -444,7 +446,8 @@ "src/application/policies/__tests__/progress_partition_byte_recovery.test.ts", "src/application/usecases/actions/__tests__/progress_partition_byte_publication.integration.test.ts", "src/application/policies/__tests__/bugbot_freshness_diagnostics.test.ts", - "src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts" + "src/data/repository/__tests__/bugbot_source_bound_identity_repository.test.ts", + "src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts" ], "documentation": [ "docs/configuration.mdx", diff --git a/specs/final-progress-completion-recovery.md b/specs/final-progress-completion-recovery.md index 171da6b45..5a33eb32b 100644 --- a/specs/final-progress-completion-recovery.md +++ b/specs/final-progress-completion-recovery.md @@ -1,14 +1,14 @@ # Final Progress Assessment Recovery -- Status: Published #932 baseline; issue #937 operational generation update in validation +- Status: Published #932/#937 baseline (3.10.11/3.10.12); #944 repeated-citation correction under validation - Date: 2026-11-08 - Catalog capability ID: github-communication-experience -- Last verified: 2026-11-08 (#932 published; #937 local closed-policy and controlled live-provider qualification complete; native consumer and remote acceptance pending) +- Last verified: 2026-11-08 (#937 source/release gates and candidate native consumer qualification passed; a new stable-consumer progress defect is tracked separately in #944 below) - Owners: Copilot maintainers - Scope: Complete bounded semantic assessment for compact inventories and one shared replacement for a completion contradiction or attributable narrative length rejection. - Related issues/PRs: https://github.com/vypdev/copilot/issues/853; https://github.com/vypdev/copilot/issues/932; https://github.com/vypdev/copilot/issues/937 - Required review gates: product UX, architecture, testing, documentation, security/operations -- Open decisions blocking design: none. Historical #853: the Action verified first SDD commit 828a68284f4687acf7350950f553ba501926454b on the linked issue branch. Issue #932 uses the Action-created branch at base `2ecac44850af23c60bc937d52a3f995b0960bfac`; local validation and independent remote acceptance remain pending. +- Open decisions blocking design: none. Historical #853: the Action verified first SDD commit 828a68284f4687acf7350950f553ba501926454b on the linked issue branch. Issue #932 used the Action-created branch at base `2ecac44850af23c60bc937d52a3f995b0960bfac` and completed publication in 3.10.11. Current #944 acceptance gates are recorded in its delta below. > The Action published and verified this companion before implementation. Publication establishes the branch prerequisite, not implemented behavior or executed acceptance. Its owning capability already has the specifications `specs/immutable-progress-content-recovery.md`, `specs/complete-progress-comparison-inventory.md`, and `specs/progress-scope-source-ownership.md`. The listed contracts retain their baseline ownership; this companion specifies the bounded final-assessment correction. @@ -653,7 +653,12 @@ Operational qualification additionally requires complete coherent provider facts for the original consumer scope and a successful native consumer Check using an explicit reviewed candidate SHA, with every original publication fence. A protocol-only pass, output clipped by a decoder, or deterministic fixture is not -completion. These #937 gates remain pending until independently recorded. +completion. At publication of 3.10.12 these #937 gates passed: source/release +promotion #942 and reconciliation #943 passed current-head native review, +three-platform CI and official changed-line coverage. Domus candidate Commit +42508345183 and Review 42508350603 passed; this is distinct from the later +stable-consumer Commit failure 42518152136 tracked in #944 below. Candidate +qualification does not certify every subsequent provider response. - [x] Every FPR requirement has acceptance and reciprocal case traceability. @@ -677,230 +682,380 @@ completion. These #937 gates remain pending until independently recorded. - Decisions and rejected alternatives: exactly one replacement rather than a general retry; closed counts rather than raw output; retain strict parsing rather than normalize percentages; unchanged model/configuration/limits/permissions; no new absolute deadline port; no automatic write replay. Reject forcing 100 from previous statuses, dropping uncertain requirements or sources, accepting provider errors as completed output, increasing capacities, adding a third query, caching partial evidence, weakening approval, or treating model claims as execution proof. - Follow-up work explicitly outside this spec: broader progress-planning improvements, #830 partition-length recovery, extension implementation, release and deployment. This spec includes implementation and its full CI/coverage/review acceptance; adoption into the master-pinned runtime is a separately reviewed operator transition. The reported parser/graph consistency at `3e7ceea` and catalog snapshot `9abb7882` establishes planning consistency only, not implementation or acceptance. -## Proposed change: Repeated native citations pass the assessment schema then abort same head progress +## Issue #944: bounded correction for repeated native citations -- Status: Draft -- Catalog capability: github-communication-experience +- Status: Implementation under validation; independent remote gates and new consumer qualification pending +- Date: 2026-11-08 +- Owner and catalog capability: Copilot maintainers / `github-communication-experience` +- Action-selected base: `13560d95ec643171e9c87e8e262fc7a57bb2acbb` +- Action-published first SDD: `b20ef9d4b9b96c4782a040438c4f3e9ba25cd6d0` +- Open design decisions: none. This change grants no release authorization. +- Retained contract: all original 85 cases and requirements above remain normative. ### 1. Executive summary -This delta extends the retained final progress recovery contract to repeated citations in an otherwise valid, attributable progress response. The host will permit one complete correction under the existing allowance shared with length and completion recovery. Acceptance still requires distinct admitted source references, complete requirement coverage, exact identities, unchanged response and call/time bounds, and the existing final publication gates. If repeated citations remain after the allowance is used, progress stays unpublished and the operation returns a precise, content-free, nonretryable diagnostic. +An otherwise valid complete assessment that repeats an admitted citation may use +the existing single complete-batch correction allowance shared with length and +completion recovery. Acceptance still requires distinct admitted references, +complete original scope, exact identities, unchanged bounds and final freshness +and publication gates. No deduplication, additional retry or partial publication +is introduced. ```text -validate complete batch -> distinct admitted citations -> existing publication gates - -> repeated citations -> one shared complete correction - -> valid distinct citations -> existing gates - -> repeat or other invalid evidence -> retain prior progress; stop +complete native response -> validate every identity, fact, reference and semantic rule + unique citations -> original receipt and publication gates + repetition only -> one shared correction, if unused + valid replacement -> original receipt and publication gates + repeated citation -> non-retryable diagnostic; retain prior progress + other failure -> original classification; retain prior progress + any other defect -> original blocking validation; no citation correction ``` -Text equivalent: only a complete response with distinct valid citations proceeds to existing gates; one repeated-citation correction may use the shared allowance, and failure retains prior progress. +Text equivalent: repetition alone may spend one existing allowance; the complete +replacement must pass every original gate. No failure can publish provisional +batches or allocate a third assessment query. ### 2. Problem, current behavior, and evidence -#### 2.1 Problem - -Issue [#944](https://github.com/vypdev/copilot/issues/944) reports that repeated native citations can pass the assessment schema and then abort same-head progress at evidence validation. This creates a mismatch between wire-level acceptance and receipt-level acceptance. The reported run retained existing progress, as required, but could not complete acceptance batch 1 of 4. The original native response was not retained; repetition is an inference from the failure path, not a raw citation capture. The issue reports a deterministic synthetic counterexample and a unique-citation control, but those issue-provided results are not independent evidence from this selected source view. - -#### 2.2 Current behavior in the selected source - -1. `src/application/policies/progress_batch_policy.ts` builds `progressBatchResponseSchema` with citations as an array of 1–8 strings selected from admitted non-generated evidence IDs. The schema does not declare uniqueness. -2. `src/data/repository/agent_json_schema_validator.ts` checks array bounds and each item against its schema; it contains no distinct-item check. Therefore schema validation alone permits repeats. -3. `readProgressAssessmentEvidence` in `src/application/policies/progress_batch_policy.ts` requires citation arrays to contain distinct IDs and rejects repetition with `evidence-missing`. It also checks each reference exists, belongs to the current head, and is not generated. `parseProgressAssessmentReceipt` uses that evidence reader before producing a receipt. -4. `src/application/usecases/actions/progress_batch_workflow.ts` submits each batch, reads and parses its evidence, and converts the retained-batch rejection to the existing batch diagnostic. The selected implementation shown here has no repeated-citation correction at this boundary. - -The compact profile is decoded by `decodeCompactProgressAssessment` in `src/application/policies/progress_compact_assessment_policy.ts`; it maps closed assessment codes to canonical fields and retains response identity fields. The selected sources do not establish that the reported native output was captured or that this issue’s counterexample was run against this revision. The issue states both prose and closed-fact profiles preserve citation arrays; verify that behavior in implementation tests before treating it as established for this revision. - -#### 2.3 Evidence and limits - -The selected source directly establishes the schema/receipt uniqueness mismatch and the evidence checks described above. The issue reports a native failure at requirement R63, acceptance batch 1 of 4, with `validation.evidence-unavailable`, reason `evidence-missing`, and prior progress retained. It also reports that a valid unique-citation control succeeds. These are incident assertions; the original response is unavailable, so exact citations and the cause in that native response remain unverified. No conclusion about a quota failure is supported by the report. The selected owner `specs/final-progress-completion-recovery.md` already specifies a single shared correction allowance for eligible final assessment failures; this delta adds repeated citations to its scope without replacing its retained requirements or cases. The neighboring evidence, scope, batching, and capacity owners remain authoritative for their existing contracts. +Published 3.10.12 passed its source, three-platform, review and coverage gates. +Its source was qualified in Domus at a candidate SHA before publication. After +restoring Domus to its normal `v3` strategy, Commit run +[42518152136](https://github.com/vypdev/domus/actions/runs/42518152136) +downloaded published production SHA +`d2f7523d1f2f8a302130d91f15b421e74b43632a`, completed all 17 source parts, +then failed at R63 in acceptance batch 1/4 with `evidence-missing`. Prior +progress was retained. Domus CI and Review on that same consumer head succeeded; +they do not certify Commit progress. + +The original rejected response was not retained. Duplicate citations are an +inference from the reached validation branch, not captured native output. +A deterministic counterexample against the published source passes the actual +native adapter schema and fails the receipt reader when references repeat; +the unique-citation control succeeds. Genuine pre-fix regressions reproduced +this abort in both narrative and closed-fact profiles. This proves a structural +schema/host mismatch; it does not establish every detail of the unavailable +native response. + +The baseline schema bounds citations to 1–8 admitted IDs without a uniqueness +keyword; the local schema validator checks bounds and enum membership. +The baseline receipt reader rejects repeats as missing evidence. The correction +retains strict receipt uniqueness, makes distinctness explicit in the prompt +and schema description, and routes only attributable repetition through the +existing application-owned allowance. It adds no provider-specific schema +keyword or provider behavior assumption. ### 3. Actors, surfaces, and terminology -The affected actors and surfaces remain those in the retained owner `specs/final-progress-completion-recovery.md`: the issue author supplies progress scope, the configured model returns assessments, the host workflow validates and controls publication, and maintainers inspect a failed run and decide whether a fresh assessment is appropriate. - -For this delta, a **citation** is an admitted source reference attached to a requirement assessment. **Distinct citations** contain no repeated reference within that assessment. A **complete correction** is one replacement response for the entire frozen batch, using the same head, manifest, requirement identities, admitted evidence, and profile. The model supplies response data; the host owns identity, evidence admission, uniqueness validation, recovery eligibility, and publication authority. +The issue author owns acceptance source; the model supplies untrusted assessment +data; the host owns scope, evidence admission, validation and publication. +Maintainers inspect the existing CLI/API error, Commit Check and Job Summary. -The observable outcome remains in existing CLI/API errors, Check, Job Summary, and progress publication surfaces. A terminal repeated-citation failure must identify the affected requirement and batch through the existing safe diagnostic conventions, without exposing model prose or raw response content. Existing locale handling and user-facing content conventions remain in force. +A citation is a host-admitted non-generated source reference pinned to the +comparison head. A repeated citation repeats an ID within one requirement. +The complete evidence dictionary is immutable original input; a model-selected +citation subset is untrusted output and need not be preserved between attempts. +No original evidence or requirement may be dropped from the replacement request. ### 4. Goals, non-goals, and fixed invariants -#### 4.1 Goals - -- **SDD-I944-U1-R1:** Accept only distinct citations in an otherwise valid, attributable progress response. A repeated-citation response may use the existing single complete-batch correction allowance shared with length and completion recovery. Preserve every requirement, distinct admitted source reference, identity, response bound, the 120-call/30-minute ceiling, and the final publication gate. If repetition remains after the shared allowance is consumed, return a precise content-free nonretryable diagnostic. Do not silently deduplicate output, invent citations, accept invalid receipts, add an allowance, weaken coverage, or rerun unchanged heads until green. -- **SDD-I944-U1-R2:** Keep missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence blocking publication. Retain complete frozen batches and never publish partial progress. - -#### 4.2 Non-goals - -- Changing source collection, scope ownership, batching, assessment semantics, publication, or any owning contract outside the repeated-citation recovery delta. -- Replacing or re-running the reported failed native operation to obtain a green status; changing the published artifact; or authorizing a release or deployment. -- Adding configurable or additional retries, increasing limits, expanding permissions, weakening evidence validation, or deduplicating model output automatically. - -#### 4.3 Fixed product and safety invariants - -- Citation uniqueness is a validation condition for every accepted response, regardless of prose or closed-fact wire profile. Correction must produce distinct admitted citations; the host must not repair the array by deduplication or fabricate evidence. -- The shared allowance is consumed at most once per complete batch across repeated-citation, length, and completion recovery. Exhaustion is terminal and nonretryable; no unchanged-head loop is permitted. -- All original requirement coverage, batch and head identities, manifest binding, freshness, evidence admission, capacity, response bounds, 120-call/30-minute ceilings, complete frozen-batch behavior, and final publication gates remain unchanged. -- Any missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence continues to block publication. Previous progress is retained until every required batch passes all existing gates; no partial progress is published. - -| Requirement | Behavior | -| --- | --- | -| SDD-I944-U1-R1 | Accept only distinct citations in an otherwise valid, attributable progress response; recover repeated citations using the existing single complete-batch correction allowance shared with length/completion recovery, preserving every requirement, distinct admitted source reference, identity, response bound, 120-call/30-minute ceiling, and final publication gate. A repeated citation after that shared allowance is consumed produces a precise content-free, nonretryable diagnostic. Do not silently deduplicate output, invent citations, accept invalid receipts, add an allowance, weaken coverage, or rerun unchanged heads until green. | -| SDD-I944-U1-R2 | Keep missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence blocking publication; retain complete frozen batches and do not partially publish progress. | +- **SDD-I944-U1-R1:** An otherwise valid attributable repeated-citation response + MAY spend the existing single complete-batch allowance shared with length and + completion recovery. The correction MUST preserve the full original request, + scope, evidence dictionary, profile, schema, settings and bounds. Accepted + citations MUST be distinct. A repeated-citation replacement MUST terminate + with a precise content-free nonretryable diagnostic, without normalization, + a third query, forced completion or unchanged-head rerun loops. +- **SDD-I944-U1-R2:** Missing, foreign, generated, stale, malformed, forged or + otherwise invalid evidence MUST remain blocking. The host MUST retain prior + progress and all complete frozen batches as provisional and MUST NOT publish + partial progress. Correction MUST NOT weaken any identity, semantic, capacity, + global budget, freshness or publication gate. + +Non-goals: changing source collection, scope interpretation, acceptance semantics, +provider permissions, workflow configuration, published artifacts or release +versions. Existing terminal completion/provider classifications remain unchanged; +only terminal citation repetition receives the new precise reason. ### 5. Current versus proposed product journey -#### 5. Current versus proposed product journey +Previously, repetition could pass the native schema and abort the complete +operation after expensive source collection. Now a valid first result still +uses one query. Repetition alone allows exactly one read-only complete correction +using the same frozen batch. Success reaches the existing publication gates. +Failure retains the published state and tells the operator to inspect the run +and qualify a corrected response/build before a fresh full assessment. -The immutable owner, `specs/final-progress-completion-recovery.md`, already defines complete-batch assessment, one shared correction allowance for eligible completion and length failures, and publication only after complete validation and freshness checks. This update adds repeated citations to that recovery boundary. In the affected flow, the response schema admits citation arrays with one to eight entries, while receipt validation requires distinct citations. A duplicate therefore can pass adapter schema validation and fail later as missing evidence; the consumer retains prior progress and receives a nonretryable error. The issue report’s native response was not retained, so the reported repetition remains inferred; its deterministic schema/receipt counterexample is separate evidence. - -Proposed journey: assess the complete assigned batch with its original identities and evidence references; if citations repeat but the response is otherwise valid and attributable, use the existing single complete-batch correction allowance, shared with length/completion recovery. Validate the correction against the same scope and publication gates. A valid unique-citation result continues through existing freshness and publication checks. A unique-citation response on the first attempt follows the current path without correction. If the allowance has already been spent, stop with a precise, content-free, nonretryable diagnostic and retain previously published progress. At no point may the host silently remove duplicates, infer or invent evidence, publish a partial batch, or retry unchanged heads until green. - -For operators, a blocked result should communicate the impact, cause, next action, then retained state: “Progress was not updated. The complete assessment did not verify distinct source citations for requirement R63, batch 1. Review the cited evidence and run a corrected assessment. Existing progress was retained.” Keep the requirement and batch details within the existing safe diagnostic projection; do not expose rejected response text or unverified references. A successful correction uses the existing completion and publication surfaces without an extra comment or notification. Existing locale selection and fallback remain in force. +Accepted earlier batches remain provisional throughout. No comment, issue, +label, Check, permission or notification is added. Existing links lead to the +run, issue, comparison and documentation. ### 6. Functional behavior and state model -#### 6. Functional behavior and state model - -This delta applies to both existing response profiles: narrative and closed-fact. The response must first satisfy its applicable schema, exact scope and batch identities, requirement coverage, locale, and all non-citation receipt checks. Citation admission then requires at least one citation per requirement, no repeated citation within a requirement, and every citation to identify admitted, non-generated evidence pinned to the current head. Each requirement and its citation set remain bound to the same complete frozen batch. +The reader validates exact manifest/head/batch identities, complete requirement +coverage, per-fact capacity, all citation memberships and every canonical +semantic rule before minting correction authority. A simultaneous completion +contradiction is a blocking combined defect, not an alternate recovery route. +Malformed native JSON/schema, invalid locale and other semantic defects retain +their existing failure behavior. -A repeated citation in an otherwise valid, attributable response is an eligible correction trigger under the existing single complete-batch allowance. The replacement repeats the complete assigned batch and preserves every requirement, identity, distinct admitted source reference, response bound, and the original final publication gate. It may not normalize the rejected citation array by deduplication or carry rejected prose forward. A unique-citation response is accepted without correction. When completion or length recovery has already consumed the allowance, a subsequent repeated-citation failure is terminal: report a precise content-free, nonretryable diagnostic, retain existing progress, and do not issue another query for unchanged heads. Mixed repeated-citation and length/completion failures consume that same one allowance, never a second one. - -Missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence remains blocking and does not become eligible merely because citations are repeated. Preserve the existing complete frozen batches and discard provisional results if any batch or final gate fails; never partially publish. Keep the existing 120-call and 30-minute ceilings, and do not reset the attempt ledger for correction. Freshness, approval, and final publication behavior remain owned by the immutable owner and its existing contracts. - -The relevant current boundary is visible in `src/application/policies/progress_batch_policy.ts`: `progressBatchResponseSchema` bounds citation arrays to 1–8 admitted IDs, and `readProgressAssessmentEvidence` rejects duplicates and checks evidence identity before `parseProgressAssessmentReceipt` constructs a receipt. `src/application/usecases/actions/progress_batch_workflow.ts` owns complete-batch assessment and receipt aggregation; `src/application/usecases/actions/query_progress_assessment_workflow.ts` owns assessment-query correction. The update must connect the otherwise-valid duplicate failure to that shared bounded correction path without weakening receipt validation. +For repetition alone, the reader records only requirement/source IDs, batch, +citation count and distinct count. It never deduplicates output. Direct parser +callers remain strict and cannot allocate a correction. Length, completion and +citation failures share the same two-evaluation owner. A mixed sequence gets no +third query; its terminal failure retains that failure category's classification. +All calls remain charged to the original 120-call/30-minute ledger. ### 7. User-facing configuration -#### 7. User-facing configuration - -No new user-facing configuration is introduced. The correction allowance remains fixed at one per assessment invocation and is shared with existing eligible length/completion recovery; it is not configurable. Citation distinctness, evidence admission, complete-batch preservation, freshness checks, response bounds, the 120-call/30-minute ceilings, and the final publication gate are fixed correctness constraints. - -Use the existing provider, model, effort, locale, and invocation snapshot rules. Locale changes presentation only; it does not alter citation validation, evidence identity, or recovery eligibility. No persisted recovery state or migration is added. A new invocation follows the existing fresh-invocation behavior and must collect and validate its own complete evidence. +No new input, environment variable, setting, stored state or migration exists. +The one correction allowance, distinctness, 1–8 citation bound, evidence fences, +full scope, response allocations and 120-call/30-minute ceilings are fixed. +Provider/model/effort/locale use the existing captured invocation precedence. +Localization changes presentation, never eligibility. Existing English/Spanish +host catalogs and whole-catalog fallback apply. ### 8. Clean Architecture design -#### 8. Clean Architecture design - -Keep the rule that citations are distinct and admitted as pure receipt-validation policy in `src/application/policies/progress_batch_policy.ts`. That policy owns citation identity checks against the immutable manifest and head; the response schema remains an adapter-facing shape constraint and must not be treated as proof that citation content is semantically valid. Preserve the existing distinction between response-schema validation in `src/data/repository/agent_json_schema_validator.ts` and host receipt validation in the application policy. - -The application workflow owns the one shared correction allowance and may spend it only when the complete response is otherwise attributable and valid apart from repeated citations. Reuse the existing assessment-query recovery boundary in `src/application/usecases/actions/query_progress_assessment_workflow.ts` and the batch orchestration in `src/application/usecases/actions/progress_batch_workflow.ts`. Keep provider adapters responsible for parsing and mapping responses; they must not deduplicate citations or decide recovery eligibility. Keep publication and freshness decisions with their existing owners. No provider-specific DTO, durable retry state, extra port, or new configuration is required. +```mermaid +flowchart LR + Adapter[Native adapter: schema and profile] --> Owner[Application assessment owner: two evaluations] + Owner --> Reader[Receipt policy: all evidence and semantic gates] + Reader --> Facts[Domain: closed repetition measurements] + Reader --> Binding[Application policy: private current-request origin] + Binding --> Owner + Owner --> Batch[Batch owner: complete receipts] + Batch --> Publication[Existing freshness and publication owner] +``` -On correction, revalidate the complete response and every receipt from the beginning. Any invalid or stale evidence, incomplete batch, consumed allowance, or exhausted global bound returns a safe terminal failure and retains the prior published progress. Diagnostics expose only the existing closed safe facts, such as requirement and batch identity where host-verified; never log or publish rejected response content, arbitrary citation strings, or unverified identifiers. +Text equivalent: the adapter validates the wire shape; the application reader +validates evidence and semantics and may mint a private current-request error. +The existing two-evaluation owner consumes it. Complete receipts alone reach the +unchanged publication owner. No domain module imports an adapter or use case. + +- `src/domain/progress_citation_repetition.ts` validates an exact five-field + diagnostic with bounded host IDs, batch 1–1024, citation count 2–8 and a smaller + positive distinct count. Raw references, source prose and arbitrary keys are + excluded. +- `src/application/policies/progress_citation_recovery_policy.ts` owns a private + WeakMap binding. Minting requires the actual frozen request schema to match + the full supported canonical or closed-fact schema. Binding requires the same + schema object from this invocation plus exact captured scope, anchors, locale + and original source-line membership. Equal-valued schema clones and older + invocations cannot replay authority. Caller objects are never frozen. +- `progress_batch_policy.ts` validates every row, including semantic validity, + before minting. `progress_batch_workflow.ts` supplies the actual private + request schema and retains a response only after evidence validation succeeds. +- `query_progress_assessment_workflow.ts` recognizes this origin only in its + projection/parse catch. A provider-thrown carrier cannot allocate correction. + The replacement snapshots the original effective profile/request and appends + a fixed footer with at most 256 bytes of closed JSON. Rejected prose and + references are never copied. +- `progress_prompt_capacity_policy.ts` reserves both narrative and closed-fact + citation correction envelopes, including the native security/schema/effort + envelope, before the associated first query. Existing aggregate preflight + also includes them before source collection. Padding is never submitted. + +The existing ports, composition, persistence, concurrency and publication +capabilities do not change. Architecture/import guards, native schema fixtures, +full root tests and workflow contracts enforce the dependency and trust fences. ### 9. UI/UX and content contract -#### 9.1 Information hierarchy - -For this delta, show the current batch status first, then that prior progress and complete frozen batches are retained, whether the one shared correction is running or exhausted, the next action, and sanitized diagnostic facts. Keep existing progress surfaces and publication behavior from the immutable owner `specs/final-progress-completion-recovery.md`. - -#### 9.2 Citation-specific content - -When an otherwise valid, attributable response repeats a citation, use the existing shared complete-batch correction allowance. While it runs, state that the complete batch is being reassessed and prior progress is retained. On success, report progress only after distinct admitted citations and all existing validation and publication gates pass. If the allowance is already consumed, state that progress was not published, identify the affected requirement and batch using host-verified identifiers, and give the precise nonretryable diagnostic. Tell the operator to inspect the run and qualify a corrected response before a fresh full assessment; do not recommend an unchanged-head retry loop. +The existing localized Check/Summary/CLI surface remains primary. Fixed recovery +logging states what is happening and that prior progress is retained; it contains +no source prose or reference IDs. Existing error projection exposes only closed +host-verified batch/requirement facts and correlation. -A response with unique admitted citations continues without correction. Do not expose rejected model prose or render it as Markdown. Keep existing locale, accessibility, responsive, and surface conventions; the diagnostic must remain understandable without color and preserve the same closed facts across supported locale rendering and fallback. +Representative content (illustrative R63/batch 1, not captured response data): -#### 9.3 Existing interaction contract - -Create no new issue, PR, comment, label, Check, card, permission, or interactive control. Retain existing links, markers, titles, and notification budgets. Do not publish any part of a frozen batch while citation recovery is underway. +| State | Visible content and next action | +|---|---| +| Pending correction | “A completed progress assessment repeated a native source citation. Requesting one complete correction for the same pinned batch; previous progress is retained.” No human action yet. | +| Complete | Existing progress card and run link, only after every receipt and freshness gate passes. No extra recovery comment. | +| Partial internal work | Earlier batches are provisional; previous published progress remains. The existing run shows completed/expected batch counts. | +| Blocked/exhausted | Progress retained; `validation.evidence-unavailable`, `progress-batch-retained`, `evidence-duplicate`, verified requirement/batch, Retryable: No. Inspect the run and qualify a correction before a fresh assessment. | +| Action required | Review the named batch and run; do not weaken evidence checks or repeatedly rerun the unchanged failed head. | +| Canceled/provider failure | Existing classified error and correlation; previous progress retained. | + +No raw response Markdown, arbitrary references or mentions are rendered. +Existing locale/fallback, narrow/mobile layout and text-first error conventions +remain; color, diagrams and icons are not required to understand the state. +This delta adds no new visual control; pre-existing open human UX acceptance +items remain open and are not claimed passed by these automated tests. ### 10. Failure, recovery, and cleanup -| Failure or state | User impact and retained facts | Recovery and action | -|---|---|---| -| Otherwise valid attributable response contains repeated citations and the shared correction allowance remains | No new progress is published; prior progress and complete frozen batches remain intact | Make exactly one complete same-batch correction using the existing allowance, preserving requirements, distinct admitted source references, identities, response bounds, the 120-call/30-minute ceilings, and the final publication gate. | -| Repeated citations occur after the shared correction allowance is consumed, including after length/completion recovery used it | Progress remains unpublished; prior progress and frozen batches remain intact | Return a precise, content-free, nonretryable diagnostic. Do not silently deduplicate, invent citations, add an allowance, or rerun unchanged heads. | -| Citation correction still contains repeats or another validation failure | No progress is published; retain the prior state and complete frozen batches | Do not make a third query. Report the failure through the existing safe diagnostic behavior. | -| Evidence is missing, foreign, generated, stale, malformed, forged, or otherwise invalid | Publication remains blocked; no partial batch is published | Preserve existing evidence-validation failure behavior; citation recovery does not make invalid evidence eligible. | +| Failure | Allowance and result | +|---|---| +| Repetition alone on first valid native response | One complete same-profile correction; no writes. | +| Repetition after any correction | No third query; nonretryable `evidence-duplicate`; previous progress retained. | +| Other terminal failure after correction | Existing classification/retryability; no third query. | +| Repetition plus another defect | No citation correction authority; original blocking validation. | +| Foreign, forged, serialized, provider-thrown or stale origin | No citation correction authority. | +| Call/time exhaustion or publication drift | Existing bound/freshness error; no partial publication. | -Errors state impact, cause, action, and retained state in that order. Discard rejected payloads under the existing cleanup rules. A correction must be complete; partial batch results are never published. +Rejected output is not retained for retry or presentation. All provisional +receipts are discarded when the operation fails. There is no write retry, new +durable recovery record, cleanup job or secret-bearing artifact. ### 11. Security, permissions, and privacy -1. Add no credentials, network authority, write capability, permission, or model-call allowance. Citation correction is bounded by the existing shared single complete-batch allowance and the existing 120-call/30-minute ceilings. -2. Permit correction only when the response is otherwise valid and attributable to the current complete frozen batch. Repeated citation values are invalid; the host must not normalize them by silently deduplicating. Accept only distinct references admitted by the existing evidence and receipt checks. -3. Preserve all existing evidence fences. Missing, foreign, generated, stale, malformed, forged, or otherwise invalid evidence remains blocking and cannot be repaired by citation correction. Keep requirement coverage, identities, response bounds, and final publication gates unchanged. -4. Do not expose raw response content, arbitrary citations, private prose, or unverified identifiers in diagnostics. Exhaustion diagnostics contain only the closed, host-verified facts needed to identify the affected requirement and batch and explain the nonretryable failure. -5. Model output cannot establish evidence validity or authorize publication. Publish only after the entire frozen batch passes the existing checks. +Model output cannot mint authority or attest test execution. The private origin +requires host validation of the whole complete native contract and exact current +request identity. No generic error names, public metadata or serialized objects +qualify. All original evidence IDs remain input, never trusted diagnostics. +No credentials, network authority, permissions, source execution or publication +capability is added. Untrusted references and prose never enter correction hints, +logs, error variables or rendered recovery messages. ### 12. Observability and operational UX -Retain existing progress and emit no partial-publication signal for an incomplete or rejected batch. When correction is used, report only the fixed recovery status and closed, host-verified identifiers or facts needed to diagnose the result. When the shared allowance is exhausted, report a precise content-free nonretryable diagnostic and make clear that prior progress was retained. Do not log or retain rejected model prose, add telemetry payloads, or introduce provider retries. Existing run links, correlation, and operator surfaces remain in force. - -### 13. Compatibility, migration, rollout, and rollback +Use one fixed log for an eligible correction, the existing correlation and +existing batch-retained diagnostic. No extra notification or telemetry budget +is added. Preserve verified/expected batch counters without presenting them as +published progress. A successful synthetic fixture is deterministic structural +evidence; real consumer qualification requires its own immutable candidate SHA +and native Commit result. -This is a bounded update to the immutable owner `specs/final-progress-completion-recovery.md`. It adds repeated citations as another eligible failure handled by the existing single complete-batch correction allowance shared with length/completion recovery. No additional allowance, stored-state migration, configuration, or release authorization is introduced. +### 13. Compatibility, rollout, and rollback -Both prose and closed-fact wire profiles must enforce distinct admitted citations. Unique-citation responses retain their existing success path. A correction must preserve requirements, distinct admitted source references, identities, response bounds, the 120-call/30-minute ceilings, complete frozen batches, and the final publication gate. Invalid evidence remains blocking. Exhaustion is terminal and nonretryable; rollback to immediate rejection retains prior progress and does not rewrite published state. +Unique-citation responses and legacy no-citation contracts keep their existing +paths. Both supported wire profiles are covered. Unsupported/changed schema +contracts remain strict and cannot mint an origin. There is no persisted-state +migration. Published 3.10.12 stays immutable; a subsequent release requires +separate exact-version authorization. Rollback to immediate rejection retains +the original progress and does not rewrite consumer state. ### 14. Testing strategy and numeric budget -Add five minimum distinct regression cases to the existing owner budget; these are new cases, not a replacement for retained cases or coverage gates. Exercise both wire profiles, valid unique and repeated citations, exhaustion after the shared correction, mixed length/completion recovery, and invalid evidence with frozen-batch retention. Keep the complete-batch correction allowance shared and singular. Assertions must verify preservation of requirements, distinct admitted source references, identities, response bounds, the existing 120-call and 30-minute ceilings, and the final publication gate. Use deterministic fixtures and assert that exhaustion yields a precise content-free, nonretryable diagnostic without silent deduplication, invented citations, another allowance, or unchanged-head reruns. Keep repository and changed-module coverage thresholds and all existing budgets in force. These cases establish structural coverage targets; they do not establish executed acceptance. +Add **14 distinct declarations/cases**, retaining the five Action-published IDs +and all 85 original owner cases: **99 minimum owner cases total**. Parameterized +rows and repeated executions count once. Eleven new declarations are in +`progress_citation_recovery.test.ts`; three are appended to the existing native +integration file. The older native C188/C189 declarations remain unchanged. -| Area | Minimum distinct cases | Behaviors/risks covered | +| Area | Distinct cases | Risk | |---|---:|---| -| citation recovery | 2 | Observable scenarios in the case inventory. | -| allowance exhaustion | 1 | Observable scenarios in the case inventory. | -| shared recovery | 1 | Observable scenarios in the case inventory. | -| evidence validation | 1 | Observable scenarios in the case inventory. | -| Total | 5 | Distinct inventory cases; repeated executions do not add cases. | +| Ordinary correction/control and shared exhaustion | 4 | Profile compatibility and one allowance | +| Invalid evidence, combined defects and origin security | 4 | No weaker evidence or replay authority | +| Captured state, capacity/privacy and global bounds | 3 | Mutation, leakage, hidden capacity growth | +| Native full-inventory publication integration | 3 | Lost scope, late partial publication, freshness | +| Total | 14 | New declarations only | -| Case ID | Area | Requirements | Scenario | -| --- | --- | --- | --- | -| inventory1-C01 | citation recovery | SDD-I944-U1-R1 | For each wire profile, an otherwise valid attributable response with repeated citations uses the existing shared complete-batch correction allowance, then succeeds only with distinct admitted citations while preserving requirements, identities, response bounds, call/time ceilings, and the final publication gate. | -| inventory1-C02 | citation recovery | SDD-I944-U1-R1 | A valid unique-citation response succeeds without correction. | -| inventory1-C03 | allowance exhaustion | SDD-I944-U1-R1 | When a repeated-citation response occurs after the shared correction allowance is consumed, evaluation returns a precise content-free nonretryable diagnostic; it does not silently deduplicate, add an allowance, or rerun unchanged heads. | -| inventory1-C04 | shared recovery | SDD-I944-U1-R1 | Repeated-citation recovery mixed with length/completion recovery consumes the same single complete-batch allowance. | -| inventory1-C05 | evidence validation | SDD-I944-U1-R2 | Missing, foreign, generated, stale, malformed, or forged evidence blocks publication; complete frozen batches remain intact and no partial progress is published. | +| Case ID | Requirements | Executable scenario | +|---|---|---| +| inventory1-C01 | SDD-I944-U1-R1 | Both profiles: repetition alone corrects once with identical effective schema/settings and complete original dictionary. | +| inventory1-C02 | SDD-I944-U1-R1 | Both profiles: unique citations use one query. | +| inventory1-C03 | SDD-I944-U1-R1 | Second repetition is precise, nonretryable, content-free and cannot create a third query or receipt. | +| inventory1-C04 | SDD-I944-U1-R1 | Citation/completion and length/citation sequences share one allowance and retain terminal classification. | +| inventory1-C05 | SDD-I944-U1-R2 | Missing/foreign/stale/generated/malformed evidence and wrong identities stay blocking. | +| inventory1-C06 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Forged, serialized, older-invocation, equal-schema-clone and provider-thrown carriers cannot authorize correction. | +| inventory1-C07 | SDD-I944-U1-R2 | Simultaneous completion, semantic, locale, coverage, schema and length defects remain ineligible. | +| inventory1-C08 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Only full frozen supported current contracts and bounded closed measurements mint origins; changed contracts/context fail. | +| inventory1-C09 | SDD-I944-U1-R1 | Caller mutations cannot alter captured replacement context or request. | +| inventory1-C10 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Complete preflight before queries; bounded hint; fixed private logging and existing presentation; no submitted padding. | +| inventory1-C11 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Actual native adapter replay: all 169 original requirements, 17 parts, 6 batches; one extra final query and one publication. | +| inventory1-C12 | SDD-I944-U1-R2 | Last-batch repetition exhaustion retains all provisional batches and causes zero writes. | +| inventory1-C13 | SDD-I944-U1-R2 | Successful correction cannot bypass a changed native source head. | +| inventory1-C14 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Same call/time ledger; provider and cancellation identity preserved. | + +New pure-policy/domain code requires 100% statements, branches, functions and +lines; modified coverable lines require official exact-head/correct-base Codecov +with zero misses/partials. Full repository and extension budgets remain mandatory. +The archived immutable native fixture and original issue body remain unchanged. +No live credentials, sleeps, omitted requirements or shortened evidence fixtures +are used. Automated text/presentation assertions do not close unrelated human +UX acceptance debt. ### 15. Documentation and discoverability -Update the operator guidance associated with final progress assessment so maintainers can distinguish repeated-citation correction from evidence rejection, understand that correction shares the existing complete-batch allowance with length/completion recovery, and interpret the terminal content-free diagnostic. Keep the unique-citation control, both wire profiles, invalid-evidence blocking, frozen-batch retention, no-partial-publication behavior, and existing limits aligned with the contract in `specs/final-progress-completion-recovery.md`. Preserve the native incident as reported: the original response was not retained, and repetition is an inference from the failure path; the synthetic counterexample and unique-citation control are separate evidence. Do not claim a consumer rerun or implementation acceptance. Publication acceptance must separately establish that the specification satisfies required format, internal and cross-document consistency is checked, and reciprocal catalog ownership, paths, and evidence agree with the generated view; the concrete invocation or prerequisite remains unverified where it has not been inspected. - | Path | Change | -| --- | --- | -| specs/final-progress-completion-recovery.md | update | - -[specs/final-progress-completion-recovery.md](final-progress-completion-recovery.md) +|---|---| +| `docs/agents/execution-contract.mdx` | Eligibility, full snapshots, shared allowance and fixed evidence/budget fences. | +| `docs/issues/branch-management.mdx` | Operator action, nonretryable terminal citation diagnostic, retained provisional batches. | +| `docs/security-operations/operations/error-reference.mdx` | Error reason, privacy and distinction from invalid evidence or other failure categories. | +| `specs/final-progress-completion-recovery.md` | This delta and retained 85-case contract. | +| `specs/catalog.json`, `specs/CATALOG.md` | Reciprocal runtime/test/document ownership and generated evidence. | +| `src/architecture/github_communication_test_budget.json` | Fourteen additional declarations; original budget floors unchanged. | + +Runtime paths are listed in section 8; executable paths are +`src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts` +and `src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts`. +No setup/configuration/migration page needs a new input because none is added. ### 16. Acceptance scenarios -1. Given an otherwise valid, attributable response with unique citations, when either wire profile is evaluated, then it succeeds without correction. This is `inventory1-C02`. -2. Given an otherwise valid, attributable response with repeated citations, when either wire profile is evaluated, then the existing shared complete-batch correction is used and evaluation succeeds only with distinct admitted citations, preserving all requirements, identities, response bounds, call/time ceilings, and the final publication gate. This is `inventory1-C01`. -3. Given a repeated-citation response after the shared correction allowance is consumed, when evaluation rejects it, then a precise content-free nonretryable diagnostic is returned; output is not silently deduplicated, no allowance is added, and unchanged heads are not rerun. This is `inventory1-C03`. -4. Given repeated-citation recovery combined with a length or completion failure, when the correction is applied, then both consume the same single complete-batch allowance. This is `inventory1-C04`. -5. Given missing, foreign, generated, stale, malformed, or forged evidence, when a batch is evaluated, then publication remains blocked, complete frozen batches remain intact, and no partial progress is published. This is `inventory1-C05`. +Given the complete unchanged native batch, unique citations pass without +correction (C02); repetition alone corrects once in either profile (C01). +A second repetition stops precisely without normalization or a third query (C03). +Mixed sequences share the existing allowance (C04). Invalid evidence and combined +defects cannot enter recovery (C05/C07). Only the host's current exact native +request origin qualifies (C06/C08), despite caller mutation (C09). Complete +capacity and privacy fences precede queries (C10). Full immutable native replay +retains all source and requirements and publishes once (C11), while late +exhaustion or freshness drift publishes nothing (C12/C13). Global ledgers and +failure identities remain intact (C14). ### 17. Requirements traceability -SDD-I944-U1-R1 requires acceptance of only distinct citations in otherwise valid attributable responses, correction through the existing shared allowance, preservation of coverage and limits, and terminal handling after exhaustion. It is exercised by `inventory1-C01`, `inventory1-C02`, `inventory1-C03`, and `inventory1-C04`. - -SDD-I944-U1-R2 requires invalid evidence to remain publication-blocking with frozen complete batches and no partial progress. It is exercised by `inventory1-C05`. +| Requirement | Cases | Implementation and documentation | +|---|---|---| +| SDD-I944-U1-R1 | C01–C04, C06, C08–C11, C14 | Domain diagnostic, citation policy, assessment owner and preflight; execution contract and error reference. | +| SDD-I944-U1-R2 | C05–C08, C10–C14 | Receipt/batch validation, private binding and existing publication fences; branch-management and error reference. | -These mappings describe planned acceptance coverage. They do not claim the cases were implemented or executed. - -| Requirement | Cases | -|---|---| -| SDD-I944-U1-R1 | inventory1-C01, inventory1-C02, inventory1-C03, inventory1-C04 | -| SDD-I944-U1-R2 | inventory1-C05 | +Cxx here means the preserved `inventory1-Cxx` ID in section 14. Every case maps +back to a requirement there; catalog paths reciprocate the runtime/test evidence. ### 18. Implementation sequence -1. Clarify that each accepted citation must be distinct, admitted evidence, and that repetition makes an otherwise valid attributable response eligible for the existing complete-batch correction path. -2. Apply that correction through the single allowance shared with length and completion recovery. Retain the complete frozen batch and all requirement coverage, distinct admitted references, identities, response bounds, the 120-call and 30-minute ceilings, and the final publication gate. Do not deduplicate output, fabricate citations, or accept invalid evidence. -3. If repetition remains after the shared allowance is consumed, stop with a precise, content-free, nonretryable diagnostic. Do not retry unchanged heads or publish partial progress. -4. Keep the immutable retained contract and cases in `specs/final-progress-completion-recovery.md`; this delta refines repeated-citation handling within that contract. Validate both wire profiles, the unique-citation control, repeated-citation recovery and exhaustion, and mixed citation/length/completion recovery using the same allowance. Verify that missing, foreign, generated, stale, malformed, or forged evidence still blocks publication and that frozen batches remain intact. Existing test budgets and coverage gates apply; concrete verification invocations and prerequisites remain unverified in this draft. +1. Verify the Action's admitted branch and published SDD before code changes. +2. Capture actual native-adapter RED regressions and unique controls. +3. Implement strict whole-response eligibility and private request binding. +4. Extend the existing two-evaluation owner and full-envelope preflight. +5. Add negative, mixed, mutation, budget and native publication cases. +6. Update docs/catalog/budget and run generation and validation. +7. Build/stage generated artifacts; pass normal hooks, all local/remote gates, + official changed-line coverage and complete current-head review. +8. Qualify the reviewed immutable candidate in Domus without changing its body, + scope or application. A later patch publication needs separate authorization. ### 19. Definition of Done -- The specification satisfies the required format. -- Internal and cross-document consistency is checked, including the retained recovery contract and the mapped behaviors for both wire profiles, unique citations, repeated-citation correction and exhaustion, shared allowance use, and invalid evidence. -- Reciprocal catalog ownership, paths, and evidence agree with the generated view. -- Product validation demonstrates that an otherwise valid repeated-citation response can recover within the existing shared complete-batch allowance, preserving coverage, identities, response bounds, the 120-call/30-minute ceiling, and the final publication gate; unique citations succeed without correction; and a repeat after allowance exhaustion produces a precise content-free nonretryable diagnostic without deduplication, added allowance, unchanged-head reruns, or partial publication. -- Missing, foreign, generated, stale, malformed, or forged evidence continues to block publication, with complete frozen batches retained. The original native response was not retained, so native repetition is not claimed as directly captured. The issue reports a synthetic counterexample and a unique-citation control; do not treat that report as execution of this delta's validation. -- Existing repository test budgets, coverage gates, and required review outcomes remain in force. Concrete invocation and prerequisites for product validation remain unverified. +- [x] Action branch/SDD gate verified before implementation. +- [x] Genuine pre-fix native regressions captured; all 14 new case IDs have assertions. +- [x] Focused tests pass; both new pure modules measure 100% of all four metrics. +- [ ] Full root/extension verification, normal hooks and architecture checks pass. +- [ ] Generated/validated catalog, documentation and workflow contracts agree. +- [ ] All applicable current-head platform/CI checks pass; official Codecov has no changed-line misses/partials. +- [ ] Native review is complete with zero active findings/threads. +- [ ] New immutable-candidate Domus Commit, Review and application CI pass. +- [ ] Only then merge the source PR under existing authorization. + +These unchecked outcomes are required acceptance gates, not facts established +by declarations or synthetic success. Existing open human UX/security dependency +debt is recorded separately and is not silently certified by this correction. + +Local root verification passed 921 suites / 18,313 tests with 35 pre-existing +skips. Root coverage is 97.58% statements, 95.60% branches, 98.19% functions and +98.28% lines; all coverage budgets passed. All six changed/new runtime modules +measure 100% across the four metrics, including the complete batch workflow. +The setup ledger remains 336/350 with 14 explicitly open human cases. +Extension verification passed 385 suites / 5,289 tests with 100% statements, +branches, functions and lines. Types, lint, build, +package/CLI/typed-API/web-session smoke, specifications, documentation and workflow +contracts passed. Normal hooks, remote review/CI/Codecov and new native consumer +qualification remain independent gates and are not inferred from these local +results. Their exact candidate receipts belong in the linked PR; this local +checkpoint is not a rolling remote-status record. ### 20. References and decisions -Issue context: [#944](https://github.com/vypdev/copilot/issues/944). The issue reports that repeated citations pass adapter schema validation but fail evidence parsing, with progress retained. It explicitly says the original native response was not retained; repetition is inferred from the native failure path, while a synthetic counterexample reproduces the mismatch and a unique-citation control succeeds. This draft preserves that evidence limitation and does not assert that the native response was captured. - -The owning recovery contract and retained cases are in `specs/final-progress-completion-recovery.md`. The change is limited to making distinct citations explicit and routing repeated citations through the existing shared complete-batch correction allowance, while preserving evidence validation, batch retention, publication gating, and established limits. No new allowance or release authorization is implied. +- [Issue #944](https://github.com/vypdev/copilot/issues/944): actual native failure, + original response unavailable, separate deterministic mismatch/control. +- [Release 3.10.12](https://github.com/vypdev/copilot/releases/tag/v3.10.12): + published immutable baseline; this delta does not change its artifact. +- [Domus native failed Commit](https://github.com/vypdev/domus/actions/runs/42518152136): + observed R63 failure and retained progress, not a duplicate raw-response capture. +- Existing owners `specs/batched-progress-scope.md` and the retained sections + above remain authoritative for collection, receipt, freshness and publication + bounds. No unknown external provider feature is relied upon. diff --git a/src/application/policies/__tests__/progress_batch_policy.test.ts b/src/application/policies/__tests__/progress_batch_policy.test.ts index 24df35fe8..8393b5fe4 100644 --- a/src/application/policies/__tests__/progress_batch_policy.test.ts +++ b/src/application/policies/__tests__/progress_batch_policy.test.ts @@ -169,7 +169,7 @@ it('CommitScope916-C09 supplies strict native same-head and citation response sc expect(schema.properties.requirements.items.properties.citations.minItems).toBe(1); expect(schema.properties.requirements.maxItems).toBe(32); const native = projectCodexOutputSchema(schema) as typeof schema; - expect(Object.keys(native.properties.requirements.items.properties.citations).sort()).toEqual(['items', 'maxItems', 'minItems', 'type']); + expect(Object.keys(native.properties.requirements.items.properties.citations).sort()).toEqual(['description', 'items', 'maxItems', 'minItems', 'type']); expect(native.properties.requirements.items.properties.citations).toEqual(schema.properties.requirements.items.properties.citations); }); diff --git a/src/application/policies/progress_batch_policy.ts b/src/application/policies/progress_batch_policy.ts index 5a8bc0afa..0b5461a6f 100644 --- a/src/application/policies/progress_batch_policy.ts +++ b/src/application/policies/progress_batch_policy.ts @@ -12,6 +12,8 @@ import { validateFramedProgressEvidence } from './progress_evidence_protocol_pol import { isProgressEvidencePath } from '../../domain/progress_evidence_path'; import { MAX_PROGRESS_ASSESSMENT_POINTS, progressAssessmentFactLimit } from './progress_assessment_capacity_policy'; import { ProgressCapacityFailure } from '../errors/progress_capacity_failure'; +import { ProgressCompletionMismatch } from '../errors/progress_completion_mismatch'; +import { progressCitationRepetitionError } from './progress_citation_recovery_policy'; export const PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262_144, assessmentClauses: 32, calls: 120, milliseconds: 1_800_000 }); @@ -146,7 +148,7 @@ export function progressBatchResponseSchema(manifest: ProgressScopeManifest, bat properties: { ...schema.properties.requirements.items.properties, summary: { ...schema.properties.requirements.items.properties.summary, maxLength: factLimit, description }, remaining: { ...schema.properties.requirements.items.properties.remaining, maxLength: factLimit, description }, - citations: { type: 'array', minItems: 1, maxItems: 8, + citations: { type: 'array', minItems: 1, maxItems: 8, description: 'One to eight distinct admitted evidence IDs. Never repeat a citation within a requirement.', items: { type: 'string', enum: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) } } }, required: [...schema.properties.requirements.items.required, 'citations'] } } }, required: [...schema.required, 'manifestDigest', 'batchId', 'headSha'] }; @@ -161,7 +163,7 @@ export interface ProgressAssessmentReceipt { readonly digest: string; } export function readProgressAssessmentEvidence(response: unknown, manifest: ProgressScopeManifest, batch: ProgressAssessmentBatch, locale: string, - anchors: ProgressScopeAnchors, compact: boolean) { + anchors: ProgressScopeAnchors, compact: boolean, requestSchema?: Record) { const payload = progressResponsePayload(response, locale, 'assessment'); const fail = (reason: ProgressBatchReason, requirementId = 'none'): never => { throw progressBatchRejected(reason, { batch: batch.ordinal, requirementId }); }; if (!exact(payload, ['outputLocale', 'progress', 'requirements', 'manifestDigest', 'batchId', 'headSha']) @@ -172,6 +174,7 @@ export function readProgressAssessmentEvidence(response: unknown, manifest: Prog fail('receipt-coverage', missing?.id); } const citations: (readonly string[])[] = []; + let repetition: { requirementId: string; citationCount: number; distinctCount: number } | undefined; const factLimit = aggregateFactLimit(manifest, compact, anchors); const facts = (payload.requirements as unknown[]).map(value => { if (!record(value) || !exact(value, ['id', 'status', 'evidence', 'summary', 'remaining', 'citations'])) return fail('receipt-coverage'); @@ -185,17 +188,31 @@ export function readProgressAssessmentEvidence(response: unknown, manifest: Prog context: { kind: 'assessment', requirementCount: manifest.scope.requirements.length, batch: batch.ordinal, requirementId: id }, }); } - if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8 - || new Set(value.citations).size !== value.citations.length) return fail('evidence-missing', id); + if (!Array.isArray(value.citations) || value.citations.length < 1 || value.citations.length > 8) return fail('evidence-missing', id); for (const citation of value.citations) { const reference = manifest.evidence.find(entry => entry.id === citation); if (!reference || reference.headSha !== manifest.headSha || reference.generated) fail('evidence-identity', id); } + const distinctCount = new Set(value.citations).size; + if (!repetition && distinctCount !== value.citations.length) repetition = { requirementId: id, citationCount: value.citations.length, distinctCount }; citations.push(Object.freeze([...value.citations] as string[])); const { citations: _citations, ...fact } = value; return fact; }); - return { payload: { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }, citations }; + const canonical = { outputLocale: payload.outputLocale, progress: payload.progress, requirements: facts }; + if (repetition) { + const scope = progressBatchDisplayScope(batch, compact); + // A repetition is eligible only when every other native and semantic check passes. + // A simultaneous completion contradiction must not escape as an eligible completion result. + try { parseScopedProgressResponse(canonical, locale, scope, anchors); } + catch (error) { + if (error instanceof ProgressCompletionMismatch) return fail('evidence-duplicate', repetition.requirementId); + throw error; + } + throw progressCitationRepetitionError(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, + { ...repetition, batch: batch.ordinal, sourceLineId: anchors[repetition.requirementId] ?? 'none' }, requestSchema); + } + return { payload: canonical, citations }; } export function parseProgressAssessmentReceipt(response: unknown, manifest: ProgressScopeManifest, batch: ProgressAssessmentBatch, anchors: ProgressScopeAnchors, locale: string, compact: boolean): ProgressAssessmentReceipt { diff --git a/src/application/policies/progress_citation_recovery_policy.ts b/src/application/policies/progress_citation_recovery_policy.ts new file mode 100644 index 000000000..c7d376040 --- /dev/null +++ b/src/application/policies/progress_citation_recovery_policy.ts @@ -0,0 +1,69 @@ +import { isDeepStrictEqual } from 'node:util'; +import { isProgressCitationRepetitionDiagnostic, type ProgressCitationRepetitionDiagnostic } from '../../domain/progress_citation_repetition'; +import type { ProgressScope, ProgressScopeAnchors } from './progress_scope_policy'; +import { compactProgressAssessmentPlan } from './progress_compact_assessment_policy'; +import { progressBatchRejected } from './progress_batch_rejection_policy'; +import type { ApplicationError } from '../errors/application_error'; + +interface NativeRepetition { + readonly schema: Record; + readonly scope: ProgressScope; + readonly anchors: ProgressScopeAnchors; + readonly locale: string; + readonly facts: ProgressCitationRepetitionDiagnostic; +} +const nativeRepetitions = new WeakMap(); +export const PROGRESS_CITATION_HINT_MAX_BYTES = 256; +const PREFIX = '\n\nThe previous completed assessment repeated a source citation. Return one complete replacement for the SAME pinned batch, original requirement IDs, evidence dictionary, locale and unchanged schema. Each citations array must contain one to eight DISTINCT admitted source IDs. Preserve the complete original evidence inventory; do not invent references, infer verification, force completion or omit requirements. These closed measurements describe the rejected response, not implementation or execution evidence.\n[BEGIN_PREVIOUS_CITATION_REPETITION]\n'; +const SUFFIX = '\n[END_PREVIOUS_CITATION_REPETITION]'; + +function freezeSnapshot(value: T): T { + if (value && typeof value === 'object' && !Object.isFrozen(value)) { + Object.freeze(value); + Object.values(value).forEach(freezeSnapshot); + } + return value; +} + +/** Only the native receipt validator mints this invocation-local origin; public error fields cannot forge it. */ +export function progressCitationRepetitionError(schema: Record, scope: ProgressScope, anchors: ProgressScopeAnchors, + locale: string, facts: ProgressCitationRepetitionDiagnostic, requestSchema?: Record): ApplicationError { + const valid = isProgressCitationRepetitionDiagnostic(facts); + const error = progressBatchRejected('evidence-duplicate', valid ? { batch: facts.batch, requirementId: facts.requirementId } : {}); + if (!valid || !requestSchema || !Object.isFrozen(requestSchema)) return error; + try { + const captured = structuredClone({ scope, anchors, locale, facts }); + const canonical = structuredClone(schema), actual = structuredClone(requestSchema); + const compact = compactProgressAssessmentPlan(canonical, locale); + if (!isDeepStrictEqual(canonical, actual) && (!compact || !isDeepStrictEqual(structuredClone(compact.schema), actual))) return error; + nativeRepetitions.set(error, Object.freeze({ ...freezeSnapshot(captured), schema: requestSchema })); + } catch { /* Unknown contracts never acquire recovery authority. */ } + return error; +} + +/** Bind complete native request and scope snapshots, not exception names or model-echoed metadata. */ +export function bindProgressCitationRepetition(error: unknown, schema: Record | undefined, scope: ProgressScope, + anchors: ProgressScopeAnchors, sourceLineIds: readonly string[], locale: string): ProgressCitationRepetitionDiagnostic | null { + if (!error || typeof error !== 'object') return null; + const captured = nativeRepetitions.get(error); + if (!captured || captured.locale !== locale || captured.schema !== schema + || !isDeepStrictEqual(captured.scope, scope) || !isDeepStrictEqual(captured.anchors, anchors) + || !sourceLineIds?.includes(captured.facts.sourceLineId)) return null; + return captured.facts; +} + +/** Planning only: an unrelated legacy schema does not reserve a citation correction it cannot produce. */ +export function hasProgressCitationsSchema(schema: Record): boolean { + const record = (value: unknown): value is Record => Boolean(value) && typeof value === 'object' && !Array.isArray(value); + const properties = schema.properties, requirements = record(properties) ? properties.requirements : undefined; + const items = record(requirements) ? requirements.items : undefined, fields = record(items) ? items.properties : undefined; + return record(fields) && record(fields.citations); +} + +export function reservedProgressCitationPrompt(prompt: string): string { + return prompt + PREFIX + ' '.repeat(PROGRESS_CITATION_HINT_MAX_BYTES) + SUFFIX; +} +export function progressCitationRepairPrompt(prompt: string, facts: ProgressCitationRepetitionDiagnostic): string { + if (!isProgressCitationRepetitionDiagnostic(facts)) throw new TypeError('Progress citation repetition diagnostic is invalid.'); + return prompt + PREFIX + JSON.stringify(facts) + SUFFIX; +} diff --git a/src/application/policies/progress_prompt_capacity_policy.ts b/src/application/policies/progress_prompt_capacity_policy.ts index 3a4447731..8c2c79ab9 100644 --- a/src/application/policies/progress_prompt_capacity_policy.ts +++ b/src/application/policies/progress_prompt_capacity_policy.ts @@ -6,7 +6,8 @@ import { MAX_PROGRESS_AGGREGATE_BYTES } from './progress_partition_response_poli import { reservedProgressCompletionPrompt } from './progress_completion_recovery_policy'; import { reservedProgressAssessmentLengthPrompt } from './progress_assessment_length_policy'; import type { ProgressCapacityPhase } from '../../domain/progress_capacity_diagnostic'; -import { compactProgressAssessmentPlan, reservedCompactProgressAssessmentPrompt } from './progress_compact_assessment_policy'; +import { compactProgressAssessmentPlan, compactProgressAssessmentPrompt, reservedCompactProgressAssessmentPrompt } from './progress_compact_assessment_policy'; +import { hasProgressCitationsSchema, reservedProgressCitationPrompt } from './progress_citation_recovery_policy'; export const PROGRESS_PROMPT_FRAMING_RESERVE_BYTES = 1_024; @@ -40,5 +41,9 @@ export function remainingProgressAssessmentPromptBytes(prompt: string, schema: S remainingProgressPromptBytes(reservedProgressCompletionPrompt(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), remainingProgressPromptBytes(reservedProgressAssessmentLengthPrompt(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), ...(compact ? [remainingProgressPromptBytes(reservedCompactProgressAssessmentPrompt(prompt), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), + ...(hasProgressCitationsSchema(schema as Record) ? [ + remainingProgressPromptBytes(reservedProgressCitationPrompt(prompt), 'progress', schema, effort, 'native-prompt-reserve-bytes'), + ...(compact ? [remainingProgressPromptBytes(reservedProgressCitationPrompt(compactProgressAssessmentPrompt(prompt)), 'progress', compact.schema, effort, 'native-prompt-reserve-bytes')] : []), + ] : []), ); } diff --git a/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts b/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts new file mode 100644 index 000000000..d88e40fd7 --- /dev/null +++ b/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts @@ -0,0 +1,262 @@ +import { queryProgressAssessment } from '../query_progress_assessment_workflow'; +import { captureProgressScopeSource } from '../../../policies/progress_scope_source_policy'; +import { parseProgressScopeWithAnchors } from '../../../policies/progress_scope_policy'; +import { partitionProgressDiff } from '../../../policies/progress_diff_partition_policy'; +import { createProgressScopeManifest, planProgressAssessmentBatches, progressBatchResponseSchema, + progressBatchDisplayScope, readProgressAssessmentEvidence, parseProgressAssessmentReceipt, PROGRESS_BATCH_PROFILE } from '../../../policies/progress_batch_policy'; +import { productFacingAgentQueryOptions } from '../../../policies/agent_output_locale_policy'; +import { interpretProgressAgentOutput } from '../../../../data/repository/progress_agent_response_policy'; +import type { FindingsQueryRequest } from '../../../ports/agent_findings_ports'; +import { assessmentWireFixture } from './fixtures/progress_assessment_wire_fixture'; +import { ApplicationError } from '../../../errors/application_error'; +import { progressCitationRepetitionError, bindProgressCitationRepetition, progressCitationRepairPrompt, + reservedProgressCitationPrompt, PROGRESS_CITATION_HINT_MAX_BYTES, hasProgressCitationsSchema } from '../../../policies/progress_citation_recovery_policy'; +import { isProgressCitationRepetitionDiagnostic } from '../../../../domain/progress_citation_repetition'; +import { remainingProgressAssessmentPromptBytes } from '../../../policies/progress_prompt_capacity_policy'; +import { boundProgressBatchAgent } from '../../../policies/progress_batch_query_policy'; +import { compactProgressAssessmentPlan } from '../../../policies/progress_compact_assessment_policy'; +import { buildApplicationErrorPresentation } from '../../../policies/application_error_presentation_policy'; +import * as logging from '../../../ports/logging_ports'; + +afterEach(() => jest.restoreAllMocks()); +const thrown = (action: () => unknown): unknown => { try { action(); } catch (error) { return error; } throw Error('Expected rejection.'); }; +const facts = { requirementId: 'R1', sourceLineId: 'L1', batch: 1, citationCount: 3, distinctCount: 2 }; +const freeze = (value: T): T => { + if (value && typeof value === 'object' && !Object.isFrozen(value)) { Object.freeze(value); Object.values(value).forEach(freeze); } + return value; +}; + +type Profile = 'prose' | 'closed'; +type Row = Record & { id: string; status: string; evidence: string; summary: string; remaining: string | null; citations: string[] }; +function fixture(profile: Profile) { + const body = 'First original obligation.\nSecond original obligation.'; + const source = captureProgressScopeSource(body), classifications = source.lines.map(line => ({ id: line.id, kind: 'required' })); + const extraction = parseProgressScopeWithAnchors({ outputLocale: 'en-US', lines: classifications }, source, 'en-US', PROGRESS_BATCH_PROFILE); + const base = 'a'.repeat(40), head = 'b'.repeat(40), compact = profile === 'closed'; + const diff = partitionProgressDiff(base, head, ['src/first.ts', 'src/second.ts'].map(path => ({ path, status: 'modified', additions: 1, deletions: 0, patch: '+source' }))); + const manifest = createProgressScopeManifest({ capturedSource: source, classifications, repository: 'owner/repo', issueNumber: 944, + issueDescription: body, comparisonSource: { kind: 'development', baseBranch: 'develop' }, baseSha: base, headSha: head, scope: extraction.scope }, diff); + const batch = planProgressAssessmentBatches(manifest)[0], schema = progressBatchResponseSchema(manifest, batch, extraction.anchors, compact); + const context = { scope: structuredClone(progressBatchDisplayScope(batch, compact)), anchors: structuredClone(extraction.anchors), + sourceLineIds: source.lines.map(line => line.id), targetLocale: 'en-US', preferCompactFacts: compact }; + const request: FindingsQueryRequest = { agentId: 'plan', prompt: 'Complete pinned comparison; preserve every original obligation and admitted source reference.', + configuration: { provider: 'codex', model: 'fixture-model', effort: 'low' }, options: { ...productFacingAgentQueryOptions('progress', schema) } }; + const references = manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id); + const output = (repeated = false) => ({ outputLocale: 'en-US', progress: 50, manifestDigest: manifest.digest, batchId: batch.id, headSha: head, + requirements: batch.scope.requirements.map((requirement, index): Row => ({ id: requirement.id, status: 'verification-unknown', evidence: 'source-only', + summary: 'The original source was inspected.', remaining: 'Execution remains unverified.', + citations: index === 0 ? repeated ? [references[0], references[0], references[1]] : [...references] : [references[1]] })) }); + const interpret = (actual: FindingsQueryRequest, response: ReturnType) => interpretProgressAgentOutput( + JSON.stringify(assessmentWireFixture(response, actual.options!.schema!)), 'assessment', actual.options!.schema!); + let accepted: unknown; + const project = (response: Parameters[0], requestSchema?: Record) => { + const result = readProgressAssessmentEvidence(response, manifest, batch, 'en-US', extraction.anchors, compact, requestSchema); + accepted = response; + return result.payload; + }; + const receipt = () => parseProgressAssessmentReceipt(accepted, manifest, batch, extraction.anchors, 'en-US', compact); + return { request, context, output, interpret, project, receipt, schema, manifest, batch, extraction, references }; +} + +it.each(['prose', 'closed'] as const)('inventory1-C01: a native %s duplicate receives one complete same-profile correction', async profile => { + const f = fixture(profile); + const query = jest.fn(async (request: FindingsQueryRequest): Promise> => f.interpret(request, f.output(query.mock.calls.length === 1))); + const result = await queryProgressAssessment({ query }, f.request, f.context, f.project); + expect(result.progress).toBe(50); + expect(query).toHaveBeenCalledTimes(2); + const [first, second] = query.mock.calls.map(([request]) => request); + expect(second.options).toEqual(first.options); + expect(second.configuration).toBe(first.configuration); + expect(second.prompt.startsWith(first.prompt)).toBe(true); + expect(second.prompt).toContain('"requirementId":"R1"'); + expect(second.prompt).toContain('"sourceLineId":"L1"'); + expect(f.receipt()).toMatchObject({ requirementIds: ['R1', 'R2'], citations: [f.references, [f.references[1]]] }); +}); + +it.each(['prose', 'closed'] as const)('inventory1-C02: a unique native %s receipt keeps its ordinary one-query path', async profile => { + const f = fixture(profile), query = jest.fn(async (request: FindingsQueryRequest) => f.interpret(request, f.output())); + expect((await queryProgressAssessment({ query }, f.request, f.context, f.project)).progress).toBe(50); + expect(query).toHaveBeenCalledTimes(1); + expect(f.receipt().requirementIds).toEqual(['R1', 'R2']); +}); + +it.each(['prose', 'closed'] as const)('inventory1-C03: a second %s repetition is terminal, content-free and never silently deduplicated', async profile => { + const f = fixture(profile), query = jest.fn(async (request: FindingsQueryRequest) => f.interpret(request, f.output(true))); + const error = await queryProgressAssessment({ query }, f.request, f.context, f.project).catch(error => error); + expect(query).toHaveBeenCalledTimes(2); + expect(error).toMatchObject({ code: 'validation.evidence-unavailable', retryable: false, + recovery: { id: 'progress-batch-retained', variables: { reason: 'evidence-duplicate', batch: 1, requirementId: 'R1' } } }); + expect(JSON.stringify(error)).not.toContain(f.references[0]); + expect(() => f.receipt()).toThrow(); + expect(bindProgressCitationRepetition(error, query.mock.calls[1][0].options!.schema, f.context.scope, f.context.anchors, ['L1', 'L2'], 'en-US')).toBeNull(); +}); + +it.each(['duplicate-completion', 'completion-duplicate', 'length-duplicate', 'duplicate-length'] as const)( + 'inventory1-C04: %s consumes the same single replacement allowance', async mode => { + const f = fixture('prose'); + const query = jest.fn(async (request: FindingsQueryRequest) => { + const first = query.mock.calls.length === 1; + const response = f.output(mode.startsWith('duplicate-') ? first : !first); + if (mode === 'duplicate-completion' && !first || mode === 'completion-duplicate' && first) response.progress = 100; + if (mode === 'length-duplicate' && first) response.requirements[0].summary = 'PRIVATE_' + 'x'.repeat(801); + if (mode === 'duplicate-length' && !first) response.requirements[0].summary = 'PRIVATE_' + 'x'.repeat(801); + return f.interpret(request, response); + }); + const error = await queryProgressAssessment({ query }, f.request, f.context, f.project).catch(error => error); + expect(query).toHaveBeenCalledTimes(2); + expect(error).toMatchObject(mode === 'duplicate-completion' + ? { code: 'agent.failed', recovery: { id: 'progress-completion-recovery-exhausted' } } + : mode === 'duplicate-length' ? { retryable: false, recovery: { id: 'progress-assessment-length-invalid' } } + : { retryable: false, recovery: { variables: { reason: 'evidence-duplicate' } } }); + expect(JSON.stringify(error)).not.toContain('PRIVATE_'); + }); + +it('inventory1-C05: other missing, foreign, stale, generated or malformed evidence never acquires citation correction authority', async () => { + for (const mode of ['empty', 'foreign', 'stale', 'generated', 'malformed', 'wrong-head', 'wrong-batch', 'wrong-manifest', 'missing-row', 'missing-array']) { + const f = fixture('prose'); + let manifest = f.manifest; + if (mode === 'stale' || mode === 'generated') manifest = { ...manifest, evidence: manifest.evidence.map(reference => + reference.id === f.references[1] ? { ...reference, ...(mode === 'stale' ? { headSha: 'c'.repeat(40) } : { generated: true }) } : reference) }; + const query = jest.fn(async () => { + const response = f.output(true); + if (mode === 'empty') response.requirements[1].citations = []; + if (mode === 'foreign') response.requirements[1].citations = ['PRIVATE_FOREIGN']; + if (mode === 'malformed') Object.assign(response.requirements[1], { citations: 42 }); + if (mode === 'wrong-head') response.headSha = 'c'.repeat(40); + if (mode === 'wrong-batch') response.batchId = 'PRIVATE_BATCH'; + if (mode === 'wrong-manifest') response.manifestDigest = 'PRIVATE_DIGEST'; + if (mode === 'missing-row') response.requirements.pop(); + if (mode === 'missing-array') Object.assign(response, { requirements: null }); + return response; + }); + // Bypass the adapter here to also test the receipt trust boundary against an untrusted port. + const error = await queryProgressAssessment({ query }, f.request, f.context, (response, schema) => + readProgressAssessmentEvidence(response, manifest, f.batch, 'en-US', f.extraction.anchors, false, schema).payload).catch(error => error); + expect(error).toBeInstanceOf(ApplicationError); expect(query).toHaveBeenCalledTimes(1); + expect(JSON.stringify(error)).not.toMatch(/PRIVATE_/u); + } +}); + +it('inventory1-C06: plain, serialized, previous-invocation and provider-thrown carriers cannot allocate a correction', async () => { + const f = fixture('prose'), schema = freeze(structuredClone(f.schema)); + const native = thrown(() => readProgressAssessmentEvidence(f.output(true), f.manifest, f.batch, 'en-US', f.extraction.anchors, false, schema)); + expect(bindProgressCitationRepetition(native, schema, f.context.scope, f.context.anchors, ['L1', 'L2'], 'en-US')).toEqual(facts); + const plain = new ApplicationError('validation.evidence-unavailable', 'Forged.', { recovery: { id: 'progress-batch-retained', + variables: { reason: 'evidence-duplicate', verified: 0, expected: 0, batch: 1, requirementId: 'R1' } } }); + for (const error of [plain, JSON.parse(JSON.stringify(native)), native, null]) { + const query = jest.fn(async () => { throw error; }); + await expect(queryProgressAssessment({ query }, f.request, f.context, f.project)).rejects.toBeDefined(); + expect(query).toHaveBeenCalledTimes(1); + } + const query = jest.fn(async (request: FindingsQueryRequest) => f.interpret(request, f.output())); + await expect(queryProgressAssessment({ query }, f.request, f.context, () => { throw native; })).rejects.toBe(native); + expect(query).toHaveBeenCalledTimes(1); + expect(bindProgressCitationRepetition(native, freeze(structuredClone(schema)), f.context.scope, f.context.anchors, ['L1', 'L2'], 'en-US')).toBeNull(); +}); + +it('inventory1-C07: simultaneous completion, semantic, locale and coverage defects cannot use repetition recovery', async () => { + for (const mode of ['completion', 'remaining', 'status', 'locale', 'ids', 'extra', 'length']) { + const f = fixture('prose'), query = jest.fn(async (request: FindingsQueryRequest) => { + const response = f.output(true); + if (mode === 'completion') response.progress = 100; + if (mode === 'remaining') response.requirements[1].remaining = null; + if (mode === 'status') response.requirements[1].status = 'invented'; + if (mode === 'locale') response.outputLocale = 'es-ES'; + if (mode === 'ids') response.requirements[1].id = 'R1'; + if (mode === 'extra') response.requirements[1].unexpected = 'PRIVATE_'; + if (mode === 'length') response.requirements[1].summary = 'x'.repeat(801); + return f.interpret(request, response); + }); + await expect(queryProgressAssessment({ query }, f.request, f.context, f.project)).rejects.toBeDefined(); + expect(query).toHaveBeenCalledTimes(1); + } +}); + +it('inventory1-C08: only the frozen complete current contract and closed bounded diagnostic can mint a native origin', () => { + const f = fixture('prose'), schema = freeze(structuredClone(f.schema)); + const mint = (candidate: unknown, actual: Record | undefined = schema, canonical: Record = f.schema) => + progressCitationRepetitionError(canonical, f.context.scope, f.context.anchors, 'en-US', candidate as typeof facts, actual); + const bind = (error: unknown, actual: Record = schema, scope = f.context.scope, anchors = f.context.anchors, lines = ['L1', 'L2'], locale = 'en-US') => + bindProgressCitationRepetition(error, actual, scope, anchors, lines, locale); + const valid = mint(facts); expect(bind(valid)).toEqual(facts); + expect(bind(valid, schema, f.context.scope, f.context.anchors, ['L2'])).toBeNull(); + expect(bind(valid, schema, f.context.scope, f.context.anchors, ['L1'], 'es-ES')).toBeNull(); + expect(bind(valid, schema, { ...f.context.scope, exclusions: [{ id: 'R3', quote: 'different' }] })).toBeNull(); + expect(bind(valid, schema, f.context.scope, { ...f.context.anchors, R1: 'L2' })).toBeNull(); + for (const candidate of [null, [], {}, { ...facts, extra: 'PRIVATE_' }, { ...facts, requirementId: 'PRIVATE_' }, { ...facts, sourceLineId: 'L0' }, + ...[0, 1025, 1.5].map(batch => ({ ...facts, batch })), ...[1, 9, 2.5].map(citationCount => ({ ...facts, citationCount })), + ...[0, 3, 1.5].map(distinctCount => ({ ...facts, distinctCount }))]) { + expect(isProgressCitationRepetitionDiagnostic(candidate)).toBe(false); expect(bind(mint(candidate))).toBeNull(); + expect(() => progressCitationRepairPrompt('', candidate as typeof facts)).toThrow(TypeError); + } + expect(bind(progressCitationRepetitionError(f.schema, f.context.scope, f.context.anchors, 'en-US', facts))).toBeNull(); + expect(bind(mint(facts, structuredClone(schema)))).toBeNull(); + expect(bind(mint(facts, freeze({ ...schema, title: 'changed' })))).toBeNull(); + expect(bind(mint(facts, schema, { properties: { callable: () => undefined } }))).toBeNull(); + expect(bind(mint(facts, schema, {}))).toBeNull(); + const unanchored = thrown(() => readProgressAssessmentEvidence(f.output(true), f.manifest, f.batch, 'en-US', {}, false, schema)); + expect(bind(unanchored)).toBeNull(); + expect(bind(undefined)).toBeNull(); expect(bind(1)).toBeNull(); + const closed = freeze(structuredClone(compactProgressAssessmentPlan(f.schema, 'en-US')!.schema)); + expect(bind(mint(facts, closed), closed)).toEqual(facts); + expect(Object.isFrozen(f.schema)).toBe(false); +}); + +it('inventory1-C09: correction uses immutable invocation snapshots despite caller mutation', async () => { + const f = fixture('prose'), original = structuredClone(f.request); + const query = jest.fn(async (request: FindingsQueryRequest): Promise> => { + expect(request.configuration).toEqual(original.configuration); + expect(request.options).toEqual(original.options); + if (query.mock.calls.length === 1) { + f.request.configuration!.model = 'foreign'; f.request.options!.schema = {}; + Object.assign(f.context.scope.requirements[0], { id: 'R99' }); Object.assign(f.context.anchors, { R1: 'L99' }); + f.context.sourceLineIds[0] = 'L99'; f.context.targetLocale = 'es-ES'; + } + return f.interpret(request, f.output(query.mock.calls.length === 1)); + }); + expect((await queryProgressAssessment({ query }, f.request, f.context, f.project)).progress).toBe(50); + expect(query).toHaveBeenCalledTimes(2); expect(query.mock.calls[1][0].prompt).toContain('"sourceLineId":"L1"'); + expect(Object.isFrozen(f.request)).toBe(false); expect(Object.isFrozen(query.mock.calls[1][0])).toBe(true); +}); + +it('inventory1-C10: full correction capacity is reserved before querying and diagnostics never carry source prose or citations', async () => { + const f = fixture('prose'), log = jest.spyOn(logging, 'logInfo').mockImplementation(() => undefined); + const largest = { requirementId: 'R524289', sourceLineId: 'L524289', batch: 1024, citationCount: 8, distinctCount: 7 }; + expect(Buffer.byteLength(JSON.stringify(largest))).toBeLessThanOrEqual(PROGRESS_CITATION_HINT_MAX_BYTES); + expect(Buffer.byteLength(progressCitationRepairPrompt('prompt', largest))).toBeLessThanOrEqual(Buffer.byteLength(reservedProgressCitationPrompt('prompt'))); + expect(hasProgressCitationsSchema({})).toBe(false); expect(hasProgressCitationsSchema({ properties: [] })).toBe(false); + expect(hasProgressCitationsSchema(f.schema)).toBe(true); + const query = jest.fn(async (request: FindingsQueryRequest) => f.interpret(request, f.output(true))); + const error = await queryProgressAssessment({ query }, f.request, f.context, f.project).catch(error => error); + expect(log).toHaveBeenCalledTimes(1); expect(JSON.stringify(log.mock.calls)).not.toMatch(/R1|L1|original obligation|source-/u); + expect(query.mock.calls[1][0].prompt).not.toContain(' '.repeat(PROGRESS_CITATION_HINT_MAX_BYTES)); + const presentation = buildApplicationErrorPresentation(error); + expect(presentation.retryable).toBe('No'); expect(presentation.action).toContain('evidence-duplicate'); + const remaining = remainingProgressAssessmentPromptBytes('', f.schema); + const legacy = structuredClone(f.schema); + legacy.properties.requirements.items.properties.summary.maxLength = 8; + expect(remainingProgressAssessmentPromptBytes('', legacy)).toBeGreaterThan(0); + f.request.prompt = 'x'.repeat(remaining + 1); const never = jest.fn(); + await expect(queryProgressAssessment({ query: never }, f.request, f.context, f.project)).rejects.toMatchObject({ code: 'validation.evidence-too-large' }); + expect(never).not.toHaveBeenCalled(); +}); + +it('inventory1-C14: correction shares global call/time ceilings and retains provider and cancellation failures', async () => { + for (const mode of ['call', 'time', 'provider', 'cancelled']) { + const f = fixture('prose'); let time = 0; + const classified = new ApplicationError(mode === 'cancelled' ? 'workflow.cancelled' : 'provider.unavailable', 'Original classification.'); + const query = jest.fn(async (request: FindingsQueryRequest) => { + if (mode === 'call' && query.mock.calls.length < 120) return {}; + if ((mode === 'provider' || mode === 'cancelled') && query.mock.calls.length === 2) throw classified; + const result = f.interpret(request, f.output(true)); + if (mode === 'time') time = PROGRESS_BATCH_PROFILE.milliseconds + 1; + return result; + }); + const bounded = boundProgressBatchAgent({ query }, () => time); + if (mode === 'call') for (let index = 0; index < 119; index++) await bounded.agent.query(f.request); + const error = await queryProgressAssessment(bounded.agent, f.request, f.context, f.project).catch(error => error); + if (mode === 'call' || mode === 'time') expect(error).toMatchObject({ recovery: { variables: { reason: mode + '-budget' } } }); + else expect(error).toBe(classified); + expect(query).toHaveBeenCalledTimes(mode === 'call' ? 120 : mode === 'time' ? 1 : 2); + } +}); diff --git a/src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts b/src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts index a6df4937f..a0d7d03d1 100644 --- a/src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts +++ b/src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts @@ -20,7 +20,7 @@ const captured = readFixture('domus-29-native-937.json.gz.hex'); const fixture = captured.data; afterEach(() => jest.restoreAllMocks()); -async function scenario(moveHead = false) { +async function scenario(moveHead = false, repetition?: 'correct' | 'exhaust' | 'stale') { const native = (path: string) => { expect(Object.prototype.hasOwnProperty.call(fixture.nativeObjects, path)).toBe(true); return { data: fixture.nativeObjects[path] }; @@ -38,6 +38,7 @@ async function scenario(moveHead = false) { expect(diff.protocol!.requiredPaths).toHaveLength(175); expect(diff.partitions).toHaveLength(17); const setProgressLabel = jest.fn(), setLabels = jest.fn(), assessed: string[] = []; let currentHead = fixture.head; + const attempts = new Map(); const execute = jest.fn(async request => { expect(setProgressLabel).not.toHaveBeenCalled(); expect(setLabels).not.toHaveBeenCalled(); const schema = request.outputSchema, p = schema.properties; @@ -59,9 +60,14 @@ async function scenario(moveHead = false) { expect(projected).not.toHaveProperty('summary'); expect(projected).not.toHaveProperty('remaining'); assessed.push(...fields.id.enum); if (moveHead && fields.id.enum.length === 9) currentHead = 'c'.repeat(40); + const batchId = p.batchId.enum[0], attempt = (attempts.get(batchId) ?? 0) + 1; + attempts.set(batchId, attempt); + const repeated = repetition === 'exhaust' ? fields.id.enum.length === 9 : Boolean(repetition) && assessed.length === 32; + if (repetition === 'stale' && attempt === 2) currentHead = 'c'.repeat(40); return JSON.stringify(assessmentWireFixture({ outputLocale: 'en-US', progress: 25, manifestDigest: p.manifestDigest.enum[0], batchId: p.batchId.enum[0], headSha: p.headSha.enum[0], - requirements: fields.id.enum.map((id: string) => ({ id, status: 'verification-unknown', evidence: 'external-unverified', - summary: 'Source reviewed.', remaining: 'Verification needed.', citations: [fields.citations.items.enum[0]] })) }, schema)); + requirements: fields.id.enum.map((id: string, index: number) => ({ id, status: 'verification-unknown', evidence: 'external-unverified', + summary: 'Source reviewed.', remaining: 'Verification needed.', citations: repeated && index === 0 + ? [fields.citations.items.enum[0], fields.citations.items.enum[0]] : [fields.citations.items.enum[0]] })) }, schema)); }); const agent = new FindingsAgentAdapter({ cli: { execute } }); const check = new CheckProgressUseCase({ getDescription: async () => original.body }, { getLabels: async () => [], setLabels }, { setProgressLabel }, @@ -70,7 +76,7 @@ async function scenario(moveHead = false) { { getSource: async () => ({ kind: 'pull-request', number: 29, headSha: currentHead, baseBranch: 'develop' }) }); const results = await check.invoke({ repositoryIdentity: fixture.repository, issueNumber: 23, pushedBranch: fixture.branch, developmentBranch: 'develop', branchTypes: ['feature'], agentConfiguration: { provider: 'codex', modelProvider: 'openai', model: 'deterministic-fixture' }, includeReasoning: false, targetLocale: 'en-US' }); - return { results, setProgressLabel, setLabels, assessed, execute }; + return { results, setProgressLabel, setLabels, assessed, execute, attempts }; } it('github-communication-experience-change-C188: current Domus immutable inventory reaches one complete eligible publication with native generation bounds', async () => { @@ -96,3 +102,36 @@ it('github-communication-experience-change-C189: native generation success for a expect(f.results.at(-1)).toMatchObject({ success: false, errors: [expect.objectContaining({ code: 'workflow.stale' })] }); expect(f.setProgressLabel).not.toHaveBeenCalled(); expect(f.setLabels).not.toHaveBeenCalled(); }); + +it('inventory1-C11: native citation correction preserves all 169 original Domus requirements and 17 source parts before one publication', async () => { + const f = await scenario(false, 'correct'); + expect(createHash('sha256').update(original.body).digest('hex')).toBe(fixture.bodyDigest); + expect(f.results.at(-1)).toMatchObject({ success: true, payload: { progress: 25, sourceHeadSha: fixture.head } }); + expect(f.execute).toHaveBeenCalledTimes(34); + expect(f.execute.mock.calls.filter(([request]) => request.outputSchema.properties.files)).toHaveLength(17); + expect(f.attempts.size).toBe(6); expect([...f.attempts.values()]).toEqual([2, 1, 1, 1, 1, 1]); + expect(f.assessed).toHaveLength(201); expect(new Set(f.assessed).size).toBe(169); + const payload = f.results.at(-1)!.payload as { summary: string; remaining: string }; + for (const id of new Set(f.assessed)) { + expect(payload.summary.split(`[${id}]`)).toHaveLength(2); expect(payload.remaining.split(`[${id}]`)).toHaveLength(2); + } + expect(f.setProgressLabel).toHaveBeenCalledTimes(1); expect(f.setLabels).toHaveBeenCalledTimes(1); +}); + +it('inventory1-C12: native late-batch citation exhaustion retains every provisional batch and publishes nothing', async () => { + const f = await scenario(false, 'exhaust'); + expect(f.execute).toHaveBeenCalledTimes(34); expect(new Set(f.assessed).size).toBe(169); + expect([...f.attempts.values()]).toEqual([1, 1, 1, 1, 1, 2]); + expect(f.results.at(-1)).toMatchObject({ success: false, errors: [expect.objectContaining({ + code: 'validation.evidence-unavailable', retryable: false, + recovery: { id: 'progress-batch-retained', variables: expect.objectContaining({ reason: 'evidence-duplicate', batch: 6, verified: 5, expected: 6 }) }, + })] }); + expect(f.setProgressLabel).not.toHaveBeenCalled(); expect(f.setLabels).not.toHaveBeenCalled(); +}); + +it('inventory1-C13: successful native citation correction cannot bypass source drift at publication', async () => { + const f = await scenario(false, 'stale'); + expect(f.execute).toHaveBeenCalledTimes(34); expect(new Set(f.assessed).size).toBe(169); + expect(f.results.at(-1)).toMatchObject({ success: false, errors: [expect.objectContaining({ code: 'workflow.stale' })] }); + expect(f.setProgressLabel).not.toHaveBeenCalled(); expect(f.setLabels).not.toHaveBeenCalled(); +}); diff --git a/src/application/usecases/actions/progress_batch_workflow.ts b/src/application/usecases/actions/progress_batch_workflow.ts index cbb38e948..50eeca63e 100644 --- a/src/application/usecases/actions/progress_batch_workflow.ts +++ b/src/application/usecases/actions/progress_batch_workflow.ts @@ -78,7 +78,7 @@ export async function analyzeProgressBatches(context: ProgressContext, issueDesc const promptFor = (batch: typeof batches[number], diffEvidence: string, schema: ReturnType) => getCheckProgressPrompt({ ...parameters, acceptanceScope: scopeData(batch.scope), diffEvidence }) + '\n\nSame-head assessment receipt contract\n' + renderProgressPromptData(JSON.stringify({ manifestDigest: manifest.digest, batchId: batch.id, headSha: manifest.headSha, evidenceDictionary: manifest.evidence.filter(reference => !reference.generated).map(reference => reference.id) }), 'progress.comparison', 262_144, 'assessment') - + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight exact evidenceDictionary IDs in citations. ' + + '\nReturn these exact manifestDigest, batchId and headSha fields. Each requirement must cite one to eight DISTINCT exact evidenceDictionary IDs in citations; never repeat an ID within a requirement. ' + 'A citation is its exact unitId in the complete comparison facts, or its exact path when no unitId is supplied. A SHA echo alone is insufficient. ' + 'Every outcome requires a non-generated source observation. Missing or uncertain outcomes require a traceable source observation supporting that outcome. ' + 'Do not infer contents of unprovided unchanged files or external verification. Preserve uncertainty and all qualifiers. Return no partial inventory. ' @@ -109,8 +109,8 @@ export async function analyzeProgressBatches(context: ProgressContext, issueDesc capacity(() => requests.forEach(({ prompt, schema }) => remainingProgressAssessmentPromptBytes(prompt, schema, context.agentConfiguration.effort))); for (const { batch, schema, prompt } of requests) { let acceptedResponse: unknown; - const projectResponse = (response: Parameters[0]) => { - const { payload } = readProgressAssessmentEvidence(response, manifest, batch, context.targetLocale, anchors, compact); + const projectResponse = (response: Parameters[0], requestSchema?: Record) => { + const { payload } = readProgressAssessmentEvidence(response, manifest, batch, context.targetLocale, anchors, compact, requestSchema); acceptedResponse = response; return payload; }; diff --git a/src/application/usecases/actions/query_progress_assessment_workflow.ts b/src/application/usecases/actions/query_progress_assessment_workflow.ts index a3eb3c074..68720c05f 100644 --- a/src/application/usecases/actions/query_progress_assessment_workflow.ts +++ b/src/application/usecases/actions/query_progress_assessment_workflow.ts @@ -13,6 +13,9 @@ import { parseProgressResponse, type ProgressAttemptResult } from './progress_re import { rethrowProgressQueryFailure } from './query_progress_result_workflow'; import { compactProgressAssessmentPlan, compactProgressAssessmentPrompt, decodeCompactProgressAssessment, type CompactProgressAssessmentPlan } from '../../policies/progress_compact_assessment_policy'; +import { bindProgressCitationRepetition, progressCitationRepairPrompt } from '../../policies/progress_citation_recovery_policy'; +import type { ProgressCitationRepetitionDiagnostic } from '../../../domain/progress_citation_repetition'; +import { progressBatchRejected } from '../../policies/progress_batch_rejection_policy'; interface AssessmentContext { readonly scope: ProgressScope; @@ -23,6 +26,7 @@ interface AssessmentContext { } type Outcome = { readonly kind: 'valid'; readonly result: ProgressAttemptResult } | { readonly kind: 'length'; readonly facts: ProgressAssessmentLengthDiagnostic } + | { readonly kind: 'repetition'; readonly facts: ProgressCitationRepetitionDiagnostic } | { readonly kind: 'mismatch'; readonly facts: ProgressCompletionDiagnostic; readonly correlationId: string }; function freezeSnapshot(value: T): T { @@ -35,7 +39,7 @@ function freezeSnapshot(value: T): T { /** Only attributable native length failures enter recovery; completion still has a parse-only catch. */ async function evaluate(agent: FindingsQueryPort, request: FindingsQueryRequest, context: AssessmentContext, - projectResponse: (response: AgentQueryResult) => AgentQueryResult, compact?: CompactProgressAssessmentPlan): Promise { + projectResponse: (response: AgentQueryResult, schema?: Record) => AgentQueryResult, compact?: CompactProgressAssessmentPlan): Promise { let response: AgentQueryResult; try { response = await agent.query(request); } catch (error) { @@ -46,9 +50,11 @@ async function evaluate(agent: FindingsQueryPort, request: FindingsQueryRequest, } try { const canonical = compact ? decodeCompactProgressAssessment(response, compact, context.scope, context.anchors) : response; - return { kind: 'valid', result: parseProgressResponse(projectResponse(canonical), context.targetLocale, context.scope, context.anchors) }; + return { kind: 'valid', result: parseProgressResponse(projectResponse(canonical, request.options?.schema), context.targetLocale, context.scope, context.anchors) }; } catch (error) { + const repetition = bindProgressCitationRepetition(error, request.options?.schema, context.scope, context.anchors, context.sourceLineIds, context.targetLocale); + if (repetition) return { kind: 'repetition', facts: repetition }; if (!(error instanceof ProgressCompletionMismatch)) throw error; const facts = error.factsFor(context.scope); if (!facts || !progressCompletionCountsMatchScope(facts, context.scope.requirements.length, @@ -59,7 +65,7 @@ async function evaluate(agent: FindingsQueryPort, request: FindingsQueryRequest, /** One complete read-only replacement; this owner has no publication capability. */ export async function queryProgressAssessment(agent: FindingsQueryPort, request: FindingsQueryRequest, - context: AssessmentContext, projectResponse: (response: AgentQueryResult) => AgentQueryResult = response => response): Promise { + context: AssessmentContext, projectResponse: (response: AgentQueryResult, schema?: Record) => AgentQueryResult = response => response): Promise { const captured = freezeSnapshot(globalThis.structuredClone({ request, context })); if (!captured.request.options?.schema || captured.request.options.expectJson !== true) { throw new ApplicationError('configuration.unsupported', 'Final progress assessment requires its complete response schema. Existing progress was retained.'); @@ -71,18 +77,23 @@ export async function queryProgressAssessment(agent: FindingsQueryPort, request: ...captured.request, prompt: compactProgressAssessmentPrompt(captured.request.prompt, facts), options: { ...captured.request.options, schema: plan.schema }, }); - const first = await evaluate(agent, initialCompact ? compactRequest(initialCompact) : captured.request, captured.context, projectResponse, initialCompact); + const initialRequest = initialCompact ? compactRequest(initialCompact) : captured.request; + const first = await evaluate(agent, initialRequest, captured.context, projectResponse, initialCompact); if (first.kind === 'valid') return first.result; logInfo(first.kind === 'length' ? 'A progress acceptance fact exceeded its unchanged response limit. Requesting one complete replacement for the same pinned batch; previous progress is retained.' - : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); + : first.kind === 'repetition' + ? 'A completed progress assessment repeated a native source citation. Requesting one complete correction for the same pinned batch; previous progress is retained.' + : 'Reassessing one inconsistent completed progress estimate using the same complete pinned evidence. Previous progress is retained.'); const replacementCompact = initialCompact ?? (first.kind === 'length' ? compact : undefined); - const replacement = replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' + const replacement = first.kind === 'repetition' ? freezeSnapshot({ ...initialRequest, prompt: progressCitationRepairPrompt(initialRequest.prompt, first.facts) }) + : replacementCompact ? compactRequest(replacementCompact, first.facts) : { ...captured.request, prompt: first.kind === 'length' ? progressAssessmentLengthRepairPrompt(captured.request.prompt, first.facts) : progressCompletionRepairPrompt(captured.request.prompt, first.facts) }; const second = await evaluate(agent, replacement, captured.context, projectResponse, replacementCompact); if (second.kind === 'valid') return second.result; if (second.kind === 'length') throw progressAssessmentLengthRejected(second.facts); + if (second.kind === 'repetition') throw progressBatchRejected('evidence-duplicate', { batch: second.facts.batch, requirementId: second.facts.requirementId }); throw new ApplicationError('agent.failed', 'Progress completion remained inconsistent after one complete reassessment. Existing progress was retained.', { correlationId: second.correlationId, recovery: { id: 'progress-completion-recovery-exhausted', variables: second.facts } }); } diff --git a/src/architecture/github_communication_test_budget.json b/src/architecture/github_communication_test_budget.json index b31b8171e..d6273526f 100644 --- a/src/architecture/github_communication_test_budget.json +++ b/src/architecture/github_communication_test_budget.json @@ -7,7 +7,7 @@ "id": "semantic-github-publication", "spec": "specs/semantic-github-publication-and-notification.md", "requiredCases": 135, - "allocatedCases": 1201, + "allocatedCases": 1215, "files": [ { "path": "src/domain/__tests__/github_publication.test.ts", @@ -367,7 +367,7 @@ }, { "path": "src/application/usecases/actions/__tests__/progress_native_generation.integration.test.ts", - "qualifyingCases": 2 + "qualifyingCases": 5 }, { "path": "src/application/policies/__tests__/progress_compact_assessment_policy.test.ts", @@ -400,6 +400,10 @@ { "path": "src/application/usecases/steps/commit/__tests__/detect_potential_problems_use_case.test.ts", "qualifyingCases": 2 + }, + { + "path": "src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts", + "qualifyingCases": 11 } ] }, diff --git a/src/domain/progress_batch_diagnostic.ts b/src/domain/progress_batch_diagnostic.ts index abea76583..af0545f58 100644 --- a/src/domain/progress_batch_diagnostic.ts +++ b/src/domain/progress_batch_diagnostic.ts @@ -1,6 +1,6 @@ export const PROGRESS_BATCH_REASONS = [ 'source-coverage', 'scope-capacity', 'manifest-identity', 'batch-identity', 'receipt-coverage', - 'evidence-identity', 'evidence-missing', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', + 'evidence-identity', 'evidence-missing', 'evidence-duplicate', 'receipt-conflict', 'call-budget', 'time-budget', 'aggregate-capacity', ] as const; export type ProgressBatchReason = typeof PROGRESS_BATCH_REASONS[number]; export type ProgressBatchDiagnostic = Readonly<{ diff --git a/src/domain/progress_citation_repetition.ts b/src/domain/progress_citation_repetition.ts new file mode 100644 index 000000000..51db27e68 --- /dev/null +++ b/src/domain/progress_citation_repetition.ts @@ -0,0 +1,21 @@ +import { isProgressRequirementId, isProgressSourceLineId } from './progress_response_diagnostic'; + +export type ProgressCitationRepetitionDiagnostic = Readonly<{ + requirementId: string; + sourceLineId: string; + batch: number; + citationCount: number; + distinctCount: number; +}>; + +/** Closed host measurements only; neither source references nor rejected prose are retained. */ +export function isProgressCitationRepetitionDiagnostic(value: unknown): value is ProgressCitationRepetitionDiagnostic { + if (!value || typeof value !== 'object' || Array.isArray(value)) return false; + const facts = value as Record; + return Object.keys(facts).sort().join(',') === 'batch,citationCount,distinctCount,requirementId,sourceLineId' + && isProgressRequirementId(facts.requirementId) && isProgressSourceLineId(facts.sourceLineId) + && Number.isSafeInteger(facts.batch) && (facts.batch as number) >= 1 && (facts.batch as number) <= 1024 + && Number.isSafeInteger(facts.citationCount) && (facts.citationCount as number) >= 2 && (facts.citationCount as number) <= 8 + && Number.isSafeInteger(facts.distinctCount) && (facts.distinctCount as number) >= 1 + && (facts.distinctCount as number) < (facts.citationCount as number); +} From 5168c951343dbb57161a3c278eaf0ea00bffd51d Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Sun, 8 Nov 2026 23:00:55 +0100 Subject: [PATCH 3/3] fix: preserve combined progress failure classification --- build/cli/index.js | 3 ++- build/github_action/index.js | 3 ++- specs/final-progress-completion-recovery.md | 5 ++++- src/application/policies/progress_batch_policy.ts | 4 +++- .../actions/__tests__/progress_citation_recovery.test.ts | 5 ++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/build/cli/index.js b/build/cli/index.js index f48be7b4c..657e2913a 100755 --- a/build/cli/index.js +++ b/build/cli/index.js @@ -47057,6 +47057,7 @@ const progress_evidence_path_1 = __nccwpck_require__(25887); const progress_assessment_capacity_policy_1 = __nccwpck_require__(67329); const progress_capacity_failure_1 = __nccwpck_require__(6457); const progress_completion_mismatch_1 = __nccwpck_require__(6519); +const application_error_1 = __nccwpck_require__(75999); const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262144, assessmentClauses: 32, calls: 120, milliseconds: 1800000 }); @@ -47241,7 +47242,7 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho } catch (error) { if (error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch) - return fail('evidence-duplicate', repetition.requirementId); + throw new application_error_1.ApplicationError(error.code, error.message, { correlationId: error.correlationId, retryable: error.retryable, recovery: error.recovery }); throw error; } throw (0, progress_citation_recovery_policy_1.progressCitationRepetitionError)(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, { ...repetition, batch: batch.ordinal, sourceLineId: anchors[repetition.requirementId] ?? 'none' }, requestSchema); diff --git a/build/github_action/index.js b/build/github_action/index.js index 1d59e8aa2..19e0fcda0 100644 --- a/build/github_action/index.js +++ b/build/github_action/index.js @@ -48918,6 +48918,7 @@ const progress_evidence_path_1 = __nccwpck_require__(25887); const progress_assessment_capacity_policy_1 = __nccwpck_require__(67329); const progress_capacity_failure_1 = __nccwpck_require__(6457); const progress_completion_mismatch_1 = __nccwpck_require__(6519); +const application_error_1 = __nccwpck_require__(75999); const progress_citation_recovery_policy_1 = __nccwpck_require__(88351); exports.PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262144, assessmentClauses: 32, calls: 120, milliseconds: 1800000 }); @@ -49102,7 +49103,7 @@ function readProgressAssessmentEvidence(response, manifest, batch, locale, ancho } catch (error) { if (error instanceof progress_completion_mismatch_1.ProgressCompletionMismatch) - return fail('evidence-duplicate', repetition.requirementId); + throw new application_error_1.ApplicationError(error.code, error.message, { correlationId: error.correlationId, retryable: error.retryable, recovery: error.recovery }); throw error; } throw (0, progress_citation_recovery_policy_1.progressCitationRepetitionError)(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, { ...repetition, batch: batch.ordinal, sourceLineId: anchors[repetition.requirementId] ?? 'none' }, requestSchema); diff --git a/specs/final-progress-completion-recovery.md b/specs/final-progress-completion-recovery.md index 5a33eb32b..48c676638 100644 --- a/specs/final-progress-completion-recovery.md +++ b/specs/final-progress-completion-recovery.md @@ -795,6 +795,9 @@ The reader validates exact manifest/head/batch identities, complete requirement coverage, per-fact capacity, all citation memberships and every canonical semantic rule before minting correction authority. A simultaneous completion contradiction is a blocking combined defect, not an alternate recovery route. +It retains its original public completion-mismatch code, recovery facts, +retryability and correlation while losing the private correction capability; +it MUST NOT be presented as citation exhaustion when no correction was attempted. Malformed native JSON/schema, invalid locale and other semantic defects retain their existing failure behavior. @@ -950,7 +953,7 @@ integration file. The older native C188/C189 declarations remain unchanged. | inventory1-C04 | SDD-I944-U1-R1 | Citation/completion and length/citation sequences share one allowance and retain terminal classification. | | inventory1-C05 | SDD-I944-U1-R2 | Missing/foreign/stale/generated/malformed evidence and wrong identities stay blocking. | | inventory1-C06 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Forged, serialized, older-invocation, equal-schema-clone and provider-thrown carriers cannot authorize correction. | -| inventory1-C07 | SDD-I944-U1-R2 | Simultaneous completion, semantic, locale, coverage, schema and length defects remain ineligible. | +| inventory1-C07 | SDD-I944-U1-R2 | Simultaneous completion, semantic, locale, coverage, schema and length defects remain ineligible; a combined completion defect retains its original public classification instead of reporting unattempted citation exhaustion. | | inventory1-C08 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Only full frozen supported current contracts and bounded closed measurements mint origins; changed contracts/context fail. | | inventory1-C09 | SDD-I944-U1-R1 | Caller mutations cannot alter captured replacement context or request. | | inventory1-C10 | SDD-I944-U1-R1, SDD-I944-U1-R2 | Complete preflight before queries; bounded hint; fixed private logging and existing presentation; no submitted padding. | diff --git a/src/application/policies/progress_batch_policy.ts b/src/application/policies/progress_batch_policy.ts index 0b5461a6f..21ca69fc8 100644 --- a/src/application/policies/progress_batch_policy.ts +++ b/src/application/policies/progress_batch_policy.ts @@ -13,6 +13,7 @@ import { isProgressEvidencePath } from '../../domain/progress_evidence_path'; import { MAX_PROGRESS_ASSESSMENT_POINTS, progressAssessmentFactLimit } from './progress_assessment_capacity_policy'; import { ProgressCapacityFailure } from '../errors/progress_capacity_failure'; import { ProgressCompletionMismatch } from '../errors/progress_completion_mismatch'; +import { ApplicationError } from '../errors/application_error'; import { progressCitationRepetitionError } from './progress_citation_recovery_policy'; export const PROGRESS_BATCH_PROFILE = Object.freeze({ sourceLines: 32, clauses: 256, bytes: 262_144, @@ -206,7 +207,8 @@ export function readProgressAssessmentEvidence(response: unknown, manifest: Prog // A simultaneous completion contradiction must not escape as an eligible completion result. try { parseScopedProgressResponse(canonical, locale, scope, anchors); } catch (error) { - if (error instanceof ProgressCompletionMismatch) return fail('evidence-duplicate', repetition.requirementId); + if (error instanceof ProgressCompletionMismatch) throw new ApplicationError(error.code, error.message, + { correlationId: error.correlationId, retryable: error.retryable, recovery: error.recovery }); throw error; } throw progressCitationRepetitionError(progressBatchResponseSchema(manifest, batch, anchors, compact), scope, anchors, locale, diff --git a/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts b/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts index d88e40fd7..5293da338 100644 --- a/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts +++ b/src/application/usecases/actions/__tests__/progress_citation_recovery.test.ts @@ -167,7 +167,10 @@ it('inventory1-C07: simultaneous completion, semantic, locale and coverage defec if (mode === 'length') response.requirements[1].summary = 'x'.repeat(801); return f.interpret(request, response); }); - await expect(queryProgressAssessment({ query }, f.request, f.context, f.project)).rejects.toBeDefined(); + const error = await queryProgressAssessment({ query }, f.request, f.context, f.project).catch(error => error); + expect(error).toBeInstanceOf(Error); + if (mode === 'completion') expect(error).toMatchObject({ code: 'agent.failed', retryable: true, + recovery: { id: 'progress-result-contract-invalid', variables: { reason: 'progress-completion-mismatch', field: '$.progress' } } }); expect(query).toHaveBeenCalledTimes(1); } });