W2.B.2 — comprehension_gate validates executor consensus#51
Draft
TimothyVang wants to merge 2 commits into
Draft
W2.B.2 — comprehension_gate validates executor consensus#51TimothyVang wants to merge 2 commits into
TimothyVang wants to merge 2 commits into
Conversation
added 2 commits
May 2, 2026 08:38
Adds tests/graph/test_comprehension_gate.py asserting the gate's behavior per BUILD_PLAN W2.B.2.a + ARCHITECTURE.md §2: - 4-way agreement on (parsed_positive_hypothesis_ids, parsed_negative_hypothesis_ids, parsed_success_criteria_hash) -> comprehension_consensus=True -> ROUTE_GATE_PASS; - mismatch -> clarify sub-state increments clarify_iterations; - after MAX_CLARIFY_ITERATIONS=2 rounds with persistent mismatch -> consensus=False, contested_hint set, ROUTE_GATE_REPLAN; - the contested_hint NAMES the disagreeing field (positive/negative/success_criteria_hash); - missing executor (3-of-4 echo) is treated as disagreement per ARCHITECTURE.md §1 empty-set rule; - empty echoes (all crashed) -> consensus=False, not silently True; - distinct-branch counting: <4 distinct branches blocks consensus. RED: ImportError on MAX_CLARIFY_ITERATIONS — the gate is currently a W2.B.1 stub returning a fixed True. GREEN follows.
Replace the W2.B.1 stub `comprehension_gate_node` with the real consensus + clarify sub-state per ARCHITECTURE.md §2. Behaviour: - Consensus check: all EXECUTOR_FANOUT_SIZE=4 distinct branches must echo identical values for every CONSENSUS_KEYS entry (parsed_positive_hypothesis_ids, parsed_negative_hypothesis_ids, parsed_success_criteria_hash). Lists are normalized to frozensets so emit-order doesn't break agreement. - On disagreement, the gate spends one clarify_iteration and re-prompts (within the same node — keeps total node count at 9). - After MAX_CLARIFY_ITERATIONS=2 rounds with persistent disagreement, the gate concedes: emits comprehension_consensus=False plus a contested_hint NAMING the disagreeing CONSENSUS_KEY so replan_node has a concrete remediation target. - Missing-executor (3-of-4 echo) and empty-echoes (all crashed) cases are treated as disagreement per ARCHITECTURE.md §1 empty-set rule. Pure consensus logic — no LLM, no microsandbox, no external service — so the test surface runs in CI without dependencies. Tests: 9 new comprehension_gate tests + 9 W2.B.1 topology tests = 18 PASS. Ruff: clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
comprehension_gate_nodewith the real consensus + clarify sub-state perdocs/ARCHITECTURE.md§2.vol_exec,hay_exec,pls_exec,mft_exec) must echo identical values for every consensus key (parsed_positive_hypothesis_ids,parsed_negative_hypothesis_ids,parsed_success_criteria_hash).MAX_CLARIFY_ITERATIONS=2rounds of persistent disagreement ->comprehension_consensus=False+contested_hintnaming the disagreeing key, route toreplan_node.test(graph): RED — comprehension_gate consensus tests [W2.B.2]→ GREENfeat(graph): comprehension_gate validates executor consensus [W2.B.2].Test plan
pytest tests/graph/test_comprehension_gate.py -v— 9 passed.pytest tests/graph/ -v— 18 passed (W2.B.1 + W2.B.2).ruff check— clean.Base
This PR targets
feat/W2.B.1-nine-node-topology. Once the W2.B.1 PR merges tomain, GitHub will rebase this PR's base accordingly.