Skip to content

refactor(F0): keep claimed-fix history across resumed runs - #224

Merged
datacas merged 3 commits into
mainfrom
issue-179-claimed-fix-history
Oct 13, 2026
Merged

datacas merged 3 commits into
mainfrom
issue-179-claimed-fix-history

Conversation

@datacas

@datacas datacas commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #179

Work item: datacas/code-cycle-toolkit#179 (GitHub Issues). Runtime attempt attempt-a3680e15ce0c4393aed1d208feb0c1ae.

Diagnosis

  • Symptom: a cycle resumed with --from starts the repeated-findings ladder at zero, so a finding that already survived a claimed fix is not contested (seen with REV-001 in Record verified work-item resolution outcomes #120).
  • Reproduction: read from run_cycle.py, where history starts empty and only completed stages of the current run are appended. The existing test test_a_resumed_cycle_starts_with_no_survivals asserted that behaviour. No separate repro command was needed.
  • Cause: the work item's hypothesis matched. The history is process-local, so nothing carries claims or survivals across runs. A second gap: an escalated resolve on a resume had no previous resolve target and stayed at the profile effort instead of max.
  • Invariant: the ladder must count survivals over the change request's whole history, not over one run.
  • Related items: basic search (links, titles, recent PRs refactor(runtime): escalate surviving findings at max effort #220, fix(runtime): recover sandbox-restricted stages automatically #221). refactor(runtime): escalate surviving findings at max effort #220 is the max-effort escalation this change makes follow the seeded history. No duplicate or superseding item.
  • Fix shape: rebuild the history once from the published comments of code_cycle.review.trusted_authors (review_contract.comment_run_history, sharing _place_record with comment_runs) and seed history before the first resumed stage. No new telemetry storage, stop reason, or schema change. Classification: isolated_defect; decision: implement.

Behaviour

  • A resume rebuilds the claim and survival history before any dispatch.
  • Empty trusted_authors: stop with HUMAN_INTERVENTION.
  • Failed comment fetch, comment without author metadata, or a trusted contract comment that cannot be parsed or placed: stop with BLOCKED. The reason names the comment id and the failure. The stop reason stays stage_not_completed.
  • Zero contract comments, ordinary comments, and other authors' comments are an empty history; the resume continues.
  • cycle.py: an escalated resolve without a previous resolve target (only possible after a resume) now runs at max on the routed primary.
  • Docs, both orchestrator skills, and the check_repeated_findings_ladder validator phrases no longer say a resume starts at zero.

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Seed the ladder from published comments on a resume, with explicit unreadable-history stops and max escalation after a resume scripts/review_contract.py, scripts/run_cycle.py, scripts/cycle.py, scripts/validate-package.py, docs/review-cycle.md, docs/instrumentation.md, both orchestrator SKILL.md, CHANGELOG.md tests/test_run_cycle.py (ResumedHistoryTests), tests/test_review_contract.py (CommentRunHistoryTests), tests/test_issue_review.py harness see Verification independent: reverting the single commit restores the zero-start resume

Verification (agent-reported)

  • python3 scripts/validate-package.py: exit 0 (VALID: 15 skills ...).
  • python3 -m unittest discover -s tests: exit 0, 1241 tests, OK.
  • Boundary: ran read_change_request_comments and comment_run_history against 12 real PRs of this repository through gh; all read without error (for example fix(runtime): probe Codex linked-worktree metadata access #206: 10 comments, 7 runs).
  • Tests cover a resume after a claim, after a survival, with no history, a second survival across runs, and each unreadable case (empty authors, fetch failure, missing author, malformed trusted comment, unplaceable trusted comment), plus the empty-history cases.
  • Environment: the tests use no global Git identity or network; the comment reader is injected and the gh call is mocked. The local run shares no assumptions with CI beyond Python 3.

A --from resume now rebuilds the claim and survival history from the change request's trusted review comments before its first stage, so a finding that already survived a claimed fix stays contested, a second survival across runs stops the cycle, and the max-effort escalation follows the seeded history. An unreadable history stops before any dispatch (BLOCKED, or HUMAN_INTERVENTION when trusted_authors is empty) and is never read as empty.
@datacas

datacas commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261013-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Initial review: PR #224 (closes #179)

Verdict: APPROVED. Head 58ed54f94deb4791ee3093947626ac1ec9cb8255 was reviewed in full against merge base 11ded315a90489484c3ea71704295770dbe102a7 (727-line accumulated diff, SHA-256 ecbc20f8…3d05 confirmed). One non-blocking finding is open.

Scope

review_contract.comment_run_history (shares _place_record with comment_runs), run_cycle.read_change_request_comments and seed_history, the cycle.py max-effort escalation on a resume, the validator phrases, both orchestrator skills, docs, CHANGELOG and tests. Conventions applied: AGENTS.md (tool routing) and .code-cycle.yml. The change matches the PR's Diagnosis and Behaviour sections and the #179 invariant (the ladder counts survivals over the whole change request).

Findings

[REV-001] · medium · open · - · blocks:no — A trusted comment with finding headers but no run line makes every --from resume BLOCKED, with no way past it

Path: scripts/review_contract.py (comment_run_history, around line 168); scripts/run_cycle.py (seed_history).

Any trusted-author comment that has a #### [REV-xxx] header but no CCR-/CCT- run line and no earlier run to continue makes _place_record return False, so the whole resume stops. Existing history contains such comments. I ran read_change_request_comments and comment_run_history for the 80 most recent PRs of this repository with trusted_authors=("datacas",). 17 of them raise "cannot be placed": #23–#25, #32–#34, #38, #41, #43, #44, #46, #48, #54, #55, #57, #58 and #100. #100 (merged 2026-09-25) is recent: comment 5834652699 holds one REV-001 header and nothing else. Older ones use the four-token header and no run line.

The "unreadable history is never empty" rule is the PR's intent. But _place_record returning False is also what an ordinary resolver reply or a pre-run-line comment looks like, and the only recourse is deleting or editing the comment. The skill's own migration rule says an older change request should never be blocked for header-format reasons. Consider treating a trusted comment with no run line and nothing to continue as legacy (record it, skip it), keeping BLOCKED for malformed headers and for run lines that cannot be classified. It is not blocking because the PR specifies this behaviour and a resume of such a change request is unusual, but a person should decide.

Security triage

.code-cycle.yml declares no security_review.always_when rule, so the default applies. The rule matched none of the changed paths, files or labels (no labels). On my own reading the change touches a trust boundary (which comment authors count as review state) and runs gh, so I audited it inline; the dedicated cc-security-review pass was not delegated, so this pass ran degraded. Result: no vulnerability found.

  • Untrusted authors' bodies are skipped before parse_comment, so they cannot inject history (tested with a ci-bot that quotes the contract).
  • Author comparison is case-insensitive and fails closed on missing or blank author metadata.
  • gh runs with an argument list (no shell); repository and change-request id are path segments, and the CLI validates the change request before the run.
  • An empty trusted_authors stops with HUMAN_INTERVENTION, so the absent allow-list is never read as "trust nobody, empty history".

Verification executed

Unverified

  • A real --from resolve or --from rereview run against a live change request was not executed; the driver path is covered by ResumedHistoryTests with an injected comment reader.
  • The max effort on the routed primary was checked through the router decision and recorded dispatch row (test_the_max_effort_escalation_follows_the_seeded_history), not through a real executor.

CI

gh pr checks 224: PowerShell installer pass, Skills, manifests, and Bash installer pass. No pending, failed or skipped checks. The PR is not a draft.

Residual risks

  • REV-001 above.
  • gh api --slurp needs a recent gh; an older one fails the fetch and the resume stops BLOCKED (safe, but the reason would read "gh exited N").
  • The no-progress guard still starts empty after a resume, as documented.

…ry (#179)

Refs REV-001 on PR #224.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@datacas

datacas commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

[CCT-20261013-001] · cheap_coder · anthropic/claude-sonnet-5-5→? · high · triaged:58ed54f94deb4791ee3093947626ac1ec9cb8255 · schema:2

[CCR-20261013-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Resolution: PR #224 (closes #179)

Status: RESOLVED. Triage was judged against 58ed54f94deb4791ee3093947626ac1ec9cb8255; the fix is c4d2ae023538fb06484730b4229cca9f8b15c7b5.

[REV-001] · medium · resolved · valid · blocks:no — A trusted comment with finding headers but no run line makes every --from resume BLOCKED, with no way past it

Paths: scripts/review_contract.py (comment_run_history), tests/test_review_contract.py, tests/test_run_cycle.py, CHANGELOG.md, docs/review-cycle.md.

Valid: the skill's migration rule says an older change request is never blocked for header format, and a comment with no run line names no run, so it cannot move a claim (comment_runs already ignored it). comment_run_history now skips a trusted comment whose parsed record has no run line. It still raises for a malformed trusted comment, missing author metadata, an empty trusted_authors, and run lines that cannot be placed (new review and triage lines in one comment).

Verification (agent-reported)

Post-change review

Inline review of the accumulated delta (one continue in a loop that already skipped untrusted and header-less comments). No new finding. Untrusted authors are still skipped before parsing, so the relaxed case applies only to trusted authors. The dedicated cc-code-review and cc-security-review passes were not delegated, so this pass ran degraded.

CI

Head c4d2ae023538fb06484730b4229cca9f8b15c7b5: Skills, manifests, and Bash installer pass, PowerShell installer pass. None pending, failed or skipped.

Residual risks

  • A run-less trusted comment is skipped silently; a resolver's reply that changed a status without republishing a run line is not folded (the same as comment_runs).

@datacas

datacas commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261013-002] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

[CCT-20261013-001] · cheap_coder · anthropic/claude-sonnet-5-5→? · high · triaged:58ed54f94deb4791ee3093947626ac1ec9cb8255 · schema:2

[CCR-20261013-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Rereview: PR #224 (closes #179)

Verdict: APPROVED. Head c4d2ae023538fb06484730b4229cca9f8b15c7b5 was reviewed in full against merge base 11ded315a90489484c3ea71704295770dbe102a7 (749-line accumulated diff, SHA-256 cdaed2e5…d966c confirmed). Recovered attempt attempt-04ef38640e3f451c8392ffa59ded69ad was verified. No open finding blocks approval.

Changed since the previous review (58ed54f → c4d2ae0)

review_contract.comment_run_history now skips a trusted comment whose parsed record has no run line; the two tests that used a run-less comment as the unplaceable case now use a comment with both run kinds; new test_a_legacy_comment_without_a_run_line_is_skipped; CHANGELOG and docs/review-cycle.md updated. Malformed trusted comments, missing author metadata, empty trusted_authors and unplaceable run lines still raise. Untrusted authors are still skipped before parsing.

Previous findings

[REV-001] · medium · resolved · valid · blocks:no — A trusted comment with finding headers but no run line makes every --from resume BLOCKED, with no way past it

Path: scripts/review_contract.py (comment_run_history).
Corrected and verified by execution. I reran the original reproduction (read_change_request_comments + comment_run_history, trusted_authors=("datacas",)) against all 17 PRs the review named as failing (#23–#25, #32–#34, #38, #41, #43, #44, #46, #48, #54, #55, #57, #58, #100): all now return without error (0 exceptions across 22 PRs probed). The seeded ladder is unchanged where it matters: REV-001: 2 on #74, #107 and #171, REV-002: 2 on #152. The disposition valid is preserved as recorded.

New findings

None.

Security triage

.code-cycle.yml declares no security_review.always_when rule; the default matched no changed path or label. The delta is a single continue in a loop that already runs only for trusted authors, after the untrusted-author and missing-author checks, so the trust boundary is unchanged. Not a sensitive change: the security audit was skipped after triage.

Verification executed

  • python3 -m unittest discover -s tests: exit 0, 1242 tests OK.
  • python3 scripts/validate-package.py: exit 0, VALID: 15 skills (7 cycle, 8 supporting), shared sections in sync, cross-agent manifests aligned.
  • Real-PR probe above (read-only gh api).

Unverified

  • A live --from resolve / --from rereview run against a real change request was not executed; the driver path is covered by ResumedHistoryTests with an injected reader.
  • The dedicated cc-pr-review / cc-verify passes were not delegated; the equivalent checks ran inline, so this pass ran degraded.

CI

gh pr checks 224: Skills, manifests, and Bash installer pass, PowerShell installer pass. None pending, failed or skipped. The PR is not a draft.

Residual risks

  • A run-less trusted comment is skipped silently, so a resolver reply that changed a status without republishing a run line is not folded (same as comment_runs).
  • gh api --slurp needs a recent gh; an older one stops the resume BLOCKED (safe).
ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{
"skill": "cc-rereview",
"status": "APPROVED",
"issue_provider": "github",
"issue_id": "179",
"code_host": "github",
"change_request_id": "224",
"change_request_url": "#224",
"pr_number": 224,
"issue_number": 179,
"comment_url": null,
"previous_reviewed_head_sha": "58ed54f94deb4791ee3093947626ac1ec9cb8255",
"reviewed_head_sha": "c4d2ae023538fb06484730b4229cca9f8b15c7b5",
"head_sha": "c4d2ae023538fb06484730b4229cca9f8b15c7b5",
"review_run_id": "CCR-20261013-002",
"reviewer": {"profile": "reviewer", "provider": "anthropic", "model_requested": "claude-sonnet-5-5", "model_resolved": null, "effort": "high"},
"verified_findings": [
{"id": "REV-001", "severity": "medium", "blocks_approval": false, "status": "resolved", "disposition": "valid"}
],
"new_findings": [],
"blocking_findings": [],
"blocking": false
}
END_ORCHESTRATION_RESULT

…-history

# Conflicts:
#	scripts/run_cycle.py
@datacas

datacas commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261013-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

[CCR-20261013-002] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

[CCT-20261013-001] · cheap_coder · anthropic/claude-sonnet-5-5→? · high · triaged:58ed54f94deb4791ee3093947626ac1ec9cb8255 · schema:2

[CCR-20261013-003] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Rereview: PR #224 (closes #179)

Verdict: APPROVED. Head a9e870fbe48653ec5d34b294434430cd6acaf936 was reviewed in full against merge base d76b2ef35dbcf698b71a74d92b37f96cd065b99b (749-line accumulated diff, SHA-256 e0c11fa9…c3f0a confirmed, read in sections). No open finding blocks approval. Conventions applied: AGENTS.md (tool routing) and .code-cycle.yml.

Changed since the previous review (c4d2ae0 → a9e870f)

Only a merge of origin/main (d76b2ef, #222: exact test commands in Claude writers). The PR's own diff is unchanged in size (749 lines). The merge touches run_cycle.py in places disjoint from this change: run_cycle() now takes both comment_reader and allowed_test_command, and seed_history() runs before the first resumed stage while allowed_test_command only feeds compose and the writer stage kwargs. No semantic interaction found.

Previous findings

[REV-001] · medium · resolved · valid · blocks:no — A trusted comment with finding headers but no run line makes every --from resume BLOCKED, with no way past it

Path: scripts/review_contract.py (comment_run_history).
Still corrected on the merged head: a trusted run-less comment is skipped (test_a_legacy_comment_without_a_run_line_is_skipped passes in the full suite); malformed trusted comments, missing author metadata, empty trusted_authors and unplaceable run lines still raise. The disposition valid is preserved as recorded.

New findings

None.

Security triage

.code-cycle.yml declares no security_review.always_when rule; the default matched no changed path or label. The delta is a merge of unrelated, already reviewed work, and the trust boundary of this change is unchanged (untrusted and missing authors are rejected or skipped before parsing; gh runs with an argument list). Not a sensitive change: the security audit was skipped after triage.

Verification executed

  • python3 scripts/validate-package.py: exit 0, VALID: 15 skills (7 cycle, 8 supporting), shared sections in sync, cross-agent manifests aligned.
  • python3 -m unittest discover -s tests: exit 0, 1251 tests OK (includes ResumedHistoryTests, CommentRunHistoryTests and the feat(runtime): allow exact test commands in Claude writers #222 tests on the merged tree).

Unverified

  • A live --from resolve / --from rereview run against a real change request was not executed; the driver path is covered by ResumedHistoryTests with an injected reader.
  • The dedicated cc-pr-review / cc-verify passes were not delegated; the equivalent checks ran inline, so this pass ran degraded.

CI

gh pr checks 224: both runs of Skills, manifests, and Bash installer pass and both runs of PowerShell installer pass. None pending, failed or skipped. The PR is not a draft.

Residual risks

  • A run-less trusted comment is skipped silently, so a resolver reply that changed a status without republishing a run line is not folded (same as comment_runs).
  • gh api --slurp needs a recent gh; an older one stops the resume BLOCKED (safe).

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.

refactor(F0): keep claimed-fix history across resumed runs

1 participant