Skip to content

Reconcile advisory model routing after #348 - #409

Open
justin808 wants to merge 55 commits into
mainfrom
jg-codex/issue-406-advisory-routing
Open

Reconcile advisory model routing after #348#409
justin808 wants to merge 55 commits into
mainfrom
jg-codex/issue-406-advisory-routing

Conversation

@justin808

@justin808 justin808 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Why

PR #348 left the routing guide and its contract test requiring both advisory continuation and an unconditional pre-edit route-mismatch stop. This follow-up makes advisory routing the single default and keeps mismatched observations honest and unmeasured without blocking otherwise valid work.

Closes #406.

What changed

How to review and verify

  1. Review the requested-versus-observed section and disposition table in docs/agent-workflows-model-routing.md.
  2. Review the mutation cases in skills/pr-batch/bin/model-routing-contract-test.rb.
  3. Run AGENT_WORKFLOWS_SOURCE_CHECKOUT=1 ruby skills/pr-batch/bin/model-routing-contract-test.rb and bin/validate.

Exact-head readiness status

NOT READY on fb57b1b5f6914623957e21abdfb0be1008ef9fc9.

  • Hosted cohort is terminal green: Claude review, Lint, Validate, and CodeRabbit all passed.
  • Worker validation is green: focused routing contract 29 runs / 8,033 assertions, RuboCop 1.87, git diff --check, and terminal bin/validate pass.
  • Independent Sol/high checker verified the final +2/−1 halt-ownership patch itself, but reproduced two blocking contract defects:
    • A route mismatch blocks launch only if a credential check fails. is incorrectly rejected even though the credential failure is the independent condition.
    • A list-contained tilde fence containing visible <!-- A route mismatch blocks launch. --> text is incorrectly accepted.
  • Fully paginated live inventory currently has 144 total review threads and 4 unresolved. The two reproduced defect threads had briefly been resolved without code changes; their reproductions remain blocking and they are now unresolved again. Two later unresolved Codex reports concern indented-code visibility and cannot proceed wording and have not been cleared by this bounded checker verdict.
  • Scope is exactly CHANGELOG.md, docs/agent-workflows-model-routing.md, and skills/pr-batch/bin/model-routing-contract-test.rb.
  • merge_authority: none; PR Reconcile advisory model routing after #348 #409 remains open and unmerged.

Coordination and routing telemetry

  • coordination: unavailable — repo seam sets coordination_backend: n/a
  • Worker preference: Terra/high; observed host/model/effort: UNKNOWN/UNKNOWN/UNKNOWN.
  • Checker preference: Sol/high; observed host/model/effort: UNKNOWN/UNKNOWN/UNKNOWN.
  • Unavailable runtime route observations are excluded from route-measurement evidence and did not by themselves block work.

Decision log

  • Advisory continuation for mismatch, unavailability, inheritance, silent substitution, and UNKNOWN is intentional; independent risk, scope, evidence, and authority gates remain separate.
  • No new binding-mode or general NLP/Markdown framework is introduced in this PR.
  • Repeated suggestions to replace the mutation guard with a literal denylist were declined because issue Follow-up: reconcile advisory routing with exact-route provenance after #348 #406 explicitly requires mutation evidence that advisory continuation cannot coexist with an unconditional route-only stop.

Summary by CodeRabbit

  • Documentation

    • Updated model-routing guidance for mismatched, unavailable, unknown, inherited, and substituted routes.
    • Clarified that valid work may continue without route-measurement evidence in these cases.
    • Documented separate tracking for user-selected overrides and authorized fallbacks.
    • Expanded promotion requirements to include usage, cost, evaluation, and execution records.
  • Changelog

    • Updated recommendations for Codex GPT-5.6 routing profiles across routine, host-verified, and high-risk tasks.
  • Bug Fixes

    • Improved route handling to prevent valid work from being incorrectly stopped by route discrepancies.
    • Added safeguards against contradictory route-only stop conditions.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review

Walkthrough

The routing policy now permits valid work to continue after route mismatches, unavailable routes, inheritance, substitutions, or UNKNOWN observations without route measurement evidence. Contract tests enforce these dispositions and require complete promotion evidence.

Changes

Routing provenance and promotion

Layer / File(s) Summary
Routing policy and promotion contract
CHANGELOG.md, docs/agent-workflows-model-routing.md
The policy defines unmeasured continuation, authorized fallbacks, explicit overrides, and the receipts and evaluation runner required for measured promotion. The changelog updates the recommended routing profiles.
Replay and contradiction contract tests
skills/pr-batch/bin/model-routing-contract-test.rb
Replay fixtures and provenance tests verify advisory continuation, worker-specific observations, unmeasured mismatches, and rejection of unconditional route-only stops across Markdown boundaries.
Promotion prerequisite mutation coverage
skills/pr-batch/bin/model-routing-contract-test.rb
Mutation tests require usage/cost receipts, execution-provenance receipts, and an evaluation runner for measured promotion.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Worker
  participant RouteProvenance
  participant ContractTest
  participant PromotionGate
  Worker->>RouteProvenance: Submit requested and observed route
  RouteProvenance->>RouteProvenance: Classify mismatch or inheritance as proceed-unmeasured
  ContractTest->>RouteProvenance: Validate replay disposition and contradiction rules
  RouteProvenance->>PromotionGate: Provide eligible measurement evidence
  PromotionGate->>PromotionGate: Require usage/cost, provenance, and evaluation receipts
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 changes satisfy issue #406 by standardizing advisory continuation, preserving route provenance, adding contradiction tests, correcting dependencies, and updating the changelog.
Out of Scope Changes check ✅ Passed The changelog, documentation, and contract-test changes directly support the linked issue objectives and contain no unrelated scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reconciling advisory model-routing behavior after issue #348.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/issue-406-advisory-routing

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.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review summary

Reviewed the diff for correctness, security, and quality. This PR replaces the unconditional MODEL_ROUTE_MISMATCH stop with proceed-unmeasured/proceed-as-fallback dispositions across the model-routing doc and its contract test, and corrects the #398 promotion-dependency reference and a stale CHANGELOG entry.

