Files
reverse-engineering-anything/docs/reference
RRFZandVincent Koc 9cb0aa328b feat(cli): retain over-budget partial observations from failed CLI runs (#14693)
* feat(cli): retain over-budget partial observations from failed CLI runs

When a failed CLI command carries an over-budget partial observation without
--evidence_output, retain the complete partial Evidence in the private
retained-Evidence cache instead of dropping it to a rerun-only fallback.

- Pass the composed source closure into budgetFailurePartialEvidence so cited
  source records are written into the retained bundle alongside the partial
  observation.
- Report the retained path, byte size, and record_sha256 under
  details.diagnostics.evidence_bundle, set details.partial_observation_delivery
  to retained: "cache-file" with a paging cursor, and keep all failure facts
  (code, message, failure_kind, retryable, remediation, limits, existing
  diagnostics) unchanged.
- Honor --no-retain and REA_CLI_RETAINED_EVIDENCE_BYTES=0, fall back to
  retained: "not-retained" with rerun arguments and redacted retention_failure
  on uncommitted write errors, preserve the original failure and committed
  cache receipt on post-commit staging cleanup failures, and keep cancelled
  failures on the no-publication contract.
- Document the behavior in docs/reference/limits-and-recovery.md and add
  boundary and CLI acceptance tests.

Fixes #14618

* fix(cli): preserve pre-commit cleanup ownership and surviving oversized cache receipts

Address two gaps in the shared retainOverBudgetEvidence path that affected
both successful (deliverRetainedSummary) and failed (budgetFailurePartialEvidence)
CLI retention:

- Preserve pre-commit writer errors whose staging cleanup stayed incomplete
  (including exists failures with unfinished cleanup), reporting cleanup_incomplete
  and remaining resources via projectFailure on successes and via
  refusedPartialPublication (keeping execution_failure and complete inline
  partial_observation) on failures.
- When removing an oversized retained cache bundle fails (fileRemains), carry
  the surviving file metadata through RetentionStop.remainingFile, record the
  complete receipt (path, bytes, record_sha256), and report retained: "cache-file"
  with its paging cursor and retention_failure instead of a not-retained fallback.
- Simplify refusedPartialPublication back to a plain delivery value now that
  retainOverBudgetEvidence tracks the attempted cache path directly.
- Add public CLI tests for both paths (success and failure) using
  evidencePublicationPreload.mjs and update docs/reference/limits-and-recovery.md.

* fix(cli): key retained bundles by complete source closure

* chore(format): format retained evidence publication

* fix(cli): canonicalize retained bundle cache keys

* test(cli): compare retained bundle bytes directly

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:50:09 +08:00
..