Skip to content

fix(devtools): preserve fail-closed testmon provenance - #3900

Merged
Sinity merged 34 commits into
masterfrom
feature/fix/testmon-seed-recovery
Aug 10, 2026
Merged

Sinity merged 34 commits into
masterfrom
feature/fix/testmon-seed-recovery

Conversation

@Sinity

@Sinity Sinity commented Aug 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Harden testmon provenance and merge-train terminal verification at the current head.

Problem

Reusable testmon data could outlive the dependency environment that produced it. Merge-train verification also rejected explicitly authorized narrow terminal runs, latched valid pending ledger writes after interruption, and could snapshot before reconciling a completed merge intent. The previous exact-head terminal receipt exited 124 with release_baseline_allowed: false after the harness stopped the full pytest run for temporary-storage pressure.

Solution

  • Bind protocol-v5 reusable testmon state to the dependency lock, installed distributions, pytest configuration, relevant harness environment, and pytest plugin versions.
  • Reject old or mismatched reusable state rather than granting release authority; unavailable identity fails closed.
  • Recover a validated pending merge ledger write or clear an identical completed journal while holding the ledger lock.
  • Accept narrow-terminal verification only with the matching typed authorization and release permission.
  • Reconcile durable merge intents before every terminal verification snapshot.

Verification

  • devtools test tests/unit/devtools/test_merge_boundary.py tests/unit/devtools/test_testmon_state.py tests/unit/devtools/test_testmon_bootstrap.py tests/unit/devtools/test_verify.py -k 'not test_lab_verify_runs_every_registered_lab_policy_command': 174 passed, 1 deselected in 18.93s.
  • devtools verify --quick: exit 0 at be4b28c9.
  • The excluded lab-policy node fails independently because three registered acceptance-contract commands are not present in verify --lab; this repair does not alter those registrations or the test assertion.
  • No replacement full pytest receipt was recorded: the prior exact-head full run terminated at 450.39s when the supervisor temporary-filesystem budget reached 2012.6 MiB over its 1977 MiB limit. The new quick result is explicitly non-test and is not presented as terminal authority.

External hold

This PR is not merge-ready until a fresh exact-head, successful typed terminal receipt and the required CI checks are available.

Bead disposition matrix

Assigned Bead Disposition Evidence Residual
polylogue-mq4vx satisfied for the merge/train authority slice merge-boundary, merge-gate, bootstrap, and testmon coverage none for this slice
polylogue-817er partial commits through be4b28c9, focused harness coverage, quick gate fresh bounded terminal receipt remains on polylogue-d96ta

@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change introduces typed, checkout-bound testmon state validation, transactional seed bootstrap and recovery, structured verification authorization, and durable merge-intent reconciliation. It also adds detached-worktree terminal verification, expanded tests, and related issue acceptance criteria.

Changes

Testmon state and bootstrap

Layer / File(s) Summary
Typed state validation
devtools/testmon_state.py, tests/unit/devtools/test_testmon_state.py
Adds typed models and validators for testmon stamps, attempts, checkout bindings, SQLite graphs, fingerprints, artifacts, and authorization.
Checkout-bound bootstrap and recovery
devtools/checkout_guard.py, devtools/testmon_bootstrap.py, tests/unit/devtools/test_checkout_guard.py, tests/unit/devtools/test_testmon_bootstrap.py, tests/integration/devtools/test_testmon_seed_recovery.py
Validates checkout-bound seed state, copies databases with SQLite backup, rebinds receipts, supports selection-only attempts, and publishes files atomically with rollback.
Verification execution and authorization
devtools/verify.py, devtools/merge_gate.py, tests/unit/devtools/test_verify.py, tests/unit/devtools/test_merge_gate.py
Adds resumable seed ledgers, graph inspection, committed-tree identity, adaptive worker limits, terminal authorization, structured receipts, and separate release-baseline permission.
Durable merge verification
devtools/merge_boundary.py, tests/unit/devtools/test_merge_boundary.py
Persists merge intents, reconciles interrupted operations, verifies fetched default-branch commits in detached worktrees, and rejects incomplete terminal evidence.
Issue tracking updates
.beads/issues.jsonl
Adds issue records for testmon and authority workflows and expands merge-boundary acceptance criteria.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The description identifies assigned beads, evidence, and an existing successor for the partial bead.
Out of Scope Changes check ✅ Passed The implementation and tests directly support testmon provenance, merge authority, seed concurrency, and recovery objectives.
Title check ✅ Passed The title clearly describes the PR's fail-closed testmon provenance changes, which are a central part of the implementation.
Description check ✅ Passed The description covers the main template sections with specific changes, problems, verification evidence, bead dispositions, and the remaining merge hold.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/testmon-seed-recovery

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 655dc5255b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/verify.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread devtools/testmon_bootstrap.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread devtools/checkout_guard.py Resolved
Comment thread devtools/testmon_bootstrap.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b10e784bf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_gate.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread devtools/testmon_bootstrap.py Resolved
Comment thread devtools/verify.py Resolved
@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

return {key: identity.get(key) for key in ("worktree_fingerprint", "python", "skip_slow", "lab")}

P1 Badge Bind resumed seeds to the committed tree

When an interrupted seed is resumed after switching or rebasing to another clean revision, this contract still matches because it omits git_head and _worktree_fingerprint() hashes only status/diffs relative to the current HEAD, making every clean revision share the same fingerprint. The resume then retains the old revision's expected_nodeids, allowing finalization to issue a reusable or green stamp whose promised corpus omits tests introduced by the new revision; compare a committed-tree identity, while still permitting different commits with identical trees.

AGENTS.md reference: AGENTS.md:L338-L341


polylogue/devtools/verify.py

Lines 2597 to 2602 in 7d1909d