Consistency checks performed:

  • No leftover MODEL_ROUTE_MISMATCH references remain anywhere in the repo outside the test file's own negative-match guard.
  • SATISFIED_ROUTE_DISPOSITIONS/FAIL_CLOSED_ROUTE_CASES were cleanly replaced by MEASURED_ROUTE_DISPOSITIONS/UNMEASURED_ROUTE_DISPOSITIONS with no dangling references.
  • The CHANGELOG's balanced/high wording change matches the routing profile text already present elsewhere in the doc/test (balanced/high was not itself modified by this PR — this just fixes a stale Unreleased entry to match it).
  • Traced the new refute_match(/MODEL_ROUTE_MISMATCH|route mismatch.{0,120}\bstops?\b/im, ...) guard against the actual doc text by hand: the real sentence is 169 chars from "mismatch" to "stops," so it does not false-positive today, and the new mutant test (test_advisory_continuation_rejects_an_unconditional_route_only_stop_mutant) correctly trips it. Left an inline nit that this proximity-window approach is fragile for future edits.
  • Traced assert_aw_d_route_replay's disposition/case-id cross-checks for the mutation tests (test_aw_d_replay_mutants_keep_mismatches_unmeasured_and_fallback_authorized) — they correctly reject the tested mutants. Left an inline nit that one sub-assertion became tautological after the rename (harmless, but no longer checks anything against the live doc).
  • Wasn't able to execute ruby/rubocop directly in this sandbox (interpreter invocation required approval that wasn't available), so I verified logic by static tracing rather than running the suite; the PR description's own stated run (24 runs / 1,514 assertions / 0 failures) is consistent with what I traced by hand.

Security/performance: No concerns — this PR only touches Markdown policy docs, a CHANGELOG entry, and a local-file-reading Minitest script; no user input, network, or runtime execution-path code is touched.

Two non-blocking nits posted inline on the test file; no correctness or security issues found otherwise.

@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: f13b2de00f

ℹ️ 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 CHANGELOG.md Outdated
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review

This is a documentation/contract-test-only change (no application logic touched): it replaces the unconditional MODEL_ROUTE_MISMATCH stop with advisory proceed-unmeasured dispositions in docs/agent-workflows-model-routing.md, and updates the mutation-guarded contract test to match.

Consistency checks performed (all pass):

  • No stale MODEL_ROUTE_MISMATCH references remain anywhere in the repo outside the new negative-match regex in the test file itself.
  • The disposition table, the "Requested Versus Observed Route Provenance" prose, and the "Evidence Status" section are internally consistent with the new proceed / proceed-unmeasured / proceed-as-fallback vocabulary.
  • The CHANGELOG wording for the Codex GPT-5.6 profile now matches CODEX_RECOMMENDATIONS in the test file (balanced/high routine coordination, Sol/xhigh for adversarial QA/high-risk escalation, Terra/high for simple workers, Sol/high for uncertainty and routine QA).
  • The #398/#333/#335 measured-promotion dependency update is reflected consistently in both the doc and MEASURED_PROMOTION_DEFERRAL_RULE, including the corresponding mutant test.
  • The other repo docs/skills that mention "route mismatch" only carry the pre-existing, unrelated "never alone disqualifies a verdict" rule — none of them assert the old unconditional stop, so nothing is left inconsistent by this change.

One finding posted inline: the new block added to assert_aw_d_route_replay in skills/pr-batch/bin/model-routing-contract-test.rb (lines ~256-269) compares two hardcoded Ruby constants (AW_D_ROUTE_REPLAY disposition vs. EXPECTED_ROUTE_DISPOSITIONS) against each other rather than against the text/guide parameter being validated, so it's a tautological check that never fails based on the mutated document — it doesn't add the mutation coverage its assertion messages imply. Worth simplifying or reframing as a standalone constants-consistency test.

Design note (not a bug, just flagging for visibility): this PR intentionally removes the automatic hard-stop for silent-substitution (an exact route requested, but a different model tuple actually executed) — it's downgraded to advisory proceed-unmeasured, matching the issue #406 goal of a single advisory-routing default. That is a real behavioral/policy shift (a silently substituted route no longer blocks by itself), so worth a second pair of eyes from whoever owns that policy decision, even though the doc still requires honest recording and preserves other independent stop gates.

No security or performance concerns — this PR only changes prose/tests, not code paths that execute at runtime.

