Repository navigation
fix: validator satisfiability + repair correlation contracts - #18
Conversation
📝 WalkthroughWalkthroughThe change adds repair-aware handoff collection. It validates successful handoffs, skips invalid sightings, filters stale pre-repair results, derives repair targets from affected IDs, and preserves executed-node progress in terminal results. ChangesHandoff validation and repair flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant collectTask
participant readThread
participant validateHandoff
participant waitThreads
collectTask->>readThread: read current handoff snapshots
readThread-->>collectTask: return handoff sightings
collectTask->>validateHandoff: validate complete or passed handoff
validateHandoff-->>collectTask: return valid or invalid result
collectTask->>waitThreads: wait when no valid terminal exists
waitThreads-->>collectTask: return later handoff snapshots
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_384de44d-9d2c-48e1-a9c2-81c147a079fe) |
Static review of frozen Lisbon dogfood v5 (structurally unable to pass): - SKILL.md + patterns: dry-run acceptance validators for a reachable pass verdict; never reuse batch-level validators on subset payloads (v5 C5 rewrapped single candidates into the >=5-candidate batch rule). - Repair: targets come from verdict affected_ids mapped to node IDs, never a criterion-prefix pattern; recollect accepts only handoffs emitted after the recorded pre-repair turn cursor (stale handoff is not a correction). - Collection: a structurally invalid handoff sighting is skipped, not terminal; fail-closed reserved for explicit blocked/failed or window exhaustion. - Terminals: blocked/failed must preserve executed_nodes; never reset in a catch path. - validate_skill.py phrase checks mirror every contract; harness gains minTurn + validateHandoff options with three new fixtures (17/17).
validateHandoff rejections must skip only that sighting and keep scanning for a later valid terminal handoff within the same turns tree.
…rohibited cg-lean review of ce61f91 (/tmp/orch/pr18-review.md §5) proved index-based minTurn unsafe under clipped read windows: absolute index vs windowed array manufactures the v5 'never saw the final message' symptom (scenario B), and a relative index reinstates stale acceptance (scenario C). No array index is safe. - harness: collectTask minTurn -> repairMarker (explicit post-repair marker, e.g. corrected_at, demanded by the repair prompt; marker-less complete handoffs recorded as sightings and skipped) + startCursor (cursor provenance seeded into the initial read). Repair mode keeps ALL fallback surfaces (terminal/items/turns/whole snapshot); provenance is a content filter, not a search restriction. - docs (SKILL rule 21, lifecycle, patterns): marker+cursor is the normative correlation form; array-index correlation prohibited; clipped-window sentence references the sibling collection read-bounds contract. - SKILL rule 9 + lifecycle step 9: handoff sighting (skip and continue) vs malformed validator verdict (still fails closed at the gate). - fixtures: scenario B clipped window (marker-carrying handoff found in a 2-turn window); fallback-surface + marker filter; existing repair fixture moved to repairMarker. 20/20. - validate_skill.py: phrases 'post-repair marker' / 'Never correlate by array index' replace the index-era phrases in all three lists; mangle and doc-revert controls verified (12/12 exit 1).
4ad4ec2 to
aed9f69
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d2d66ce5-074e-40a7-bb18-da45b573e058) |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/codex-graph/scripts/task_collection_harness.js`:
- Around line 215-217: Strengthen post-repair validation in the collector around
repairMarker, startCursor, and validateHandoff so the accepted handoff proves it
was emitted after repair, not merely that it contains corrected_at. When
recollection supports cursors, require and validate the recorded repair cursor;
otherwise require an equivalent candidate turn ID or provenance value later than
the repair boundary. Add a regression test covering a stale handoff that already
contains the repair marker and ensure it is rejected.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 86cd281a-86c8-46f1-94a3-5d63bf744ad5
📒 Files selected for processing (7)
CHANGELOG.mdskills/codex-graph/SKILL.mdskills/codex-graph/references/code-mode-script-patterns.mdskills/codex-graph/references/task-lifecycle.mdskills/codex-graph/scripts/task_collection_harness.jsskills/codex-graph/scripts/task_collection_harness.test.jsskills/codex-graph/scripts/validate_skill.py
🚧 Files skipped from review as they are similar to previous changes (4)
- skills/codex-graph/scripts/validate_skill.py
- CHANGELOG.md
- skills/codex-graph/scripts/task_collection_harness.test.js
- skills/codex-graph/references/code-mode-script-patterns.md
| repairMarker, | ||
| startCursor, | ||
| validateHandoff, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Require verifiable post-repair provenance.
repairMarker alone does not prove that a handoff was emitted after repair. A stale handoff can already contain corrected_at, and startCursor is optional. The collector can then accept stale repaired data.
When repair recollection runs, require the recorded repair cursor when the tool supports cursors. Otherwise, require and validate a candidate turn ID or equivalent provenance that is later than the recorded repair boundary. Add a regression test with a stale handoff that already has the repair marker.
Also applies to: 251-265
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/codex-graph/scripts/task_collection_harness.js` around lines 215 -
217, Strengthen post-repair validation in the collector around repairMarker,
startCursor, and validateHandoff so the accepted handoff proves it was emitted
after repair, not merely that it contains corrected_at. When recollection
supports cursors, require and validate the recorded repair cursor; otherwise
require an equivalent candidate turn ID or provenance value later than the
repair boundary. Add a regression test covering a stale handoff that already
contains the repair marker and ensure it is rejected.
PRs #14, #16, #17, #18, and #20 added manual Unreleased bullets; the release workflow prepended [0.4.5] through [0.5.4] for the same changes without folding them in. The changelog is generated from commit subjects at release time, so the manual section is pure duplication. Also document the convention in the README versioning section so it stops recurring.
Summary
Static review of the frozen Lisbon dogfood v5 candidate (
/tmp/orch/lean-v5-review.md, findings 1,2,3,6,7,8; labmac-vm-harness--codexgraph-test/candidates/frozen-lisbon-v5/, workflow sha64c541c4…) found the generated run structurally unable to pass. These are skill-guidance gaps, fixed here as explicit contracts.Defects in the frozen bytes → contracts added
workflow.js:209rewraps each single selected candidate into the batch-levelvalidateHandoffwhose complete-branch requirescandidates.length >= 5(:120) → every run endsfailed(:245); T1 unreachable. → SKILL.md rule 19 + patterns validation gate: dry-run the acceptance validator against a minimal conforming draft; a validator with no reachable pass verdict is a generation defect; never reuse a batch-level validator on subset payloads.:240→collect()initial read (:168) →findHandoffreturns the original handoff instantly; repair is a guaranteed no-op. → lifecycle §3 + patterns repair section + SKILL.md rule 21: record the thread turn count or cursor before sending the repair message; accept only handoffs emitted after that point.:237second disjunct/^C[1-5]:/matches whenever anything failed;verdict.affected_ids(:210) never used. → select repair targets from the verdict'saffected_idsmapped to node IDs; never a criterion-prefix pattern.:178-179throws on the first invalid handoff though the worker could still emit a valid one in-window. → lifecycle §3 step + SKILL.md rule 9: skip invalid sightings; fail-closed reserved for explicitblocked/failedstatus or window exhaustion.:255reportsexecuted_nodes: []. → lifecycle §7 + SKILL.md rule 15: blocked/failed terminals preserveexecuted_nodes.Changes
skills/codex-graph/SKILL.md: rules 9/15/19/21 extended; 4 quality-check bullets.references/task-lifecycle.md: §3 invalid-sighting step + post-repair-cursor paragraph; §7 executed_nodes rule; §8 three new lifecycle cases. (§2 pending/matcher content untouched — owned byfeat/matcher-keys-preflight.)references/code-mode-script-patterns.md: satisfiability + subset-payload paragraph in the validation gate; repair-targeting + post-repair-cursor paragraph in the repair section, each with the observed v5 evidence line.scripts/validate_skill.py: phrase checks mirror every contract (SKILL/lifecycle/patterns lists).scripts/task_collection_harness.js:collectTaskgainsminTurn(handoffs searched only inturns[i>=minTurn]— post-repair provenance) andvalidateHandoff(invalid complete/passed sightings recorded in newinvalidSightingsand skipped; explicit blocked/failed always accepted).scripts/task_collection_harness.test.js: 3 new fixtures — stale-pre-repair rejected / post-repair accepted; invalid-sighting-then-valid success; explicit failed accepted despite validator errors.Test plan
sh scripts/run_regressions.shgreen (validate_skill PASS, node --test 17/17, graph_coherence all ok, python harness 4/4)Note
Low Risk
Changes are confined to codex-graph skill docs, static validation phrases, and the task collection harness with new tests; no production runtime or auth paths are touched.
Overview
Addresses Lisbon dogfood v5 failures where generated workflows could not pass validation or repair even with good worker output. The PR turns those gaps into explicit codex-graph contracts and backs them with harness behavior and static checks.
Skill and reference docs extend rules for acceptance validators (dry-run a minimal conforming draft; no unreachable pass path; do not reuse batch validators on subset payloads), repair targeting (
affected_ids→ node IDs, not criterion-prefix patterns), post-repair recollection (required marker such ascorrected_at, cursor provenance, no turn-index correlation), handoff collection (skip structurally invalid sightings; fail closed only on explicitblocked/failedor budget exhaustion), and terminals (blocked/failed must keepexecuted_nodes).validate_skill.pygains phrase checks so the bundle cannot drift.task_collection_harness.jsrefactors handoff discovery to depth-first iteration, adds optionalrepairMarker,startCursor, andvalidateHandoff, recordsinvalidSightings, and applies marker/cursor filtering so stale pre-repair completes are ignored while explicitfailedstill wins. Tests cover repair recollect, clipped windows, cross-surface marker filtering, invalid-then-valid sightings, and failed-worker acceptance despite validator errors.Reviewed by Cursor Bugbot for commit aed9f69. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Documentation
Tests