"selection": {
key: selection.get(key)
for key in (
"selected_count",
"deselected_count",
"selected_nodeids_omitted",

P2 Badge Persist inherited selection counts after resume

When a resumed seed executes only the outstanding subset, this persisted selection retains that subset's selected_count, even though expected_nodeids is the inherited full ledger; only the transient attempt_candidate above overrides the count. The resulting complete attempt fails stamp_from_attempt because its count differs from len(expected), so a crash between writing this attempt and seed.json, or a subsequently missing stamp, cannot recover or bootstrap the completed graph and instead forces another full seed.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/verify.py Resolved
Comment thread devtools/verify.py Resolved
@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2eb71bb05d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_boundary.py Resolved
Comment thread devtools/testmon_bootstrap.py Resolved
Comment thread devtools/verify.py Resolved
@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Exact-head hold for a06aa4888 after read-only production-path review:

  1. cmd_merge(..., with_verify=True) still runs the terminal command after the remote squash merge without fetching and checking out the resulting default-branch commit or binding that commit in the ledger. The receipt can therefore attest to the pre-merge branch.
  2. narrow-terminal plus terminal_authorization=narrow-terminal still clears merge-train debt. The terminal ledger for this campaign must require the complete typed release-baseline full suite.
  3. cmd_record_full_verify() still returns the subprocess status when typed authority rejects a zero-exit receipt, so rejected terminal verification exits zero.
  4. ordinary merge-gate recording still fills missing typed scope from command argv. A partial receipt with command text and a permission bit can acquire authority that the emitted receipt did not carry.
  5. bootstrap publishes copied testmondata before graph refresh and receipt/attempt rebind. Every later failure returns false without removing the copied database and any generated receipt state.

The persisted train-status revalidation added in 052fbb7ff is valid and should remain. Resume tree binding, full denominator persistence, carried outcomes, zero-selection refusal, and markerless-attempt selection-only behavior also remain closed. Ref /realm/tmp/work/prompt-pr3900-post-79ab-review.md for the exact continuation contract. No seed or full suite has been run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a06aa4888f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_gate.py Resolved
@Sinity

Sinity commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff8e51f83f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_boundary.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 361e4985d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_gate.py Resolved
Comment thread devtools/merge_boundary.py Resolved
Comment thread devtools/merge_boundary.py Resolved
Comment thread devtools/merge_gate.py Resolved
Comment thread devtools/testmon_bootstrap.py Resolved
Comment thread devtools/merge_boundary.py Resolved
@Sinity
Sinity force-pushed the feature/fix/testmon-seed-recovery branch from 361e498 to 6d85102 Compare August 10, 2026 00:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d85102726

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/merge_boundary.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread devtools/merge_boundary.py Resolved
@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact pushed head 6d851027261a19fc849d6ab68c3ddc19a290aa48 only. Focus on seed-only worker cap, complete denominator/provenance, typed incomplete/resource-timeout outcomes, and promotion anti-vacuity.

@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact pushed head ffa2d1760825e0422c64c044fab15473e6db2663 only. The Beads carrier now includes the fresh-seed successor. Focus on seed-only worker cap, complete denominator/provenance, typed incomplete/resource-timeout outcomes, and promotion anti-vacuity.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

concurrency=runtime_policy.workers if runtime_policy is not None else 1,

P2 Badge Record the capped worker count in workload receipts

When a seed runs on a host where the adaptive policy chooses more than four workers, the command is correctly capped to -n 4, but this records the uncapped runtime_policy.workers value (for example, 12) as the workload envelope's concurrency. The resulting seed resource receipt therefore contradicts the executed command and cannot provide accurate worker/resource provenance; derive concurrency from the final pytest command or apply the seed cap to the recorded policy as well.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@circleci run

@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

Reopening immediately to refresh the stale Circle quick-gate after synchronizing the structured carrier; no source rollback or draft state.

@Sinity Sinity closed this Aug 10, 2026
@Sinity Sinity reopened this Aug 10, 2026
@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@circleci run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 31

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
tests/unit/devtools/test_verify.py (1)

1026-1148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider splitting this five-stage sequential test.

test_seed_completion_requires_full_failure_free_database runs five _finalize_testmon_seed_attempt calls against one shared TESTMON_DATA, mutating the database and events.jsonl between stages. Each stage depends on the mutations of the prior stage.

A regression in the first stage cascades. The failure output points at the first assertion, not at the stage that actually broke. Five distinct behaviors are pinned: green completion, authorized narrow-terminal completion, red reuse, stale-database rejection, and orphan-edge rejection.

The stages share an expensive SQLite fixture, which is the reason for the coupling. A module-scoped fixture that yields a fresh copy per stage would keep the setup cost low and localize failures.

🤖 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 `@tests/unit/devtools/test_verify.py` around lines 1026 - 1148, Split
test_seed_completion_requires_full_failure_free_database into five focused tests
covering green completion, authorized narrow-terminal completion, red reuse,
stale-database rejection, and orphan-edge rejection. Keep each test’s setup and
database/events.jsonl mutations isolated by using a module-scoped fixture that
yields a fresh copy of TESTMON_DATA for each case, while preserving the existing
assertions and _finalize_testmon_seed_attempt calls.
devtools/merge_boundary.py (2)

779-779: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Make --json explicit in the terminal verify command.

Line 700 parses the child's entire stdout with json.loads. The default --verify-command at Line 779 is "devtools verify --all", with no --json flag.

devtools/verify.py decides its output format implicitly: use_json = args.json if args.json is not None else not sys.stdout.isatty(). Because subprocess.run(..., capture_output=True) gives the child a pipe, isatty() is False and JSON is emitted. The contract works today only through that inference.

If the terminal verify is ever launched through a pty-allocating wrapper — a CI runner that allocates a tty, script, or an interactive agent shell — isatty() becomes True. devtools verify then writes the human summary to stderr and nothing to stdout. json.loads("") raises, structured becomes None, verified_head becomes None, and accepted is False.

The failure direction is safe, but the outcome is a false negative: a fully green release-baseline run is recorded as unaccepted, and the operator sees "POST-MERGE BROAD VERIFY DID NOT GRANT typed release-baseline authority" with no indication that the real cause was output formatting.

devtools/merge_gate.py has the same implicit dependency in _release_baseline_permission, _verification_scope, and _terminal_authorization, all of which parse result.stdout.

🔒 Proposed fix
-    merge_p.add_argument("--verify-command", default="devtools verify --all", help="Command for --with-verify")
+    merge_p.add_argument(
+        "--verify-command",
+        default="devtools verify --all --json",
+        help="Command for --with-verify; must emit the structured JSON receipt on stdout",
+    )
     record_p = sub.add_parser(
         "record-full-verify", help="Run and record the merge-train's terminal full-suite verify now"
     )
-    record_p.add_argument("--command", default="devtools verify --all")
+    record_p.add_argument("--command", default="devtools verify --all --json")

Distinguishing an unparseable receipt from a genuinely refused one also makes the diagnostic honest:

     try:
         structured = json.loads(result.stdout)
     except (TypeError, json.JSONDecodeError):
         structured = None
+    if structured is None and result.returncode == 0:
+        print(
+            f"terminal verify exited 0 but emitted no structured receipt on stdout; "
+            f"ensure {command!r} includes --json",
+            file=sys.stderr,
+        )

Also applies to: 696-709

🤖 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 `@devtools/merge_boundary.py` at line 779, Update the default verify command in
merge_p to explicitly include --json, ensuring subprocess output remains
parseable regardless of TTY allocation. Also update the terminal verification
command construction and related parsing flows in _release_baseline_permission,
_verification_scope, and _terminal_authorization to request JSON explicitly, and
distinguish unparseable output from a valid refusal when reporting authorization
results.

569-593: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

A failed gh pr merge orphans the intent permanently and wedges train-status.

cmd_merge records a durable intent at Line 570, then runs gh pr merge. If the merge fails, Line 591 returns merge_result.returncode and never removes the intent. Only _complete_merge_intent, reached at Line 597 after a successful merge, clears it.

_reconcile_merge_intents then raises on that stale intent. Line 353 checks the PR state; an unmerged PR is not MERGED, so Line 354 raises LedgerStateError(f"unresolved durable merge intent for PR #{intent['pr']}"). cmd_train_status catches it at Line 631 and returns 1.

The result: one transient gh pr merge failure — a network blip, a branch-protection rejection, a head-commit race — permanently blocks train-status. The reconciler raises on the first unresolved intent, so it never reaches later intents either. No command in this module clears an intent, so recovery requires hand-editing the ledger JSON.

The intent-before-merge ordering is correct and necessary; it is what makes external-merge recovery work. The gap is the missing rollback on the known-failed path.

🔒 Proposed rollback on a failed merge

Add an intent-abandon helper and call it when gh pr merge fails:

+def _abandon_merge_intent(pr: int, head_sha: str) -> None:
+    """Drop a durable intent whose merge attempt provably did not happen."""
+    with _ledger_lock():
+        ledger = _read_ledger_unlocked()
+        remaining = [
+            intent
+            for intent in ledger["merge_intents"]
+            if not (intent.get("pr") == pr and intent.get("head_sha") == head_sha)
+        ]
+        if len(remaining) != len(ledger["merge_intents"]):
+            ledger["merge_intents"] = remaining
+            _write_ledger_unlocked(ledger)
     if merge_result.returncode != 0:
         print(f"gh pr merge failed: {merge_result.stderr.strip()[:500]}", file=sys.stderr)
+        try:
+            _abandon_merge_intent(pr, head_sha)
+        except LedgerStateError as exc:
+            print(
+                f"WARNING: merge failed and the durable intent for PR #{pr} could not be cleared: {exc}",
+                file=sys.stderr,
+            )
         return merge_result.returncode

Only abandon on a definite non-merge. If the intent cannot be cleared, keep the latch and say so — that preserves the fail-closed guarantee for the ambiguous case.

A regression test belongs alongside test_external_merge_before_completion_is_reconciled_from_durable_intent: fail the merge with merge_exit=3, then assert cmd_train_status(as_json=False) == 0 and that merge_intents is empty.

Also applies to: 344-360

🤖 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 `@devtools/merge_boundary.py` around lines 569 - 593, Update cmd_merge to roll
back the durable intent when gh pr merge returns a definite nonzero failure: add
an intent-abandon helper alongside _record_merge_intent/_complete_merge_intent,
invoke it on the failed merge path, and return the merge exit code only after
attempting cleanup. If abandoning fails, retain the intent and report that
cleanup failed to preserve fail-closed behavior. Add a regression test alongside
test_external_merge_before_completion_is_reconciled_from_durable_intent
asserting a failed merge leaves merge_intents empty and
cmd_train_status(as_json=False) returns 0.
tests/unit/devtools/test_merge_boundary.py (1)

596-601: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use frozen_clock for the timestamp-dependent merge tests.

test_train_status_blocks_when_pr_merged_after_last_full_verify reads merged_at from _append_merge_entry, and test_record_full_verify_clears_pending_prs compares it with the verification_started_at produced in the same test flow. Add @pytest.mark.frozen_clock_modules("devtools.merge_boundary") and request the frozen_clock fixture in these tests so the ordering depends on an explicit fixture value rather than host clock jumps.

🤖 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 `@tests/unit/devtools/test_merge_boundary.py` around lines 596 - 601, Add the
frozen_clock_modules marker for devtools.merge_boundary and include the
frozen_clock fixture in
test_train_status_blocks_when_pr_merged_after_last_full_verify and
test_record_full_verify_clears_pending_prs. Update these timestamp-dependent
tests to use the explicit frozen clock for merge and verification times,
preserving their existing assertions and behavior.

Source: Coding guidelines

🤖 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 @.beads/issues.jsonl:
- Line 3: Add an acceptance criterion to issue polylogue-ox2iz requiring
synthetic fixtures only, prohibiting reads from /realm/data/... and uploads of
real session corpora to cloud lanes. Require the canary receipt to record the
fixture-set identity and provenance while preserving the existing sampled-corpus
requirements.
- Line 89: Add an explicit acceptance criterion requiring disposition of
polylogue/maintenance/raw_authority_reset.py: delete the module if obsolete, or
route it exclusively through the typed maintenance coordinator. Ensure any
retained recovery path uses the same authorization, daemon writer-ownership,
durable-receipt, and restart-recovery validation as the existing maintenance
flow.
- Line 89: Correct the lease metadata for issue polylogue-fbkr so it is
internally consistent: either mark the issue unclaimed by updating status,
assignee, and notes together, or renew lease_expires_at and heartbeat_at while
retaining the assignment and in_progress status. Do not leave stale August 5
lease timestamps with the current in_progress assignment.

In `@devtools/checkout_guard.py`:
- Around line 365-373: Update the invalid_testmon_seed EnvironmentArtifact
detail in seed_marker_is_checkout_bound to describe only stale or malformed
marker data and checkout-binding mismatch; remove the claim that the SQLite
graph is incomplete. Leave the remediation and later _testmon_preflight graph
validation unchanged.
- Around line 287-298: Consolidate the duplicate status handling around
attempt_is_checkout_bound by using one condition that accepts both "complete"
and "reusable" statuses, then perform the existing call once with the same
arguments. Preserve the default reusable_only behavior and leave other statuses
on their existing path.

In `@devtools/merge_boundary.py`:
- Around line 686-695: In the verification execution flow around the
subprocess.run call, stop using verification_started_at/started to calculate
duration_s because it includes fetch and worktree setup; capture a separate
timestamp immediately before subprocess.run and compute duration_s from that
timestamp after the command completes. Keep verification_started_at unchanged
for at and pending-window calculations, and preserve the current unbounded
subprocess execution.
- Around line 221-223: Update the LedgerStateError raised by
_read_ledger_unlocked when _LEDGER_PENDING_PATH exists to include the pending
file path and the concrete recovery action, matching the actionable command
guidance used by cmd_merge. Keep the fail-closed behavior unchanged.
- Around line 83-85: The merge-train ledger paths must be rooted at the
repository rather than the process CWD. Update the `_LEDGER_PATH` initialization
or its accessor to use `devtools.repo_root() /
".cache/verify/merge-gate/merge-train-ledger.json"`, while preserving
`_LEDGER_PENDING_PATH` and `_LEDGER_LOCK_PATH` derivation and keeping any
CWD-dependent tests workable.
- Around line 496-516: Update the add-failure branch in the terminal
verification flow to stop calling _remove_detached_worktree for the unregistered
worktree; use git worktree prune if cleanup is required, then return 1 while
emitting only the accurate materialization failure message.

In `@devtools/merge_gate.py`:
- Around line 521-535: Rename the comprehension variable in the
verification_scope validation within the merge-gating function so it does not
reuse the outer scope symbol holding the PrScopeResult. Use a distinct name such
as item while preserving the existing VerificationScope value set and all
authority checks unchanged.
- Around line 222-256: Consolidate receipt decoding in devtools/merge_gate.py by
adding a shared _structured_receipt parser that performs the JSON and dictionary
validation once, then have _release_baseline_permission, _verification_scope,
and _terminal_authorization read and validate fields from that parsed payload.
Update cmd_record to reuse one parsed receipt, and update merge_boundary.py to
use merge_gate._structured_receipt for git_head instead of parsing stdout
separately. Preserve None for invalid or missing data so authorization remains
fail-closed.

In `@devtools/testmon_bootstrap.py`:
- Line 424: Compute a shared boolean for the attempt-receipt/selection-only
branch in the bootstrap flow, combining decision.main_seed_attempt is not None
with decision.selection_only. Reuse that boolean for both the condition near the
attempt-receipt handling and the seed.json publication condition near
staged_stamp, so both branches stay aligned when main_seed_attempt is absent.
- Line 92: Centralize the testmon protocol version in devtools/testmon_state.py
and import that constant everywhere. Update
devtools/testmon_bootstrap.py#L92-L92 to use it for the dataclass
protocol_version default, tests/unit/devtools/test_testmon_bootstrap.py#L53-L53
to derive PROTOCOL_VERSION from it, and
tests/integration/devtools/test_testmon_seed_recovery.py#L44-L44 to use it for
the attempt protocol_version value.
- Around line 536-539: Update maybe_bootstrap_testmon_seed to accept a
seed-attempt relative-path override alongside testmon_data_relpath and
seed_stamp_relpath, then use that parameter for both local_seed_attempt and
main_seed_attempt instead of hardcoding TESTMON_SEED_ATTEMPT_RELPATH. Preserve
the default production path when no override is provided.
- Around line 567-571: Update the failure message immediately before the
decision.main_seed_attempt block to state that pytest-testmon bootstrap was
refused and left no destination state. Remove the stale wording that claims the
seed was bootstrapped or copied before provenance recording failed; preserve the
surrounding decision and return behavior.

In `@devtools/testmon_state.py`:
- Around line 828-842: Update stamp_from_attempt’s TestmonSeedStamp construction
to pass the existing recorded_data value instead of calling
file_fingerprint(data_path) again. Preserve the recorded fingerprint while
removing the unguarded database read and maintaining the function’s
None-on-failure behavior.
- Around line 532-533: Wrap the sqlite3.connect call in the try block with
contextlib.closing so the connection is explicitly closed after use, while
preserving the existing transaction context-manager behavior. Import closing as
needed and follow the established pattern used by _atomic_copy_sqlite_db.

In `@devtools/verify.py`:
- Around line 2023-2031: Update _git_committed_tree to pass a bounded timeout to
subprocess.run and catch OSError and subprocess.TimeoutExpired, returning None
when git is unavailable or the probe times out. Preserve the existing successful
stdout parsing and nullable behavior.
- Around line 2292-2312: Update _testmon_release_baseline_permission to return
bool rather than bool | None, and revise its docstring to remove the unreachable
None case. Preserve the existing boolean returns for stamp validation, missing
attempts, and derived stamp results.
- Around line 2315-2329: Unify checkout identity with ROOT.resolve() instead of
Path.cwd() in _safe_testmon_artifact_dir() and the related
stamp_from_attempt(..., checkout_root=...) validation paths, including the
existing code at the referenced later location. Continue using Path.cwd() only
when intentionally resolving relative run-artifact paths, and ensure all
artifact containment and receipt checks use the binding’s ROOT checkout.

In `@tests/integration/devtools/test_testmon_seed_recovery.py`:
- Around line 30-40: Update the subprocess setup in the testmon seed-recovery
test to use an isolated environment that removes inherited PYTEST_ADDOPTS while
preserving the required TESTMON_DATAFILE and other necessary variables. Add the
established 10-second timeout to subprocess.run, and improve the return-code
assertion to include the captured child output so hangs, collection failures,
and unexpected failures are reported at this call site.

In `@tests/unit/devtools/test_merge_boundary.py`:
- Around line 788-822: Strengthen
test_concurrent_ledger_writer_cannot_lose_merge_entry by coordinating on
_ledger_lock rather than setting started before _append_merge_entry acquires it:
hold the lock in the main test thread while the mocked subprocess runs, signal
that the writer is attempting the append, assert it remains blocked, then
release the lock before cmd_record_full_verify reaches its own lock acquisition.
Join the writer and retain the existing ledger and status assertions.

In `@tests/unit/devtools/test_merge_gate.py`:
- Around line 111-143: Remove the command parametrization from
test_check_accepts_affected_receipt_without_release_baseline_permission and
test_check_blocks_full_receipt_without_release_baseline_permission, since each
test overwrites the typed receipt fields and produces identical outcomes
regardless of command. Replace the parameterized command argument with a single
representative command while preserving the existing assertions and receipt
setup.
- Around line 146-166: Update _fake_run to return Callable[..., MagicMock],
matching the equivalent helper in test_merge_boundary.py, so callers receive the
correct callable type. Remove the cast around _fake_run in
test_record_consumes_structured_verify_release_permission and delete the
now-unused typing.cast import, keeping Callable imported.

In `@tests/unit/devtools/test_testmon_bootstrap.py`:
- Around line 719-720: Rename the test containing the assertions on
local_data.exists() and local_stamp.exists() to reflect that no copied state is
published when the stamp becomes invalid, following the naming pattern of its
sibling tests.
- Around line 636-637: Update the assertions for
local_payload["binding"]["checkout_root"] and source_checkout_root to compare
against resolved tmp_path-derived paths, matching TestmonSeedStamp.rebound and
the sibling assertions. Preserve the existing suffixes and expected binding
values while applying .resolve() before converting them to strings.

In `@tests/unit/devtools/test_testmon_state.py`:
- Around line 201-208: Update the stale-stamp test around _attempt and
stamp_from_attempt to construct a green stamp with release_baseline_allowed
enabled, following the setup used by
test_attempt_and_green_stamp_artifacts_fail_closed_when_malformed. Assert
validate_stamp succeeds before mutating data, then append the stale bytes and
assert validation returns None, ensuring the fingerprint comparison path is
exercised.

In `@tests/unit/devtools/test_verify.py`:
- Around line 534-537: Update
test_two_interrupted_resumes_flatten_all_carried_outcomes and
test_resumed_seed_does_not_reuse_an_unexecuted_database_row to accept the
monkeypatch fixture, remove their manual pytest.MonkeyPatch construction and
try/finally undo cleanup, and de-indent the affected test bodies while
preserving their behavior.
- Around line 96-135: Update tests/unit/devtools/test_verify.py lines 96-135:
make _write_real_testmon_state accept a root parameter, use it for artifact
paths and _TestmonBinding.checkout_root, and update each caller to pass tmp_path
while patching verify.ROOT. Update lines 2110-2138 in
test_verify_main_types_skip_slow_terminal_authority to call
monkeypatch.chdir(tmp_path) before verification so generated run artifacts
remain temporary; the integration test pattern in
tests/integration/devtools/test_testmon_seed_recovery.py requires no change.
- Around line 438-449: Remove the tautological `"stale" in message` assertion
from test_testmon_preflight_rejects_stale_database_fingerprint and retain only
the non-None rejection assertion plus the empty-stderr check. Apply the same
change to the analogous assertions at the other referenced tests, removing
message-content checks while preserving assertions that preflight rejects and
remains silent.
- Around line 2110-2138: Add the pytest monkeypatch fixture to
test_verify_main_types_skip_slow_terminal_authority and call
monkeypatch.chdir(tmp_path) before invoking main, ensuring VerifyRun writes its
run directory and current-run.json under the temporary path instead of the
repository root. Preserve the existing parameterized assertions and patches.

---

Outside diff comments:
In `@devtools/merge_boundary.py`:
- Line 779: Update the default verify command in merge_p to explicitly include
--json, ensuring subprocess output remains parseable regardless of TTY
allocation. Also update the terminal verification command construction and
related parsing flows in _release_baseline_permission, _verification_scope, and
_terminal_authorization to request JSON explicitly, and distinguish unparseable
output from a valid refusal when reporting authorization results.
- Around line 569-593: Update cmd_merge to roll back the durable intent when gh
pr merge returns a definite nonzero failure: add an intent-abandon helper
alongside _record_merge_intent/_complete_merge_intent, invoke it on the failed
merge path, and return the merge exit code only after attempting cleanup. If
abandoning fails, retain the intent and report that cleanup failed to preserve
fail-closed behavior. Add a regression test alongside
test_external_merge_before_completion_is_reconciled_from_durable_intent
asserting a failed merge leaves merge_intents empty and
cmd_train_status(as_json=False) returns 0.

In `@tests/unit/devtools/test_merge_boundary.py`:
- Around line 596-601: Add the frozen_clock_modules marker for
devtools.merge_boundary and include the frozen_clock fixture in
test_train_status_blocks_when_pr_merged_after_last_full_verify and
test_record_full_verify_clears_pending_prs. Update these timestamp-dependent
tests to use the explicit frozen clock for merge and verification times,
preserving their existing assertions and behavior.

In `@tests/unit/devtools/test_verify.py`:
- Around line 1026-1148: Split
test_seed_completion_requires_full_failure_free_database into five focused tests
covering green completion, authorized narrow-terminal completion, red reuse,
stale-database rejection, and orphan-edge rejection. Keep each test’s setup and
database/events.jsonl mutations isolated by using a module-scoped fixture that
yields a fresh copy of TESTMON_DATA for each case, while preserving the existing
assertions and _finalize_testmon_seed_attempt calls.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 70faf8b9-6e28-4b7b-b1be-32c78e4126de

📥 Commits

Reviewing files that changed from the base of the PR and between eeecfab and 7458c82.

📒 Files selected for processing (14)
  • .beads/issues.jsonl
  • devtools/checkout_guard.py
  • devtools/merge_boundary.py
  • devtools/merge_gate.py
  • devtools/testmon_bootstrap.py
  • devtools/testmon_state.py
  • devtools/verify.py
  • tests/integration/devtools/test_testmon_seed_recovery.py
  • tests/unit/devtools/test_checkout_guard.py
  • tests/unit/devtools/test_merge_boundary.py
  • tests/unit/devtools/test_merge_gate.py
  • tests/unit/devtools/test_testmon_bootstrap.py
  • tests/unit/devtools/test_testmon_state.py
  • tests/unit/devtools/test_verify.py

Comment thread .beads/issues.jsonl
@@ -1,3 +1,7 @@
{"_type":"issue","id":"polylogue-d96ta","title":"testmon: run and publish a bounded fresh seed receipt","description":"Execute a fresh seed-testmon run after the concurrency cap, retain the complete selection denominator and resource receipt, and decide whether the result is a complete red baseline, release-eligible baseline, or typed incomplete/resource-timeout outcome.","acceptance_criteria":"1. The fresh seed runs on a clean selected code tree and records the complete expected node universe, selection digest, harness and dependency identity, and actual worker/resource evidence. 2. The run reaches a typed terminal outcome or records an explicit timeout/incomplete receipt; no partial selection can be promoted. 3. The resulting receipt is independently replayable and accepted only by the typed testmon promotion gate. 4. The exact command, resource envelope, result, and residual failure attribution are published for the release ledger.","status":"open","priority":0,"issue_type":"task","owner":"[email protected]","created_at":"2026-08-10T00:40:19Z","created_by":"Sinity","updated_at":"2026-08-10T00:40:19Z","dependencies":[{"issue_id":"polylogue-d96ta","depends_on_id":"polylogue-817er","type":"discovered-from","created_at":"2026-08-10T00:40:29Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"polylogue-817er","title":"testmon: complete bounded fresh seed and release-baseline admission","description":"Finish the testmon seed-harness residual after bounding seed-only concurrency. Prove a fresh seed can complete within the declared resource envelope, retain a complete denominator and provenance, and distinguish a complete red baseline from release eligibility.","acceptance_criteria":"1. A fresh-worktree seed selects the complete expected node universe with a declared denominator and does not silently shrink selection. 2. Seed-testmon uses the bounded worker policy and records actual process/resource/timeout evidence; ordinary adaptive test lanes remain unchanged. 3. A completed seed receipt is bound to exact code tree, dependency/testmon graph, harness version, selection digest, and outcome; incomplete or stale receipts cannot promote. 4. Red baseline, green release baseline, incomplete run, and resource-timeout outcomes are distinct typed states. 5. Focused harness mutation tests and devtools verify --quick pass; a fresh seed attempt is run before closure and its exact result is recorded.","status":"open","priority":0,"issue_type":"task","owner":"[email protected]","created_at":"2026-08-10T00:39:28Z","created_by":"Sinity","updated_at":"2026-08-10T00:39:28Z","dependencies":[{"issue_id":"polylogue-817er","depends_on_id":"polylogue-mq4vx","type":"discovered-from","created_at":"2026-08-10T00:39:37Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"polylogue-ox2iz","title":"reindex: execute and classify the canary changelog report","description":"Execute the repaired daemon-owned canary differ route against the selected deployed package and inactive generation, classify every observed row difference against the declared schema/parser deltas, and attach the reviewed report to the candidate-build phase.","acceptance_criteria":"1. A fresh canary run uses a frozen source snapshot, selected deployed package SHA, inactive no-promote generation, and exact comparator version. 2. The sampled corpus includes each origin, zoo/pathology fixtures, and a declared denominator; selection cannot be shrunk after observation. 3. Every sessions/messages/blocks/session_links/derived difference is classified as expected with a cited delta or unexpected with a named Bead, with zero unclassified rows. 4. The report includes receipts, digests, command identity, and reviewer disposition and is consumed by candidate-build preflight. 5. A red mutation removing a diff or changing the authority binding fails the report gate; no pointer promotion occurs.","status":"open","priority":0,"issue_type":"task","owner":"[email protected]","created_at":"2026-08-10T00:37:28Z","created_by":"Sinity","updated_at":"2026-08-10T00:37:28Z","dependencies":[{"issue_id":"polylogue-ox2iz","depends_on_id":"polylogue-0x7nh","type":"discovered-from","created_at":"2026-08-10T00:37:38Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Declare that the canary corpus is synthetic-only.

The acceptance criteria require a “sampled corpus” but do not prohibit real session data, /realm/data/... access, or cloud upload. Add an explicit criterion for synthetic fixtures only and record the fixture-set identity in the receipt.

Proposed acceptance criterion
6. The canary uses synthetic fixtures only. It never reads `/realm/data/...` or uploads real user session corpora to a cloud lane. The receipt records fixture-set identity and provenance.

As per coding guidelines, never upload real user session corpora in cloud lanes; use synthetic fixtures only and never access /realm/data/....

🤖 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 @.beads/issues.jsonl at line 3, Add an acceptance criterion to issue
polylogue-ox2iz requiring synthetic fixtures only, prohibiting reads from
/realm/data/... and uploads of real session corpora to cloud lanes. Require the
canary receipt to record the fixture-set identity and provenance while
preserving the existing sampled-corpus requirements.

Source: Coding guidelines

Comment thread .beads/issues.jsonl Resolved
Comment on lines +287 to +298
if payload.get("status") == "complete":
return attempt_is_checkout_bound(
payload,
checkout_root=checkout_root,
protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
)
if payload.get("status") == "reusable":
return attempt_is_checkout_bound(
payload,
checkout_root=checkout_root,
protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Collapse the two identical status branches.

The complete and reusable branches call attempt_is_checkout_bound with identical arguments. attempt_is_checkout_bound already restricts accepted statuses to {"reusable", "complete"} when reusable_only is the default. One branch expresses the same contract.

♻️ Proposed consolidation
-    if payload.get("status") == "complete":
-        return attempt_is_checkout_bound(
-            payload,
-            checkout_root=checkout_root,
-            protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
-        )
-    if payload.get("status") == "reusable":
+    if payload.get("status") in {"complete", "reusable"}:
         return attempt_is_checkout_bound(
             payload,
             checkout_root=checkout_root,
             protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
         )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if payload.get("status") == "complete":
return attempt_is_checkout_bound(
payload,
checkout_root=checkout_root,
protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
)
if payload.get("status") == "reusable":
return attempt_is_checkout_bound(
payload,
checkout_root=checkout_root,
protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
)
if payload.get("status") in {"complete", "reusable"}:
return attempt_is_checkout_bound(
payload,
checkout_root=checkout_root,
protocol_version=_TESTMON_SEED_PROTOCOL_VERSION,
)
🤖 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 `@devtools/checkout_guard.py` around lines 287 - 298, Consolidate the duplicate
status handling around attempt_is_checkout_bound by using one condition that
accepts both "complete" and "reusable" statuses, then perform the existing call
once with the same arguments. Preserve the default reusable_only behavior and
leave other statuses on their existing path.

Comment thread devtools/checkout_guard.py Resolved
Comment on lines 83 to +85
_LEDGER_PATH = Path(".cache/verify/merge-gate/merge-train-ledger.json")
_LEDGER_PENDING_PATH = _LEDGER_PATH.with_name(f"{_LEDGER_PATH.name}.pending")
_LEDGER_LOCK_PATH = _LEDGER_PATH.with_name(f"{_LEDGER_PATH.name}.lock")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check how the merge-boundary ledger path is resolved and how tests depend on CWD.
set -euo pipefail

echo "=== ledger path definitions and uses ==="
rg -n -C3 '_LEDGER_PATH|_LEDGER_PENDING_PATH|_LEDGER_LOCK_PATH' devtools/merge_boundary.py

echo "=== repo_root helper ==="
rg -n -C5 'def repo_root' devtools/__init__.py

echo "=== tests relying on chdir for ledger placement ==="
rg -n -c 'monkeypatch.chdir' tests/unit/devtools/test_merge_boundary.py

echo "=== how merge_boundary is invoked from the command catalog ==="
rg -n -C3 'merge_boundary|workspace merge' devtools/command_catalog.py devtools/cli*.py 2>/dev/null || true

Repository: Sinity/polylogue

Length of output: 7664


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== devtools/__init__.py ==="
cat -n devtools/__init__.py

echo "=== devtools/merge_boundary.py imports and relevant functions ==="
sed -n '1,160p' devtools/merge_boundary.py | cat -n
sed -n '190,240p' devtools/merge_boundary.py | cat -n
sed -n '360,430p' devtools/merge_boundary.py | cat -n
sed -n '620,680p' devtools/merge_boundary.py | cat -n

echo "=== invoke/workspace merge command definitions ==="
rg -n -C4 'devtools\.merge_boundary|merge_boundary|train-status|workspace merge|workspace.*merge' devtools tests/unit/devtools/test_merge_boundary.py | sed -n '1,240p'

echo "=== deterministic cwd probe for Path resolution and _read_ledger_default semantics ==="
python3 - <<'PY'
from pathlib import Path
import textwrap, importlib.util, sys

# Show Path behavior at different cwd values without importing repo code.
ledger = Path(".cache/verify/merge-gate/merge-train-ledger.json")
for base in [Path("/tmp/probe"), Path("/repo/root")]:
    print({str(base / ledger): str(base / ".cache/verify/merge-gate/merge-train-ledger.json")})

# Read ledger function source to confirm default value and tests around it.
spec = importlib.util.spec_from_file_location("merge_boundary", "devtools/merge_boundary.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
print("return_default_on_missing=", module._read_ledger_unlocked.__doc__ or "no-doc")
print("ledger_paths:", module._LEDGER_PATH, module._LEDGER_PENDING_PATH, module._LEDGER_LOCK_PATH)
PY

Repository: Sinity/polylogue

Length of output: 36323


Anchor the merge-train ledger to the repository root.

_LEDGER_PATH is Path(".cache/verify/merge-gate/merge-train-ledger.json"), so cmd_train_status reads the ledger relative to process CWD. Running from a subdirectory hits the missing-path default, _pending_prs_since_last_full_verify(), returns [], and the gate reports train OK even when the repository ledger contains merged PRs after the last full-suite verify. The lock and pending paths derive from this path, so anchor it once, e.g. with devtools.repo_root() / ".cache/..." inside an accessor to keep CWD-dependent tests working.

🤖 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 `@devtools/merge_boundary.py` around lines 83 - 85, The merge-train ledger
paths must be rooted at the repository rather than the process CWD. Update the
`_LEDGER_PATH` initialization or its accessor to use `devtools.repo_root() /
".cache/verify/merge-gate/merge-train-ledger.json"`, while preserving
`_LEDGER_PENDING_PATH` and `_LEDGER_LOCK_PATH` derivation and keeping any
CWD-dependent tests workable.

Comment on lines +96 to +135
def _write_real_testmon_state(nodeids: tuple[str, ...] = ("tests/test_a.py::test_one",)) -> Path:
TESTMON_DATA.parent.mkdir(parents=True, exist_ok=True)
with sqlite3.connect(TESTMON_DATA) as conn:
conn.execute("CREATE TABLE environment (id INTEGER PRIMARY KEY, environment_name TEXT)")
conn.execute("CREATE TABLE file_fp (id INTEGER PRIMARY KEY, filename TEXT, fsha TEXT)")
conn.execute("CREATE TABLE test_execution (id INTEGER PRIMARY KEY, test_name TEXT, failed INTEGER)")
conn.execute("CREATE TABLE test_execution_file_fp (test_execution_id INTEGER, fingerprint_id INTEGER)")
for index, nodeid in enumerate(nodeids, start=1):
conn.execute("INSERT INTO file_fp(id, filename, fsha) VALUES (?, ?, ?)", (index, nodeid, f"sha-{index}"))
conn.execute("INSERT INTO test_execution(id, test_name, failed) VALUES (?, ?, 0)", (index, nodeid))
conn.execute("INSERT INTO test_execution_file_fp VALUES (?, ?)", (index, index))
stamp = _TestmonSeedStamp(
TESTMON_SEED_PROTOCOL_VERSION,
CollectionStatus.COMPLETE,
nodeids,
0,
BaselineStatus.GREEN,
True,
0,
GraphInspection(GraphStatus.COMPLETE, len(nodeids), len(nodeids), (), 0, 0, None, ()),
_TestmonIdentity("current-head", "covered", "python", True, False, None, "narrow-terminal"),
_TestmonBinding(BindingMode.EXACT, str(ROOT.resolve())),
file_fingerprint(TESTMON_DATA),
"seed",
".cache/verify/runs/seed",
)
TESTMON_SEED_STAMP.parent.mkdir(parents=True, exist_ok=True)
artifact_dir = ROOT / ".cache" / "verify" / "runs" / "seed"
artifact_dir.mkdir(parents=True, exist_ok=True)
(artifact_dir / "run.json").write_text(
json.dumps(
{
"run_id": "seed",
"checkout_root": str(ROOT.resolve()),
"artifact_dir": ".cache/verify/runs/seed",
}
)
)
TESTMON_SEED_STAMP.write_text(json.dumps(stamp.as_dict()))
return TESTMON_DATA

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Unit tests write verification state into the real repository checkout. Both sites resolve paths against the real ROOT imported from devtools.verify instead of tmp_path, so artifacts escape the temporary directory, persist after the run, and are shared across parallel xdist workers.

  • tests/unit/devtools/test_verify.py#L96-L135: _write_real_testmon_state builds artifact_dir = ROOT / ".cache" / "verify" / "runs" / "seed" and binds the stamp to str(ROOT.resolve()). The write is load-bearing — TestmonSeedStamp.from_mapping calls _is_bound_run_artifact against binding.checkout_root, so the receipt must exist under ROOT for validate_stamp to accept it. Take the root as a parameter, bind the stamp to it, and have each caller pass tmp_path while patching verify.ROOT.
  • tests/unit/devtools/test_verify.py#L2110-L2138: test_verify_main_types_skip_slow_terminal_authority never calls monkeypatch.chdir, so _anchor_verification_paths() sets the CWD to ROOT and VerifyRun.__init__ creates .cache/verify/runs/<run_id>/run.json plus .cache/verify/current-run.json in the working tree. Add monkeypatch.chdir(tmp_path); _anchor_verification_paths() returns early outside ROOT, so the run stays contained.

tests/integration/devtools/test_testmon_seed_recovery.py already demonstrates the correct pattern with monkeypatch.setattr(verify, "ROOT", lane).

🧰 Tools
🪛 ast-grep (0.45.0)

[info] 125-131: use jsonify instead of json.dumps for JSON output
Context: json.dumps(
{
"run_id": "seed",
"checkout_root": str(ROOT.resolve()),
"artifact_dir": ".cache/verify/runs/seed",
}
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 133-133: use jsonify instead of json.dumps for JSON output
Context: json.dumps(stamp.as_dict())
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

📍 Affects 1 file
  • tests/unit/devtools/test_verify.py#L96-L135 (this comment)
  • tests/unit/devtools/test_verify.py#L2110-L2138
🤖 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 `@tests/unit/devtools/test_verify.py` around lines 96 - 135, Update
tests/unit/devtools/test_verify.py lines 96-135: make _write_real_testmon_state
accept a root parameter, use it for artifact paths and
_TestmonBinding.checkout_root, and update each caller to pass tmp_path while
patching verify.ROOT. Update lines 2110-2138 in
test_verify_main_types_skip_slow_terminal_authority to call
monkeypatch.chdir(tmp_path) before verification so generated run artifacts
remain temporary; the integration test pattern in
tests/integration/devtools/test_testmon_seed_recovery.py requires no change.

Comment on lines +438 to +449
def test_testmon_preflight_rejects_stale_database_fingerprint(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
) -> None:
monkeypatch.chdir(tmp_path)
TESTMON_DATA.parent.mkdir(parents=True)
TESTMON_DATA.write_text("seeded")
seed_stamp = tmp_path / ".cache" / "testmon" / "seed.json"
seed_stamp.parent.mkdir(parents=True, exist_ok=True)
seed_stamp.write_text(
json.dumps(
{
"protocol_version": TESTMON_SEED_PROTOCOL_VERSION,
"status": "complete",
"git_head": "old-head",
"testmon_data": hashlib.sha256(b"seeded").hexdigest(),
}
)
)
monkeypatch.setattr("devtools.verify._git_head", lambda: "current-head")
_write_real_testmon_state()
TESTMON_DATA.write_bytes(TESTMON_DATA.read_bytes() + b"stale")

message = _testmon_preflight(seed_testmon=False, full_pytest=False, quick=False, commit=False)

assert message is None
assert "different git head" in capsys.readouterr().err
assert message is not None
assert "stale" in message
assert capsys.readouterr().err == ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

These assertions are tautological against the single rejection message.

_testmon_preflight returns one fixed string for every rejection: "unreadable, stale, malformed, or not graph-complete". The assertion "stale" in message therefore passes for any cause, including a malformed marker or an incomplete graph. The same applies to "stale" in message or "malformed" in message at Line 472 and Line 495.

The tests still prove that rejection occurred and that stderr stays silent, which is their main value. But test_testmon_preflight_rejects_stale_database_fingerprint cannot fail if the fingerprint check is removed, provided some other check still rejects. Asserting message is not None states the same guarantee honestly.

If distinguishing the causes matters, _testmon_preflight would need to emit a cause-specific message. That is a production change and out of scope here.

🤖 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 `@tests/unit/devtools/test_verify.py` around lines 438 - 449, Remove the
tautological `"stale" in message` assertion from
test_testmon_preflight_rejects_stale_database_fingerprint and retain only the
non-None rejection assertion plus the empty-stderr check. Apply the same change
to the analogous assertions at the other referenced tests, removing
message-content checks while preserving assertions that preflight rejects and
remains silent.

Comment on lines +534 to +537
def test_two_interrupted_resumes_flatten_all_carried_outcomes(tmp_path: Path) -> None:
monkeypatch = pytest.MonkeyPatch()
monkeypatch.chdir(tmp_path)
try:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the monkeypatch fixture instead of constructing pytest.MonkeyPatch() manually.

test_two_interrupted_resumes_flatten_all_carried_outcomes and test_resumed_seed_does_not_reuse_an_unexecuted_database_row build pytest.MonkeyPatch() by hand and wrap the body in try / finally: monkeypatch.undo(). Every other test in this module takes the monkeypatch fixture, which performs the same teardown automatically and removes the indentation level.

The manual form is correct. It is only inconsistent with the surrounding file.

♻️ Proposed simplification
-def test_two_interrupted_resumes_flatten_all_carried_outcomes(tmp_path: Path) -> None:
-    monkeypatch = pytest.MonkeyPatch()
-    monkeypatch.chdir(tmp_path)
-    try:
-        expected = ["tests/test_a.py::test_one", "tests/test_b.py::test_two"]
+def test_two_interrupted_resumes_flatten_all_carried_outcomes(
+    tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    monkeypatch.chdir(tmp_path)
+    expected = ["tests/test_a.py::test_one", "tests/test_b.py::test_two"]

Then de-indent the body and drop the finally: monkeypatch.undo() block.

As per coding guidelines for tests/**/*.py, I also checked the clock rule: no added test reads datetime.now or time.time directly, and no assertion depends on a timestamp value, so frozen_clock is not required here.

Also applies to: 666-669

🤖 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 `@tests/unit/devtools/test_verify.py` around lines 534 - 537, Update
test_two_interrupted_resumes_flatten_all_carried_outcomes and
test_resumed_seed_does_not_reuse_an_unexecuted_database_row to accept the
monkeypatch fixture, remove their manual pytest.MonkeyPatch construction and
try/finally undo cleanup, and de-indent the affected test bodies while
preserving their behavior.

Source: Coding guidelines

Comment on lines +2110 to +2138
@pytest.mark.parametrize(
("argv", "expected_scope", "expected_permission"),
[
(["--all", "--skip-slow"], "narrow-terminal", False),
(["--all", "--skip-slow", "--terminal-authorization", "narrow-terminal"], "narrow-terminal", True),
],
)
def test_verify_main_types_skip_slow_terminal_authority(
capsys: pytest.CaptureFixture[str], argv: list[str], expected_scope: str, expected_permission: bool
) -> None:
def fake_run(label: str, command: list[str], **kwargs: object) -> tuple[int, float, dict[str, object]]:
del label, command, kwargs
return 0, 0.01, {}

with (
patch("devtools.verify._run", side_effect=fake_run),
patch("devtools.verify.build_verify_steps", return_value=[("pytest full", ["pytest"])]),
patch("devtools.verify._git_head", return_value="head"),
patch("devtools.verify._save_history"),
patch("devtools.verify._stamp_head"),
patch("devtools.verify._notify"),
):
assert main([*argv, "--json"]) == 0

payload = json.loads(capsys.readouterr().out)
assert payload["verification_scope"] == expected_scope
assert payload["release_baseline_allowed"] is expected_permission
assert payload["terminal_authorization"] == ("narrow-terminal" if expected_permission else None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

This test writes a run directory into the real repository.

The test does not chdir to a temporary directory. main() calls _anchor_verification_paths(), which sets the CWD to ROOT. VerifyRun.__init__ then runs self.run_dir.mkdir(parents=True, exist_ok=True) and self.write() against self.root = Path.cwd(), which is now the real repository root.

Each parameterized case therefore creates .cache/verify/runs/<run_id>/run.json in the working tree and overwrites .cache/verify/current-run.json. _save_history and _stamp_head are patched, but VerifyRun is not.

Overwriting current-run.json is the part that reaches beyond this test. devtools/verify_runs.py guards that file with _current_owner_is_other_live_run, so a concurrent real verify run is protected, but a stale marker is still left behind.

Add monkeypatch.chdir(tmp_path) so VerifyRun writes inside the temporary directory. Note that _anchor_verification_paths() returns early when the CWD is outside ROOT, so the anchoring will not pull the run back into the repository.

🧪 Proposed isolation fix
 def test_verify_main_types_skip_slow_terminal_authority(
-    capsys: pytest.CaptureFixture[str], argv: list[str], expected_scope: str, expected_permission: bool
+    capsys: pytest.CaptureFixture[str],
+    monkeypatch: pytest.MonkeyPatch,
+    tmp_path: Path,
+    argv: list[str],
+    expected_scope: str,
+    expected_permission: bool,
 ) -> None:
+    monkeypatch.chdir(tmp_path)
+
     def fake_run(label: str, command: list[str], **kwargs: object) -> tuple[int, float, dict[str, object]]:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@pytest.mark.parametrize(
("argv", "expected_scope", "expected_permission"),
[
(["--all", "--skip-slow"], "narrow-terminal", False),
(["--all", "--skip-slow", "--terminal-authorization", "narrow-terminal"], "narrow-terminal", True),
],
)
def test_verify_main_types_skip_slow_terminal_authority(
capsys: pytest.CaptureFixture[str], argv: list[str], expected_scope: str, expected_permission: bool
) -> None:
def fake_run(label: str, command: list[str], **kwargs: object) -> tuple[int, float, dict[str, object]]:
del label, command, kwargs
return 0, 0.01, {}
with (
patch("devtools.verify._run", side_effect=fake_run),
patch("devtools.verify.build_verify_steps", return_value=[("pytest full", ["pytest"])]),
patch("devtools.verify._git_head", return_value="head"),
patch("devtools.verify._save_history"),
patch("devtools.verify._stamp_head"),
patch("devtools.verify._notify"),
):
assert main([*argv, "--json"]) == 0
payload = json.loads(capsys.readouterr().out)
assert payload["verification_scope"] == expected_scope
assert payload["release_baseline_allowed"] is expected_permission
assert payload["terminal_authorization"] == ("narrow-terminal" if expected_permission else None)
`@pytest.mark.parametrize`(
("argv", "expected_scope", "expected_permission"),
[
(["--all", "--skip-slow"], "narrow-terminal", False),
(["--all", "--skip-slow", "--terminal-authorization", "narrow-terminal"], "narrow-terminal", True),
],
)
def test_verify_main_types_skip_slow_terminal_authority(
capsys: pytest.CaptureFixture[str],
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
argv: list[str],
expected_scope: str,
expected_permission: bool,
) -> None:
monkeypatch.chdir(tmp_path)
def fake_run(label: str, command: list[str], **kwargs: object) -> tuple[int, float, dict[str, object]]:
del label, command, kwargs
return 0, 0.01, {}
with (
patch("devtools.verify._run", side_effect=fake_run),
patch("devtools.verify.build_verify_steps", return_value=[("pytest full", ["pytest"])]),
patch("devtools.verify._git_head", return_value="head"),
patch("devtools.verify._save_history"),
patch("devtools.verify._stamp_head"),
patch("devtools.verify._notify"),
):
assert main([*argv, "--json"]) == 0
payload = json.loads(capsys.readouterr().out)
assert payload["verification_scope"] == expected_scope
assert payload["release_baseline_allowed"] is expected_permission
assert payload["terminal_authorization"] == ("narrow-terminal" if expected_permission else None)
🤖 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 `@tests/unit/devtools/test_verify.py` around lines 2110 - 2138, Add the pytest
monkeypatch fixture to test_verify_main_types_skip_slow_terminal_authority and
call monkeypatch.chdir(tmp_path) before invoking main, ensuring VerifyRun writes
its run directory and current-run.json under the temporary path instead of the
repository root. Preserve the existing parameterized assertions and patches.

@Sinity Sinity closed this Aug 10, 2026
@Sinity Sinity reopened this Aug 10, 2026
Sinity added 8 commits August 10, 2026 09:38
Problem: seed-testmon caps the executed pytest command at four workers, while workload receipts recorded the uncapped adaptive policy. This made resource evidence disagree with the process that actually ran.

What changed: derive workload receipt concurrency from the final pytest command. A mutation test proves an uncapped twelve-worker policy records four for a capped seed command.
Problem: read-only graph inspection left SQLite connections open, while
stamp creation re-read a database after it had already proved its fingerprint.

What changed: close inspection connections deterministically and retain the
validated fingerprint in the resulting stamp. A focused mutation test proves
stamp construction makes one fingerprint read.
Bootstrap now checks local markerless attempts against their SQLite graph and
fingerprint, and it carries the caller's attempt relpath through both roots.
Publication uses one selection-only condition so it cannot discard a staged
marker under a divergent future decision.
Assert the non-null decision field in the selection-only publication branch so
the static type contract matches the branch predicate.
@Sinity
Sinity force-pushed the feature/fix/testmon-seed-recovery branch from 8959bfc to 5bcbb41 Compare August 10, 2026 07:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bcbb41c7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/testmon_state.py Resolved
@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@circleci run

1 similar comment
@Sinity

Sinity commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

@circleci run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d95500457

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/verify.py Resolved
Comment thread devtools/verify.py Resolved
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 54.F001 / P1: stale at the checked revision: devtools/merge_gate.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 54.F002 / P1: stale at the checked revision: devtools/merge_gate.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 54.F003 / P1: stale at the checked revision: devtools/merge_gate.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 54.F043 / P1: stale at the checked revision: devtools/testmon_bootstrap.py was deleted in bc34061 (refactor(devtools): excise self-attesting machinery; testmon as one seed (refactor(devtools): excise self-attesting machinery; testmon as one seed #4551)); the cited code no longer exists at 5ebcfe5.
  • 54.F060 / P1: refuted at the checked revision: The pinned workflow treats a zero-test green as no behavioral proof and requires an actual affected selection or an explicit complete run (AGENTS.md:161-165). The old seed-stamp authorization protocol has been removed; converting a new zero-test invocation into ordinary behavioral success is not the current verifier contract.
  • 54.F061 / P1: fixed-already at the checked revision: The replacement report writer derives outcomes from pytest_report_teststatus for every phase and preserves non-passing outcomes when later phases pass (devtools/pytest_stream_report.py:132-134). A setup-phase skip is therefore retained as skipped rather than classified as a missing call in the retired seed finalizer.
  • 54.F062 / P1: stale at the checked revision: There is no resumed seed-attempt outcome ledger at the pin. The replacement complete command executes a fresh full collection with --testmon-noselect rather than finalizing prior nodes from a new events file (devtools/verify.py:279).
  • 54.F063 / P1: stale at the checked revision: The --seed-testmon and --skip-slow interface and selection-only seed-finalization status are gone. The replacement complete-corpus command executes the full collection directly, without a narrow-terminal seed authorization that can convert successful completion to exit 5 (devtools/verify.py:279).
  • 54.F064 / P1: stale at the checked revision: The success-only seed fingerprint refresh no longer exists. Both tiers now write the native testmon graph (devtools/verify.py:296), and subsequent affected selection explicitly includes its failing_tests population rather than rejecting a failed run for seed.json hash drift (devtools/verify.py:502).
  • 54.F065 / P1: stale at the checked revision: Red seed-attempt.json and green seed.json are no longer alternative selection authorities. Current affected runs advance the same native datafile as full runs (devtools/verify.py:296), eliminating the branch that refreshed only a green sidecar.
  • 54.F066 / P1: stale at the checked revision: The green-stamp/selection-only-attempt transition has been removed. A failed affected execution remains in the native graph and is included through data.failing_tests on the next admission estimate (devtools/verify.py:502); there is no surviving green seed hash to reject the changed database.
  • 54.F067 / P1: stale at the checked revision: The skip-slow affected flag and release_baseline_allowed inheritance path have been removed. Current pytest construction has no skip-slow marker exclusion and chooses native complete versus affected selection directly (devtools/verify.py:279).

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 53.F053 / P2: stale at the checked revision: The checkout guard no longer reads seed.json, protocol-versioned seed attempts, or unpublished completion receipts. Verification uses the checkout-local testmon datafile model, while command admission performs interpreter and import-root checks rather than the removed seed-marker protocol. Current code: devtools/testmon_provision.py:3; devtools/click_dispatch.py:318; devtools/click_dispatch.py:323.
  • 53.F054 / P2: stale at the checked revision: The checkout guard no longer reads seed.json, protocol-versioned seed attempts, or unpublished completion receipts. Verification uses the checkout-local testmon datafile model, while command admission performs interpreter and import-root checks rather than the removed seed-marker protocol. Current code: devtools/testmon_provision.py:3; devtools/click_dispatch.py:318; devtools/click_dispatch.py:323.
  • 53.F055 / P2: stale at the checked revision: The checkout admission path no longer calls validate_stamp or scans the testmon dependency graph before every command. It performs the current interpreter/import containment checks and dispatches; testmon graph provisioning belongs to the separate testmon_provision module. Current code: devtools/click_dispatch.py:323; devtools/click_dispatch.py:328.
  • 53.F132 / P2: stale at the checked revision: devtools/merge_boundary.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 53.F133 / P2: stale at the checked revision: devtools/merge_boundary.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 53.F134 / P2: stale at the checked revision: devtools/merge_boundary.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 53.F135 / P2: stale at the checked revision: devtools/merge_boundary.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.
  • 53.F136 / P2: stale at the checked revision: devtools/merge_boundary.py was deleted in cac72e1 (refactor(agentctl): delete local delivery protocols (refactor(agentctl): delete local delivery protocols #4068)); the cited code no longer exists at 5ebcfe5.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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