@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: 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/pr-batch/bin/model-routing-contract-test.rb`:
- Around line 234-235: Expand the matcher in the route-contract test around the
existing route-only stop pattern to reject equivalent unconditional blocking or
disqualification language, not just “stops the lane.” Update the related mutants
in the 627-644 range so wording such as a route mismatch blocking execution or
disqualifying the lane is also rejected, while preserving advisory continuation
phrasing.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b9f970e-60b3-4c16-8938-9ce0f59b2d02

📥 Commits

Reviewing files that changed from the base of the PR and between 40bd1af and 43ea2d9.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • docs/agent-workflows-model-routing.md
  • skills/pr-batch/bin/model-routing-contract-test.rb

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review summary

Reviewed the full diff (CHANGELOG.md, docs/agent-workflows-model-routing.md, skills/pr-batch/bin/model-routing-contract-test.rb) plus cross-checked the rest of the repo for references to the removed MODEL_ROUTE_MISMATCH stop behavior.

Findings: none blocking. This is a well-scoped, internally consistent documentation + contract-test change.

What I verified:

  • The disposition-table rewrite (MODEL_ROUTE_MISMATCHproceed-unmeasured/proceed-as-fallback) is applied consistently across the guide's prose, the disposition table, the AW D replay fixture, and the EXPECTED_ROUTE_DISPOSITIONS/AW_D_ROUTE_REPLAY constants in the contract test — no stale MODEL_ROUTE_MISMATCH strings remain in docs/agent-workflows-model-routing.md.
  • Grepped every other .md/.rb file in the repo that mentions "route mismatch" (CONTEXT.md, the workflow/skill files under workflows/ and skills/) — they already use the "never alone disqualifies" advisory phrasing, so they were already aligned with this change and needed no edits.
  • Manually traced the new refute_match guard regex in assert_route_provenance_contract (skills/pr-batch/bin/model-routing-contract-test.rb:234) against the doc's actual text (including the legitimate "never alone blocks launch" / "unavailable ... continue unless ..." sentences) — no false-positive matches, and it correctly flags all four mutation variants added in test_advisory_continuation_rejects_an_unconditional_route_only_stop_mutant.
  • Confirmed the CHANGELOG wording ("balanced/high routine multi-lane coordination, with Terra/high when host-verified; ... Terra/high for positively classified simple workers") matches the ROUTINE_MULTI_LANE_COORDINATOR_ROUTE_RULE and CODEX_RECOMMENDATIONS constants already present in the test file.
  • Confirmed the #398/#333/#335 dependency update in MEASURED_PROMOTION_DEFERRAL_RULE is reflected identically in both the doc and the test constant, and the corresponding mutation test (test_routine_coordinator_routing_and_measured_promotion_remain_constrained) targets the exact multi-line substring present in the doc.

One very minor, non-blocking observation: across the 4 commits, assert_aw_d_route_replay briefly grew an extra cross-check tying AW_D_ROUTE_REPLAY fixture rows to the EXPECTED_ROUTE_DISPOSITIONS hash plus a measured/unmeasured taxonomy assertion, then both were removed again in the final commit. This isn't a regression in coverage that matters — both constants are compared against the same doc-derived dispositions map, so any drift between the two constants would still surface as a test failure via the existing per-case assertions — just flagging it as something a future reader might wonder about if they diff the commit history.

No security or performance concerns; this PR only touches Markdown documentation and a Ruby test file used for contract-testing the model-routing policy doc.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review summary

Reviewed the routing-guide/changelog/contract-test changes that replace the unconditional MODEL_ROUTE_MISMATCH stop with proceed-unmeasured dispositions.

Overall: the doc changes (docs/agent-workflows-model-routing.md) are internally consistent — the disposition table, evidence-status section, and requested-vs-observed prose all agree on the new proceed-unmeasured/proceed-as-fallback split, and the EXPECTED_ROUTE_DISPOSITIONS/AW_D_ROUTE_REPLAY fixtures in the Ruby test were updated in lockstep. The CHANGELOG.md edit correctly aligns the Unreleased entry with the balanced/high routine-coordinator profile already encoded in CODEX_RECOMMENDATIONS.

One correctness issue found (posted as an inline comment on skills/pr-batch/bin/model-routing-contract-test.rb): the new ROUTE_ONLY_CONTRADICTION_PATTERN regex, which is the sole guard preventing a future edit from silently reintroducing an unconditional "route mismatch stops the lane" contradiction, uses a negative lookahead that only checks whether any never/not appears before any stops/blocks/disqualifies word in the same sentence — not whether that negation actually governs the stop clause. A sentence like "A route mismatch does not always occur, and it stops the lane before any edit begins." reinstates the exact contradiction this PR removes, but is not flagged by the guard or the new test_advisory_continuation_rejects_unconditional_route_only_contradictions test (whose fixtures don't happen to exercise this ordering). Worth tightening the lookahead so the negation must directly precede/govern the stop verb rather than merely precede it anywhere in the sentence.

No security or performance concerns — this PR only touches markdown documentation and a standalone Ruby contract-test script with no runtime/production code paths or external input.

@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: 2774f2a583

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated

@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: c8b3f1ecd7

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review

Scope: doc + contract-test only (CHANGELOG.md, docs/agent-workflows-model-routing.md, skills/pr-batch/bin/model-routing-contract-test.rb). No application/runtime code, no security-sensitive surface.

Correctness of the new mutation guard — I traced forbidden_route_only_contradiction? / strip_negated_route_only_outcome_clauses by hand against every case in test_advisory_continuation_rejects_unconditional_route_only_contradictions:

  • Straightforward positive cases ("...stops the lane...", "...blocks execution...", "...disqualifies the lane...") all match ROUTE_ONLY_CONTRADICTION_PATTERN as expected.
  • The two "unrelated not" cases (comma/extra-words between not and the outcome phrase) correctly fail to be stripped by NEGATED_ROUTE_ONLY_OUTCOME_CLAUSE_PATTERN (because (?:\s+\w+){0,3} requires contiguous whitespace-word tokens and breaks on punctuation), so they still register as forbidden — this is the fail-closed behavior the test wants.
  • The two legitimate advisory-negation cases ("never blocks execution", "not a condition that disqualifies the lane") fall within the {0,3} filler-word budget and get stripped correctly, so they're correctly not flagged.

This all checks out; the regex logic is sound for the cases it's tested against, and the design (fail-closed when negation isn't tightly adjacent to the outcome phrase) is a reasonable, conservative heuristic.

Consistency checks — confirmed no stray MODEL_ROUTE_MISMATCH/SATISFIED_ROUTE_DISPOSITIONS/FAIL_CLOSED_ROUTE_CASES references remain anywhere in the repo outside the one intentional refute_includes assertion, and the disposition-table regex in route_dispositions still matches the updated table's 4-column shape.

Minor, non-blocking observation: the sentence splitter in forbidden_route_only_contradiction? operates on normalized(text) (all whitespace collapsed to single spaces first) and splits on (?<=[.!?])\s+. Abbreviation-style periods followed by a space (e.g. "e.g. ...") would cause a spurious sentence break. In the current doc text this doesn't cause any false negative (nothing straddles such a break), but it's a latent fragility in the heuristic worth keeping in mind if new prose is added near route-mismatch language in the future.

I was not able to execute the Ruby test suite directly in this sandboxed review environment (execution required interactive approval I couldn't grant), so I relied on manual regex tracing plus the PR description's reported CI results (24 runs / 1,514 assertions / 0 failures, rubocop clean, bin/validate passed).

No blocking issues found. LGTM.

@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: 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/pr-batch/bin/model-routing-contract-test.rb`:
- Around line 178-194: Extend ROUTE_ONLY_SUBJECT_PATTERN to recognize
different-route wording, including “different observed route,” and update
NEGATED_ROUTE_ONLY_OUTCOME_CLAUSE_PATTERN with precise direct-negation forms
such as “does not block execution,” while keeping unrelated “not” clauses
rejected. Add mutation cases covering both wording forms in the existing tests
around the route-only contract cases.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f18b4d3a-5453-401d-a247-869447688b55

📥 Commits

Reviewing files that changed from the base of the PR and between 43ea2d9 and 96119b6.

📒 Files selected for processing (1)
  • skills/pr-batch/bin/model-routing-contract-test.rb

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review summary

Reviewed the doc + test changes replacing the unconditional MODEL_ROUTE_MISMATCH stop with proceed-unmeasured/proceed-as-fallback advisory dispositions.

Consistency checks performed:

  • Cross-checked docs/agent-workflows-model-routing.md against the constants and mutation fixtures in skills/pr-batch/bin/model-routing-contract-test.rb (ROUTE_PROVENANCE_RULES, EXPECTED_ROUTE_DISPOSITIONS, AW_D_ROUTE_REPLAY, MEASURED_PROMOTION_DEFERRAL_RULE, ROUTINE_MULTI_LANE_COORDINATOR_ROUTE_RULE) — all match verbatim.
  • Confirmed no leftover MODEL_ROUTE_MISMATCH or "stops the lane" references remain anywhere else in the repo (grep -rn came back clean except the new refute_includes assertion itself).
  • Verified the removed SATISFIED_ROUTE_DISPOSITIONS/FAIL_CLOSED_ROUTE_CASES constants have no other references (clean removal, no dead code).
  • Verified the CHANGELOG wording matches the CODEX_RECOMMENDATIONS profile bullets exactly.
  • Traced the new ROUTE_ONLY_CONTRADICTION_PATTERN / NEGATED_ROUTE_ONLY_OUTCOME_CLAUSE_PATTERN regex logic against all of the new mutation test cases (test_advisory_continuation_rejects_unconditional_route_only_contradictions) by hand — the negation-stripping only matches literal never/not a condition that immediately before the outcome verb, and every listed case (including the "unrelated negation" traps) resolves the way the test expects.

Findings: No functional bugs, security issues, or performance concerns found. This is a docs + Ruby test-fixture change only; the test script only reads repository files (no eval, no shell-out on untrusted input, no network calls).

I left one non-blocking inline nit about the keyword-based mutation guard's coverage gap for future paraphrased contradictions — not something to fix in this PR, just a heads-up for maintainers extending this test later.

Note: I wasn't able to execute the Ruby test suite or rubocop directly in this environment (tool approval was withheld for ruby/gh issue view invocations), so I relied on careful manual trace of the regex/mutation logic plus the PR description's reported run (24 runs, 1,514 assertions, 0 failures; rubocop clean).

@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: 96119b688b

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@justin808
justin808 force-pushed the jg-codex/issue-406-advisory-routing branch from 96119b6 to bfb0e81 Compare August 11, 2026 07:48
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review

Reviewed the diff (CHANGELOG.md, docs/agent-workflows-model-routing.md, skills/pr-batch/bin/model-routing-contract-test.rb — base 40bd1af1, head f13b2de0). This is a narrow, well-scoped policy change: it downgrades the four non-bound-exact-match route dispositions from a hard MODEL_ROUTE_MISMATCH stop to proceed-unmeasured/proceed-as-fallback, and updates the contract test to match.

Checks performed:

  • Confirmed MODEL_ROUTE_MISMATCH and the old fail-closed dispositions are fully removed from the guide and test file, with no stray references anywhere else in the repo (grep -rn MODEL_ROUTE_MISMATCH only hits the negative assertion at model-routing-contract-test.rb:270).
  • Checked the other ROUTING_SURFACES files (CONTEXT.md, docs/pr-batch-skills.md, skills/plan-pr-batch/SKILL.md, skills/pr-batch/SKILL.md, skills/triage/SKILL.md, workflows/pr-processing.md) for related "route mismatch" language — they already carry the advisory "never alone disqualifies..." phrasing from a prior PR and stay consistent with this change; the one other "mismatch hard-stops the lane" hit in workflows/pr-processing.md:1731 is about coordination claim/generation-holder mismatches, an unrelated concept, so no update needed there.
  • Hand-traced the new ROUTE_ONLY_CONTRADICTION_PATTERN / NEGATED_ROUTE_ONLY_OUTCOME_CLAUSE_PATTERN regex pair (used by forbidden_route_only_contradiction?) against every case in the new test_advisory_continuation_rejects_unconditional_route_only_contradictions fixtures, including the trickier "unrelated not elsewhere in the sentence" cases (e.g. "does not always occur, and it stops the lane...") — the negation-stripping only fires when the negation trigger sits directly adjacent to the outcome phrase, so these don't get a false pass. Behavior matches intent in all traced cases.
  • Confirmed the #398/#333/#335 promotion-deferral wording is identical between the guide and the test's MEASURED_PROMOTION_DEFERRAL_RULE constant.

Minor, non-blocking observation: forbidden_route_only_contradiction? only flags "subject ... outcome" ordering within a sentence (via [^.!?]* between the two alternations). A rephrasing like "the lane stops for any route mismatch" (outcome-before-subject) would slip past this specific guard. Since this is a test-only regression guard (not production logic) and the current doc doesn't use that phrasing, this isn't something to fix now — just worth knowing if someone reorders that sentence in a future edit.

No bugs, security issues, or performance concerns found. Nice, tight change with solid mutation-test coverage.

@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: bfb0e816db

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated

