Skip to content

feat(reason): deterministic actionability contract repair (#305 slice A) - #317

Merged
hurttlocker merged 1 commit into
mainfrom
feat/305-actionability-contract-repair
Mar 11, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
feat/305-actionability-contract-repair

Conversation

@hurttlocker

@hurttlocker hurttlocker commented Mar 11, 2026 •

Copy link
Copy Markdown
Owner

What this does

Implements a bounded #305 slice A to harden actionability when reason output is thin/unstructured.

When the LLM output fails the existing response-quality contract, we now deterministically repair it into an operator-ready format instead of returning raw low-action text.

Problem / Context

Issue: #305

Recent reason quality runs identified actionability + hard-failure weakness. We already had contract detection (needsContractRepair) but no enforced repair path in runtime output.

How it works

Runtime enforcement (bounded)

  • enforceResponseQualityContract now:
    • keeps compliant outputs unchanged
    • repairs only outputs that fail structural/actionability checks
  • Added deterministic repair builder that emits required sections:
    • ## Summary
    • ## Evidence
    • ## Conflicts & Trade-offs
    • ## Next Actions
  • Repaired Next Actions include explicit labels (Priority/Owner/Timeline/Recommendation/Impact) and operator-safe verification language.
  • Query focus is threaded into repaired output to preserve request context.

Files touched

  • internal/reason/quality_contract.go
  • internal/reason/quality_contract_test.go

Testing done

Exact commands run:

  1. go test ./internal/reason -run 'QualityContract|NeedsContractRepair' -count=1
  2. go test ./internal/reason -count=1
  3. go test ./...

Screenshots / before-after

Terminal/behavioral before-after:

  • Before: thin output (e.g. brief) passed through unchanged.
  • After: thin output is repaired into contract-compliant sections with actionable Next Actions labels.

Breaking changes / risks

Breaking changes: None.

Concise risk note:

  • Primary risk is over-normalization for intentionally short outputs.
  • Mitigation: repair is gated by existing contract checks; compliant outputs are untouched.

Explicit out-of-scope

Merge notes

@hurttlocker
hurttlocker merged commit 91f5d9c into main Mar 11, 2026
4 checks passed
@hurttlocker
hurttlocker deleted the feat/305-actionability-contract-repair branch March 21, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant