Repository navigation
Apply lane: carry the pinned validator's diagnosis on both refusal branches and distinguish harness errors from findings - #808
Conversation
`gate_console.py:dispose_possible` raised `GateRefused` with:
"A" if ok is False else "B" + f": {detail}"
which Python binds as `A if ok is False else (B + f": {detail}")` — so
`detail` (the pinned validator's stdout+stderr) was appended only on the
"unreachable" branch. A real rejection (`ok is False`, today's D-2 act A)
discarded the validator's diagnosis: run log, commit message, and the
committed refusal record all said only "updated index rejected by the
pinned validator", with no way to see why. Parenthesize so both branches
carry `detail`, and bound it (last 2,000 chars, whitespace-normalised) so
a refusal message stays readable regardless of how much the validator
printed.
`ideation_readiness.py:validate_index` conflated a harness/environment
error in the validator's own setup (any exit code other than 0/1, or a
spawn failure) with a real rejection (exit 1, findings) by returning
`proc.returncode == 0` — always a bool, never distinguishing exit 2 from
exit 1. Return a true three-way result instead: `(True, detail)` on exit
0, `(False, detail)` on exit 1, `(None, detail-with-exit-code)` on any
other exit code or a spawn `OSError`. `gate_console.py`, `readiness_dispatch.py`,
and `derive_possibles_dispatch.py` already branch on `ok is False` vs.
else, so this alone stops all three callers from reporting a harness
error as a rejection — only `gate_console.py`'s own precedence bug needed
a direct fix.
Tests added: reject branch carries the validator's detail; unreachable
branch carries detail exactly once (no doubling, per the 2026-09-06
observed "...unreachable: index validator unreachable (...)" message);
the runner's exit 0/1/2 -> True/False/None mapping; detail is bounded.
Mutation-proved: reverting the parenthesization reds the reject-branch
test.
Refs #656
Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_013zUwKfdNgAyNuUAUs3WTDU
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟡 Changes recommended
validate_index() still lets subprocess.TimeoutExpired escape despite the updated 3-way “unreachable” contract, and _bounded_detail() can be made safer for very large outputs to avoid unnecessary peak-memory amplification.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes the apply lane’s pinned index-validator refusal reporting so diagnostics are consistently preserved (bounded) on both “rejected” and “unreachable” paths, and so validator harness/environment failures are distinguished from real schema findings.
Changes:
- Corrects
GateRefusedmessage construction sodetailis appended on both refusal branches, and introduces_bounded_detail()to cap/normalize the carried validator output. - Updates
validate_index()to return a true three-way result based on validator exit code (0→True, 1→False, other→None) and to treat spawn failures as “unreachable”. - Adds regression tests covering message carry-through, “unreachable” non-doubling, three-way mapping, and bounding/whitespace normalization.
File summaries
| File | Description |
|---|---|
| scripts/ideation_dashboard/gate_console.py | Ensures refusal messages always include bounded validator detail and fixes precedence bug in message assembly. |
| scripts/doc_health/ideation_readiness.py | Implements three-way validator result mapping and improves harness error reporting. |
| tests/ideation-dashboard/test_gate_console.py | Adds regression tests for refusal messaging behavior and bounded detail handling. |
| tests/doc-health/test_ideation_readiness.py | Adds regression test ensuring exit-code mapping distinguishes harness errors from findings. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Two Copilot-review defects on this apply lane's validator-detail fix, both on PR #808: 1. `validate_index()` promises a three-way result for unreachable harness failures, but a validator exceeding DISPATCH_TIMEOUT raised `subprocess.TimeoutExpired` past the exit-code mapping, crashing every caller instead of returning the documented `(None, reason)`. Now caught alongside the existing spawn OSError, mapping to the same None outcome with a detail naming the timeout and carrying any partial stdout/stderr the validator produced before it was killed. 2. `_bounded_detail()` normalised whitespace over the FULL raw string before bounding it, materialising a full token list for arbitrarily large validator output — the exact case the helper exists to make safe. Now bounds the raw tail to a small, fixed-size window first, then normalises that (already small) window, then re-slices to the 2,000-character contract as a final safety net. Both fixes carry a new test. Targeted suites, full `tests/ideation-dashboard tests/doc-health` (6688 passed, 31 skipped, 1 tolerated failure), and `openspec validate --all --strict` (100 passed, 1 tolerated failure) all green. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_018Yt7feEjmZ3SPeU2wsBDDJ
There was a problem hiding this comment.
🔵 Needs a closer look
validate_index() still returns a duplicated “index validator unreachable …” detail string in the no-checkout case and can emit a dangling ": " message on empty output, which undermines the PR’s stated diagnostics goals.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/doc_health/ideation_readiness.py:942
validate_index()returns a detail string that already starts with "index validator unreachable" when no pinned checkout is found, but multiple callers prefix unreachable failures with "index validator unreachable: ". This still produces the doubled message reported in #656 (e.g. "index validator unreachable: index validator unreachable (no openxFactory checkout)"). Return only the reason here (without repeating the prefix) so callers can safely add their own prefix once.
This issue also appears on line 962 of the same file.
validator = validator or find_index_validator()
if validator is None:
return None, "index validator unreachable (no openxFactory checkout)"
cmd = [sys.executable, str(validator), str(index_path)]
scripts/doc_health/ideation_readiness.py:966
- When the validator exits with a non-0/1 code and produces no output, the returned detail currently ends with a dangling ": " (because
outputis empty). Returning a message without the trailing colon makes the unreachable detail clearer and avoids awkward gate/skip messages.
if proc.returncode == 0:
return True, output
if proc.returncode == 1:
return False, output
return None, f"validator exited {proc.returncode} (harness error): {output}"
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
…1/5.2 ticked on the D-2 evidence) (#832) Path A PR-5, the last of the 2026-09-06 plan memo's sequence, on Brett Heap's word "merge pr-5 when green" (2026-09-09). Authority: his ruling of 2026-09-05T23:38Z "rule path A, 4.5 is a deferred successor" (#656) and ruling D-2 (the live exercise). - tasks.md: § 4.4 / § 5.1 / § 5.2 ticked on the D-2 evidence (three `- [ ]` heads removed, every ratified sentence kept byte-identical); § 4.5 untouched as a DEFERRED SUCCESSOR (#714 → 3d1b8cc). - Archived WITH promotion via `scripts/proposal-support.py . archive --date 2026-09-09` under the pinned @fission-ai/[email protected] (never a bare `openspec archive`); origin retained (declaration unchanged since da1b0e9); six frozen files R100. - Promoted: `openspec/specs/ideation-intent-plane/spec.md` NEW (7 requirements / 11 scenarios, every block byte-identical to the archived delta) and `openspec/specs/document-lifecycle/spec.md` 18 → 19 requirements ("Gates happen on main"); the new capability's `## Purpose` written by this act (no SHALL; replaces the CLI's TBD stub). openspec/specs 60 → 61; floor regeneration OWED (GRACED covered-pending 1, `created_by_candidate`), `contracts/review-lane-floor-snapshot.yaml` deliberately not edited here. - README OpenSpec Records row → archived; sweep-ledger row re-seeded with the tool (`--seed-ledger --moved-by '#832'`, one line moved); no thirteenth archive-date disposition. - Evidence (merged + green): #718 d179cc0, #727 07624d5, #735 6d3237e, xFactory #304 b2db7e47, #313 ddd19650, #345 90435875, #781 450bb60, #808 2ef7d8c, #814 c991c0f, #816 8924230, xFactory #362 119280a8, #830 202c170, xFactory #369 c2313277; D-2 live exercise: act B refusal 36d07ec, act A apply e970dfe, first autonomous merge #176 → 7681e40 (codexfactory[bot] APPROVED 2026-09-09T06:37:22Z). - Copilot round 1: one factual finding taken (a missing "where" in Purpose); two wording findings answered and resolved. Refs #656 (stays OPEN). Rule 6 LANDING window observed. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_012LiNG5Ume1boEfxSNeCmpu
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
Defect
Governing record #656, D-2 LIVE EXERCISE comment (2026-09-08 ~13:2xZ), defect
add-ideation-intent-plane5.1).scripts/ideation_dashboard/gate_console.py:2051-2055:Python binds this as
A if ok is False else (B + f": {detail}"), sodetail(the pinned validator's stdout+stderr) is appended ONLY on the"unreachable" branch. On the reject branch — today's act A (run
34227845874, commit
cb2dd56f) — the diagnosis is discarded entirely: therun log, the commit message, and the committed refusal record all say only
"updated index rejected by the pinned validator", with no way to see why.
On the unreachable branch it produced the doubled message observed
2026-09-06:
"index validator unreachable: index validator unreachable (no openxFactory checkout)".Related:
scripts/doc_health/ideation_readiness.py:944-946(the validatorrunner) returned
proc.returncode == 0, so a harness error (exit 2, e.g. animport error in the validator's own environment) and real findings (exit 1)
were both reported as "rejected by the pinned validator". The two must be
distinguishable — act A's rejection does NOT reproduce offline and is
probably a harness/environment error, not a real schema rejection.
Fix
gate_console.py— parenthesize so BOTH branches carrydetail:("updated index rejected by the pinned validator" if ok is False else "index validator unreachable") + f": {detail}", withdetailboundedto the last 2,000 characters (whitespace-normalised) via a new
_bounded_detailhelper, so a refusal message stays readable regardlessof how much the validator printed. The exact leading phrases are
unchanged.
ideation_readiness.py'svalidate_index— returns a true three-wayresult:
(True, detail)on exit 0,(False, detail)on exit 1(findings),
(None, detail-with-exit-code)on any other exit code or aspawn
OSError(harness/environment error, never a rejection). The exitcode is included in the detail text.
readiness_dispatch.pyandderive_possibles_dispatch.pyalready branch onok is Falsevs. elsewhen consuming
validate_index's result, so this fix alone stops allthree callers from misreporting a harness error as a rejection — no
change was needed in those two files.
ideation_readiness.py'svalidate_index— also catchessubprocess.TimeoutExpired: a validator exceedingDISPATCH_TIMEOUTused to raise straight past the exit-code mapping and crash every
caller instead of returning the documented
(None, reason)unreachableoutcome. Now maps to
Nonewith a detail naming the timeout andcarrying any partial stdout/stderr the validator produced before it was
killed (Copilot review,
ideation_readiness.py:951).gate_console.py's_bounded_detail— bounds the RAW tail to a small,fixed-size window BEFORE normalising whitespace, not after: normalising
the whole string first (
" ".join(s.split())) built a full token listover arbitrarily large validator output, the exact case the helper
exists to make safe. The 2,000-character contract is unchanged (Copilot
review,
gate_console.py:2000).Nothing else touched: no workflow edits, no envelope, no intents.
Proof
python3 -m pytest -q tests/ideation-dashboard tests/doc-health:6686 passed, 31 skipped, 1 failed in 1026s — the one failure is the
known environmental
test_snapshot.py::test_find_validator_locates_pinned_checkout,the only tolerated failure.
OPENSPEC_TELEMETRY=0 openspec validate --all --strict: 100 passed, 1failed (101 items) — the one failure is
disposition-codexfactory-declared-renames, the only tolerated failure.test_dispose_reject_message_carries_the_validators_diagnosis— thereject branch carries the validator's detail.
test_dispose_unreachable_message_carries_detail_exactly_once— theunreachable branch (validator exit 2) carries detail exactly once, no
doubling.
test_validate_index_three_way_result_distinguishes_harness_from_findings— the runner maps exit 0 ->
True, exit 1 ->False, exit 2 ->None, with the exit code in the detail.test_dispose_refusal_message_bounds_the_validators_detail+test_bounded_detail_keeps_the_tail_and_normalises_whitespace— detailis bounded and whitespace-normalised.
test 1 (
test_dispose_reject_message_carries_the_validators_diagnosis)reds (
assert msg.startswith(...)fails because the discarded-detail bugis back), then restored the fix and confirmed it goes green again.
Refs #656
Asking for Brett's word before this merges — not requesting a merge here.
🤖 Generated with Claude Code
https://claude.ai/code/session_013zUwKfdNgAyNuUAUs3WTDU