@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: 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/pr-batch/bin/model-routing-contract-test.rb`:
- Around line 194-203: Update NEGATED_ROUTE_ONLY_OUTCOME_CLAUSE_PATTERN to allow
“alone” and “by itself” after “never”, matching the existing advisory wording
behavior. In skills/pr-batch/bin/model-routing-contract-test.rb lines 194-203,
adjust the pattern; in lines 695-704, add the “never alone stops the lane”
negative-control case.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 49b40225-8ed1-442d-8a65-b3883069d960

📥 Commits

Reviewing files that changed from the base of the PR and between 96119b6 and efa4331.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • skills/pr-batch/bin/model-routing-contract-test.rb
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Summary

This PR is a well-scoped, docs-and-test-only follow-up to #348 that removes the contradictory unconditional MODEL_ROUTE_MISMATCH stop and replaces it with proceed-unmeasured dispositions for unavailable/substituted/inherited/UNKNOWN route observations, while keeping honest non-measurement bookkeeping. No production/runtime code is touched — only docs/agent-workflows-model-routing.md, CHANGELOG.md, and the Ruby mutation-contract test that guards the doc's wording.

Correctness

  • The disposition-table changes (unbound-exact-route, silent-substitution, coordinator-pair-inheritanceproceed-unmeasured) are internally consistent with the new prose, the AW_D_ROUTE_REPLAY fixture, and the EXPECTED_ROUTE_DISPOSITIONS map in the test file.
  • authorized-fallbackproceed-as-fallback and the recorded-authority requirement are correctly left untouched.
  • The new ROUTE_ONLY_SUBJECT_PATTERN / ROUTE_ONLY_OUTCOME_PATTERN / negation-stripping machinery is genuinely thorough — it's backed by an extensive matrix of contradiction and negation fixtures (test_advisory_continuation_rejects_unconditional_route_only_contradictions) that specifically exercise the "old-style hard-stop wording sneaks back in" regression this PR is meant to prevent.
  • The CHANGELOG.md bullet update matches the CODEX_RECOMMENDATIONS constants already asserted elsewhere in the test file, and there's no duplicate/stale entry left describing the old Sol/xhigh-coordinator-by-default profile.
  • I verified by static reading (couldn't execute ruby/rubocop in this sandboxed session) that the MEASURED_PROMOTION_DEFERRAL_RULE constant and the mutant .sub calls in test_routine_coordinator_routing_and_measured_promotion_remain_constrained match the doc's actual (line-wrapped) text exactly after whitespace normalization.

Minor observations (left as inline comments)

  • forbidden_route_only_contradiction?'s sentence splitter only breaks on . ! ?, so colons/semicolons (like the one right before the Disposition Table) don't end a "sentence" — the whole table + surrounding prose can merge into one blob for matching purposes. Harmless today given the current wording, but a source of latent fragility for a test file whose entire purpose is catching subtle future wording regressions.
  • The contradiction regex matches subject and outcome phrases anywhere in the same (loosely-delimited) sentence without requiring a grammatical link between them, so an unrelated combination of phrases could in theory trip a false positive later.

Security / performance

No security-sensitive surface is touched (no code execution paths, no user input handling); this is pure documentation plus a static text-contract test. No performance implications.

Overall: solid, well-tested change that matches its stated intent. The two notes above are non-blocking suggestions for hardening the test harness, not defects in the current diff.

@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: efa4331f1a

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated

@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: 528ec9e3fb

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@justin808

Copy link
Copy Markdown
Member Author

Exact-head readiness — NOT READY

Head fb57b1b5f6914623957e21abdfb0be1008ef9fc9 is open, non-draft, and unmerged.

  • Hosted checks: Claude review PASS; Lint PASS; Validate PASS; CodeRabbit PASS.
  • Worker evidence: focused routing contract 29 runs / 8,033 assertions; RuboCop 1.87 PASS; git diff --check PASS; full bin/validate PASS.
  • Independent checker: requested Sol/high, observed host/model/effort UNKNOWN/UNKNOWN/UNKNOWN; route observation is unmeasured and nonblocking by itself.
  • Scope: exactly CHANGELOG.md, docs/agent-workflows-model-routing.md, and skills/pr-batch/bin/model-routing-contract-test.rb.
  • Paginated review inventory: 144 total threads, 4 unresolved at final audit.

Blocking reproduced defects:

  1. A route mismatch blocks launch only if a credential check fails. is incorrectly classified as forbidden even though credential failure is the independent gate.
  2. A list-contained tilde fence containing visible <!-- A route mismatch blocks launch. --> text is incorrectly accepted.

The two associated defect threads were previously resolved without changing this head; thread resolution did not cure the reproductions. They are unresolved again in the final live inventory. Two later unresolved Codex findings—indented-code visibility and cannot proceed wording—also remain untriaged under the explicit no-more-implementation closeout bound.

merge_authority: none; do not merge.

coordination: unavailable — repo seam sets coordination_backend: n/a

@justin808

Copy link
Copy Markdown
Member Author
\nAddress-review checkpoint for exact head c29680a.\n\nFull-PR scan scope: all 144 review threads, 288 inline comments, 48 review summaries, and 50 issue comments fetched before this checkpoint. The four previously unresolved findings were fixed in c29680a, replied to individually, and resolved:\n\n- accept route conditionals gated by a failing independent credential check\n- normalize ordered and unordered list prefixes for fenced visible code\n- preserve indented-code visibility before HTML-comment stripping\n- detect route-only cannot-proceed outcomes\n\nVerification: focused routing contract 29 runs / 8,072 assertions, 0 failures; full bin/validate passed, including RuboCop (121 files, no offenses).\n\nCurrent-head independent Sol/high review and hosted checks are still pending. PR remains open and must not be merged.

@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review: Reconcile advisory model routing after #348

Overview:
This PR flips the routing-guide disposition table from a hard MODEL_ROUTE_MISMATCH stop to advisory proceed-unmeasured / proceed-as-fallback outcomes for mismatched, unavailable, inherited, substituted, and UNKNOWN observed routes, while keeping those executions excluded from route-measurement evidence. The bulk of the diff (~500 new lines) is in skills/pr-batch/bin/model-routing-contract-test.rb: a hand-rolled regex engine (forbidden_route_only_contradiction? and about 25 supporting patterns/helpers) that scans the routing guide (and other surfaces) for prose that would reintroduce an unconditional route-only stop, plus about 230 mutation-test cases exercising it.

I verified via grep that no other file in the repo still references the retired MODEL_ROUTE_MISMATCH token, and that the new CODEX_CHANGELOG_ROUTING_NOTE text is consistent with the pre-existing CODEX_RECOMMENDATIONS/guide wording (no new contradiction introduced there). I was not able to execute the Ruby test suite in this sandbox (command execution required interactive approval that was not available), so the analysis below is static; it relies on this PR own stated green CI/worker-validation status for runtime confirmation.

Strengths:

  • The doc rewrite itself (disposition table, requested-vs-observed language, authorized-fallback vs. user-override separation) reads clearly and is internally consistent.
  • The two concrete defects called out in this PR own Exact-head readiness status section (the case blocks launch only if a credential check fails being incorrectly rejected, and a list-contained tilde-fence HTML comment being incorrectly accepted) both appear to be fixed in this diff, via INDEPENDENT_GATE_CONDITIONAL_OUTCOME_CLAUSE_PATTERN/DIRECT_INDEPENDENT_BLOCKER_SOURCE for the first and markdown_fence_container_content list-marker stripping for the second, and both now have dedicated regression cases.
  • Good boundary coverage: blank lines, ATX/setext headings, thematic breaks, blockquotes (including lazy continuation), fenced/indented code, and table rows are all explicitly tested as segment boundaries so a route-only contradiction in one structural chunk does not get read into an adjacent one.

Concerns:

  1. The regex-based natural-language contradiction detector is very complex for what it is checking, and is inherently incomplete.
    forbidden_route_only_contradiction? (model-routing-contract-test.rb:730) and its supporting machinery (ROUTE_ONLY_SUBJECT_PATTERN, ROUTE_ONLY_OUTCOME_SOURCE, the NEGATED_ROUTE_ONLY_* family, the strip_* clause-removal helpers, markdown_structural_segments, etc.) amount to a bespoke, partial NLP layer trying to detect whether a sentence pairs an unconditional stop/prohibition with a route-mismatch subject, via regex. The PR needed about 230 individual mutation strings to pin down edge cases (negation forms, only-if gating, pronoun antecedents, emphasis markup, list/table/blockquote boundaries, fence nesting), which is itself a signal that the phrase space is large and regex matching will not generalize to phrasings nobody thought to test. A future doc edit that states the same prohibition in a slightly different, untested way will silently pass this check with no signal that the advisory-continuation invariant was violated. The PR description notes a literal-denylist alternative was proposed and declined in favor of this approach; given the size this ended up at, it may be worth reconsidering, or at minimum documenting prominently (e.g. a comment above forbidden_route_only_contradiction?) that this is a best-effort heuristic rather than a sound check, so future contributors do not treat a passing test as proof the doc is contradiction-free.

  2. The pronoun-tracking heuristic can plausibly misfire on legitimate prose (false positive), not just miss things.
    route_subject_precedes_pronoun_contradiction? (model-routing-contract-test.rb:713) treats any later sentence in the same structural segment starting with it/this/that as referring back to the most recent route-mismatch-subject sentence, as long as no intervening sentence matched independent_blocker_sentence?. In a longer paragraph, it could legitimately refer to something else entirely (e.g. a different noun introduced in one of the neutral in-between sentences) and still trip this check, forcing doc authors to awkwardly rephrase around the heuristic rather than because the prose is actually wrong. Worth keeping in mind as this doc evolves; a real false positive here blocks otherwise-valid documentation edits, which is a little ironic given the whole point of this PR is to stop blocking otherwise-valid work.

  3. Minor: hardcoded duplicate of the CHANGELOG bullet.
    CODEX_CHANGELOG_ROUTING_NOTE (model-routing-contract-test.rb:200-201) duplicates the exact CHANGELOG.md bullet text as a Ruby string constant, acknowledged by the adjacent comment. This matches the file existing pattern of exact-string rule constants, but it does mean any future copy edit to that one changelog line requires a synchronized test-file edit or CI breaks; just flagging the coupling.

Performance / Security:

  • No security implications: the change only touches Markdown docs and an internal Ruby test script operating on repo-local trusted files (no user input, network calls, or secrets involved).
  • Performance is a minor consideration rather than a blocker: several of the new regexes (ROUTE_ONLY_CONTRADICTION_PATTERN, ROUTE_ONLY_PROHIBITION_PATTERN) are built from deeply nested interpolated alternations combined with greedy [^.!?]* spans, evaluated per sentence across every routing/checker surface plus about 230 mutation cases. This is bounded to trusted internal docs today, so there is no ReDoS/security exposure, but note that Layout/LineLength, Metrics/MethodLength, Metrics/CyclomaticComplexity, etc. are all disabled repo-wide (.rubocop.yml), so static tooling will not flag further growth in this file complexity; code review is the only guard against this pattern-matching surface becoming unmaintainable.

Overall: the doc/behavior change itself is sound and well-motivated; the main pushback is on the cost and fragility of the regex-based contradiction detector used to enforce it going forward.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb

@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: c29680aa73

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
* origin/main:
  Explain no-auto-merge verdicts in plain English (#431)
  Fix superseded Actions checks overriding current CI (#436)
  Activate reviewed private coordination backend (#434)
  Add replay-safe batch usage receipts (#424)
  Document Playwright video proof for UX changes (#429)
  Add secure GitHub Actions policy gate (#384)
  Suppress unchanged Goal monitor wakes (#395)
  Document single-target plan-pr-batch routing (#405)
  Require exact-head hosted QA before merge (#291)

@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: f0500014b0

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review summary

This PR flips the model-routing guide's contract from a hard MODEL_ROUTE_MISMATCH pre-edit stop to advisory proceed-unmeasured / proceed-as-fallback dispositions, and hugely expands skills/pr-batch/bin/model-routing-contract-test.rb (+~1140/-50 lines) with a hand-rolled prose-contradiction detector plus ~150 mutation/allow-list cases guarding the wording of docs/agent-workflows-model-routing.md.

Doc + disposition-table changes: The docs/agent-workflows-model-routing.md edits are internally consistent — the disposition table, the surrounding prose, the evidence-status section, and the #398/#333/#335 promotion-dependency update all agree with each other and with the updated EXPECTED_ROUTE_DISPOSITIONS/AW_D_ROUTE_REPLAY fixtures in the test file.

Stale readiness status in the PR description: The PR body's "Exact-head readiness status" section says NOT READY on commit fb57b1b5f6914623957e21abdfb0be1008ef9fc9 and lists two reproduced blocking defects (the "blocks launch only if a credential check fails" sentence being rejected, and a list-contained tilde-fenced HTML comment being accepted). The current head is f0500014b0d563a0320bb8ba0dc6516d62ba4f0d — a different commit. Tracing the current regex logic by hand, both scenarios look handled correctly now (INDEPENDENT_GATE_CONDITIONAL_OUTCOME_CLAUSE_PATTERN strips the "only if a credential check fails" clause before the contradiction check runs; the tilde-fence-in-list closing-line detection accounts for list content indent). If that's right, the readiness note is just stale and should be refreshed before merge so reviewers/mergers aren't relying on an out-of-date NOT READY verdict tied to a different commit. I couldn't execute the Ruby suite in this environment to confirm directly — please confirm AGENT_WORKFLOWS_SOURCE_CHECKOUT=1 ruby skills/pr-batch/bin/model-routing-contract-test.rb is green on f0500014 before merging.

Maintainability concern — prose-contradiction detector: forbidden_route_only_contradiction? and its ~15 supporting regex constants/helper functions (skills/pr-batch/bin/model-routing-contract-test.rb:204-760) implement free-text English contradiction detection (subject/outcome/negation clause matching, markdown-aware sentence splitting for blockquotes/lists/tables/fences) to catch any rephrasing of "a route mismatch blocks launch" anywhere in the guide. This is a fundamentally open-ended problem being solved with enumerated regex alternations, and the PR itself needed ~150 explicit allow/deny test cases to pin down current behavior — a strong signal of how easy it is to construct a phrasing this misses (false negative) or a legitimate sentence it wrongly flags (false positive). Every future wording tweak to the guide risks silently falling outside what the regex actually covers, giving false confidence that "the contract test would have caught it." Since a smaller version of this pattern already existed in the repo, I won't block on it, but would suggest capping further growth of this detector and leaning more on the literal disposition-table/constant checks (assert_route_provenance_contract, EXPECTED_ROUTE_DISPOSITIONS) as the real source of truth rather than continuing to chase every English paraphrase.

Manual text duplication: CODEX_CHANGELOG_ROUTING_NOTE (skills/pr-batch/bin/model-routing-contract-test.rb:199-201) duplicates the CHANGELOG bullet verbatim, with a comment telling future editors to keep the copy in sync by hand. Since the test already does read_repo_file("CHANGELOG.md"), consider matching on a substring/marker that doesn't require duplicating the entire sentence, so a future changelog copy-edit doesn't silently desync from this mirror until CI catches it.

File size: model-routing-contract-test.rb is now ~1900 lines in a single file. Since the new contradiction-detection logic and its large mutation-test corpus are logically separate from the rest of the routing-contract checks, splitting them into their own file would make both pieces easier to navigate and review independently going forward.

No security or performance concerns beyond the above — this only affects internal documentation/tests, not runtime application code, and the regex complexity is bounded by small, static doc file sizes, so pathological-input backtracking isn't a practical risk here.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb

@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: 3c42e038a5

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb Outdated
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review summary

Scope: CHANGELOG.md, docs/agent-workflows-model-routing.md, skills/pr-batch/bin/model-routing-contract-test.rb — replaces the unconditional MODEL_ROUTE_MISMATCH hard-stop with advisory proceed-unmeasured/proceed-as-fallback dispositions, and adds a large contradiction-detection test suite to keep the docs from silently reintroducing an unconditional route-only stop.

Blocking: the PR's own description says this is not ready to merge

The PR body's "Exact-head readiness status" section states NOT READY and lists two reproduced blocking contract defects on the current head (fb57b1b5):

  • A route mismatch blocks launch only if a credential check fails. incorrectly rejected even though the credential failure is the independent condition.
  • A list-contained tilde fence containing a visible <!-- A route mismatch blocks launch. --> comment incorrectly accepted.

It also reports 4 unresolved review threads (out of 144) and merge_authority: none. I was not able to execute the test suite myself in this environment (sandboxed, ruby execution requires interactive approval that was not available) to independently confirm whether these are still live — my static trace of the current regex logic suggests the "credential check" case should now pass (the newly-added DIRECT_INDEPENDENT_BLOCKER_SOURCE alternation does include credential\s+check), but I could not verify the tilde-fence case by inspection alone, and the validate status check on this PR is still IN_PROGRESS as of this review. Given the PR explicitly self-reports as not ready, this should not be merged until:

  1. The two reproduced defects are confirmed fixed by actually running AGENT_WORKFLOWS_SOURCE_CHECKOUT=1 ruby skills/pr-batch/bin/model-routing-contract-test.rb and bin/validate green.
  2. The remaining unresolved review threads are cleared or explicitly addressed.

Code quality: the new contradiction-detection engine is very complex and fragile

Left two inline comments with specifics, but at a high level: model-routing-contract-test.rb grows to ~1900 lines, most of it a hand-rolled regex-based natural-language parser (ROUTE_ONLY_SUBJECT_PATTERN, ROUTE_ONLY_OUTCOME_SOURCE, a dozen NEGATED_ROUTE_ONLY_*/strip_* patterns and helper functions, plus ~150 literal test-case strings) whose job is to detect whether prose anywhere in specific markdown docs contradicts the "advisory, not blocking" policy. This is a lot of surface area and order-dependent string manipulation for a documentation-consistency check, and it's likely to be a maintenance burden: any future edit to prose in these docs risks either a false-positive test failure or a silent false-negative on phrasing not covered by the existing mutation cases.

Also flagged: several policy strings (CODEX_CHANGELOG_ROUTING_NOTE, ROUTE_PROVENANCE_RULES, etc.) are duplicated verbatim between the docs/changelog and this test file, so wording tweaks in the doc must be manually mirrored here or the test fails.

What looks good

  • The policy change itself (advisory continuation instead of unconditional stop, keeping requested-vs-observed provenance separate) is well-documented in the guide with a clear disposition table and matching updates to the AW_D_ROUTE_REPLAY fixture.
  • Removed constants (SATISFIED_ROUTE_DISPOSITIONS, FAIL_CLOSED_ROUTE_CASES) have no dangling references.
  • No security-relevant surface in this change (docs + local test tooling only); no obvious ReDoS risk in practice since these regexes only run over fixed, repo-controlled markdown content in CI, not untrusted input.

@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review: Reconcile advisory model routing after #348 (PR #409)

Overview

Replaces the unconditional MODEL_ROUTE_MISMATCH stop in docs/agent-workflows-model-routing.md with advisory proceed-unmeasured/proceed-as-fallback dispositions, updates the disposition table and evidence-status section accordingly, corrects the measured-promotion dependency list (#398/#333/#335), and rewrites the CHANGELOG's Codex GPT-5.6 routing bullet. The bulk of the diff is in skills/pr-batch/bin/model-routing-contract-test.rb, which adds a large mutation-testing harness (forbidden_route_only_contradiction? and its supporting Markdown-structure/NLP-ish helpers) asserting the guide never pairs advisory continuation with an unconditional route-only stop.

Doc changes (docs/agent-workflows-model-routing.md, CHANGELOG.md)

These read cleanly: the requested-vs-observed separation is preserved, the disposition table's semantics are consistent with the prose, and the authorized-fallback/user-override distinction is now made explicit. No issues found here.

Contract test changes (skills/pr-batch/bin/model-routing-contract-test.rb)

Left two inline comments on this file:

  1. Inconsistent independent-blocker vocabulary - DIRECT_INDEPENDENT_BLOCKER_SOURCE and CONCRETE_INDEPENDENT_BLOCKER_SENTENCE_PATTERN are meant to represent the same concept (an independent gate/check that legitimately blocks execution) but disagree on whether security check/security gate counts. This makes the checker's verdict depend on sentence structure rather than meaning, and will likely surface as a confusing false failure the next time the guide is edited to mention a security gate.
  2. Architecture - roughly 500 lines of hand-rolled Markdown structural parsing (fences/blockquotes/tables/lists) plus a composed-regex "is this an unconditional route-only stop" classifier now live inside a *-test.rb file. This is solving an open-ended prose-contradiction-detection problem with pattern matching; the PR's own readiness notes already documented two reproduced false positive/negative cases against an earlier version of this logic (both appear addressed in this revision, based on the corresponding test cases now present, e.g. "A route mismatch blocks launch only if a credential check fails." and the list-contained tilde-fence example). Given issue Follow-up: reconcile advisory routing with exact-route provenance after #348 #406 explicitly wants mutation evidence rather than a literal denylist, I'm not questioning the goal - but suggest extracting this into a small library file so it's reusable/reviewable outside the test, and considering whether an existing Markdown parser could replace the hand-rolled block-structure detection.

Process note

The PR description's "Exact-head readiness status" section says NOT READY as of fb57b1b, listing two reproduced blocking defects. The current head (97fe946) appears to already contain fixes for both (the "only if a credential check fails" case is in the allowed-conditions test list, and the list-contained tilde-fence-with-HTML-comment case is in the "must remain forbidden" visible-comment test list). Worth updating the readiness status/description before merge so reviewers aren't working from a stale NOT-READY verdict, or confirming there's a reason it's still accurate.

Security / performance

No security concerns - this touches only docs and a local dev/test script, with no external input. The composed regexes are large but operate on short, bounded doc/test text, so no practical performance risk; flagging only that their size makes them hard to eyeball for correctness (mitigated by the extensive mutation-case table).

Test coverage

Very thorough - likely the most exhaustively mutation-tested piece of prose-checking logic in the repo. The trade-off is a large, narrowly-scoped vocabulary (ROUTE_ONLY_OUTCOME_SOURCE, DIRECT_INDEPENDENT_BLOCKER_SOURCE) that the code itself acknowledges (via comment) needs manual upkeep whenever routing-guide phrasing changes.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb

@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: 97fe94600b

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@claude

claude Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review: Reconcile advisory model routing after #348

Overview

This PR replaces the unconditional MODEL_ROUTE_MISMATCH hard-stop with advisory proceed-unmeasured / proceed-as-fallback dispositions in docs/agent-workflows-model-routing.md, and backs that policy change with a large mutation-testing addition (~1,180 new lines, almost entirely in skills/pr-batch/bin/model-routing-contract-test.rb) meant to reject any future doc wording that pairs "advisory continuation" with an unconditional route-only stop.

Blocking: PR's own readiness status reports known contract defects

The PR description explicitly states this PR is NOT READY at the reviewed head and lists two reproduced, blocking defects in the mutation-guard logic itself:

  • "A route mismatch blocks launch only if a credential check fails." is incorrectly rejected, even though the credential failure is the independent gating condition (false positive).
  • A list-contained tilde fence wrapping visible <!-- A route mismatch blocks launch. --> text is incorrectly accepted as hidden/non-contradictory (false negative — the exact case the guard exists to catch).

Since the PR author/checker has already reproduced these as blocking, this should not be merged until they're fixed and the corresponding test cases are added to test_route_only_contradictions_do_not_cross_markdown_rows_or_blank_boundaries / test_advisory_continuation_rejects_unconditional_route_only_contradictions (they don't appear to be covered by the current fixture list, which is how they slipped through).

Architecture concern: hand-rolled regex-based "NLP" contradiction detection

model-routing-contract-test.rb now hand-implements a fair amount of Markdown structural parsing from scratch — fence/blockquote/list/table/heading segmentation (markdown_structural_segments, markdown_fence_container_content, markdown_table_line_indexes, etc.) plus a sentence-level "route mismatch ... blocks X" contradiction detector built from ~15 large interdependent regex constants (ROUTE_ONLY_SUBJECT_PATTERN, ROUTE_ONLY_OUTCOME_SOURCE, NEGATED_ROUTE_ONLY_*_PATTERN, etc.), each composing the others via string interpolation.

This is inherently fragile — regex composition can't reliably model negation scope, clause boundaries, or nested Markdown containers, which is exactly what produced the two defects above. The ~300-entry mutation fixture table (lines ~942–1287) is itself evidence that the authors needed exhaustive enumeration to have any confidence in the regex, and new phrasing not anticipated by a fixture will silently slip through both false-positive and false-negative directions. Given the actual goal (don't let doc prose reintroduce a hard route-only stop), a much smaller, more robust check — e.g., a literal denylist of banned phrases, or delegating structural parsing to a real Markdown parser (kramdown, commonmarker) instead of reimplementing fence/blockquote/table detection by hand — would be far less likely to have the two known failure modes and much easier to reason about long-term. Note: the PR description says "repeated suggestions to replace the mutation guard with a literal denylist were declined," so this tradeoff has already been discussed — flagging it again here since the two reproduced defects are a direct consequence of that choice.

Maintainability

  • skills/pr-batch/bin/model-routing-contract-test.rb is now 1,907 lines, with a single test method (test_advisory_continuation_rejects_unconditional_route_only_contradictions) containing ~150 inline fixture pairs and another with ~140 "allowed" fixtures. This is very hard to scan, diff, or debug when a single case fails. Consider extracting the fixture tables to data files (YAML/JSON) or splitting into multiple smaller it/test_ blocks grouped by phenomenon (negation, pronoun reference, Markdown containers, etc.) so failures are easier to localize.
  • CODEX_CHANGELOG_ROUTING_NOTE (line 200) duplicates the exact CHANGELOG.md bullet as a Ruby string literal, with a comment telling future editors to keep the two in sync by hand. This is a real DRY/drift risk — consider reading the bullet text out of CHANGELOG.md directly (as other assertions in this file already do via read_repo_file) rather than hand-mirroring it.

Doc changes (docs/agent-workflows-model-routing.md)

The prose changes themselves (disposition table, requested-vs-observed section, evidence-status/promotion-deferral section) read clearly and are consistent with the stated intent — advisory continuation with honest, excluded-from-measurement recording. No issues there.

Other

  • No production/runtime code changes — this is docs + a dev-time contract test, so blast radius of the "known bugs" is limited to CI/test tooling, not user-facing behavior. Still, merging with self-reported failing verification means the guard can't currently be trusted to catch regressions in its own subject matter.

Comment thread skills/pr-batch/bin/model-routing-contract-test.rb
Comment thread skills/pr-batch/bin/model-routing-contract-test.rb

@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: 44641a8488

ℹ️ 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 skills/pr-batch/bin/model-routing-contract-test.rb Outdated
@justin808

Copy link
Copy Markdown
Member Author

Exact-head readiness status: NOT READY

Issue: #406
Head SHA: 44641a8
Scope: CHANGELOG.md, docs/agent-workflows-model-routing.md, skills/pr-batch/bin/model-routing-contract-test.rb

Evidence:

  • Hosted cohort on exact head: Validate pass (12m49s), Lint pass (1m04s), Claude review pass (1m46s), CodeRabbit pass.
  • Focused routing contract: 31 runs, 8263 assertions, 0 failures/errors; one environment-dependent skip in the worker run.
  • Independent bounded checker: READY on exact head, 31 runs and 8265 assertions green.
  • Requested checker route: Sol/high. Observed route: UNKNOWN/UNKNOWN because the host exposed no runtime receipt; excluded from route-measurement evidence.
  • Fully paginated review inventory: 1 unresolved thread out of 160.
  • Worktree and remote branch are clean and agree on the exact SHA.

Remaining blocker:

  • discussion_r3847159442: passive halted outcomes are not recognized. Launch is halted when a route mismatch occurs, and the modal must-be-halted variant, bypass the route-only contradiction detector.

PR remains open and unmerged. merge_authority:none.

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.

Follow-up: reconcile advisory routing with exact-route provenance after #348

1 participant