• Implements docs/done/work-graph-node-execution-deblackbox-requirements.md
    end to end. The three documented call sites (e2e_pipeline.py::
    _check_prd_consistency, work_graph_orchestrate.py::_llm_judgment_verify_fn,
    work_graph_orchestrate.py::_make_run_fn) all used to render a one-off
    Dynamic Workflow .js script and run it via `claude -p 'Run /<name>...'`
    purely to get "agent identity + schema-shaped output" -- a workaround for
    --json-schema silently conflicting with --agent (05 §5.4.1.1). That
    workaround was never actually necessary: work_graph_plan.py::
    plan_work_graph() solved the identical problem from day one with a flat
    `claude --agent ... -p ...` call + ```json-fence extraction from free text,
    already validated in production.
    
    New org_node_trigger.trigger_org_node_structured() unifies all three call
    sites onto that same flat-call approach. extract_json_payload() generalizes
    work_graph_plan.py's fence-extraction algorithm; _extract_graph_manifest is
    now a thin wrapper over it. Two more call sites not in the original design
    doc (written before they existed) were found and migrated too:
    _run_reflection_perspective and _fix_skill_for_node (Phase 2a's
    Reflection-review/Fix-Skill). work_graph_fork.py needed no changes -- it
    only reaches _make_run_fn indirectly via run_graph(), so it benefits
    automatically.
    
    FR-4's real-agent verification (RUN_REAL_AGENT_E2E=1, mandatory, not
    optional -- src/test_org_node_trigger_e2e.py) confirmed persona loading,
    --model override, and JSON-fence extraction all work against a real model.
    
    write_workflow_script/execute_work_graph/execute_work_graph_with_usage_
    limit_retry are confirmed to have no remaining production callers;
    docstrings mark them historical, the file is kept (not deleted).
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    bboonnee authored
     
    Browse File »

  • Implements docs/todo/verifier-fan-out-jury-design.md. root_cause_trace.py:
    _tally_perspectives() extracts the existing >=2/3 rule out of
    judge_root_cause so the closure-based version and the new
    judge_root_cause_via_work_graph() share one implementation, not two that
    could drift apart. The fan-in vote stays plain Python (zero_token
    aggregation per the design-dynamic-work-graph Skill's own edge_type
    distinction) rather than becoming a fourth Work Node -- no reason to pay
    for an Agent call just to count votes.
    
    judge_root_cause_via_work_graph(): each perspective becomes an
    independent Work Node with real schema-constrained structured output
    ({"category", "detail"} directly), not real_validator_perspective's
    manual "CATEGORY:"/"DETAIL:" text-line parsing. judge_root_cause /
    real_validator_perspective are kept, not removed -- documented as the
    lightweight fallback for scenarios that don't need worktree/Work Graph
    overhead.
    
    org_level_loop.run_fix_loop (the one real production caller) now calls
    the Work Graph version; the fixer/verify calls are unchanged flat
    trigger_org_node calls.
    
    Real bug found and fixed along the way: this is the first production code
    path that actually triggers a run_graph() multi-node CONCURRENT layer
    (every graph_manifest before F was single-node or a strict serial chain,
    so G's ThreadPoolExecutor path had never really run in production).
    scheduler.py::run_goal_to_completion and
    task_execution.py::start_task_execution_in_background both created their
    conn without check_same_thread=False -- fixed both, since their conn can
    now reach run_graph()'s worker threads via run_fix_loop.
    
    Test boundary migrated in test_org_level_loop.py/test_scheduler.py: the
    3 perspective calls are now mocked at work_graph_execute.write_workflow_script/
    execute_work_graph (matching test_work_graph_orchestrate.py's pattern)
    instead of org_node_trigger.trigger_org_node. New tests cover: three real
    independent Work Node executions, judgment-rule equivalence with the
    closure version, clean per-node input_payload, and concurrent wall-clock
    overlap across the three perspectives.
    
    Full src suite (586 tests) + supervisor suite (125 tests) pass with zero
    regressions.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    bboonnee authored
     
    Browse File »

  • judge_root_cause(): runs 3 perspective_fns (correctness/requirement-
    completeness/skill-defect, 04-P §4.3), requires >=2/3 agreement on a
    category or raises InconclusiveEscalateError with all raw judgments
    attached (REQ-04's failure case). trace_root_cause_test_failed() creates a
    brand-new bug_record on agreement; trace_root_cause_human_reported()
    field-completes an existing one instead (04-P's explicit distinction
    between the two origins, not a new record either way).
    
    c_bug_record_create (bug_record.py): validates root_cause_category against
    {planning, coder, skill_defect} -- core_engine deliberately excluded,
    matching U-001's schema CHECK constraint (PH5/U-034 scope). Known,
    deliberately-unenforced gap noted rather than guessed at: 03-C §3.10's
    "skill_defect requires creating a skill_iteration_suggestion" constraint
    can't be satisfied yet (skill_iteration.before/after_git_commit_sha are
    NOT NULL but don't exist until a real skill rewrite happens in U-018) --
    REQ-04's three cases never exercise skill_defect, so nothing here needs it
    resolved yet.
    
    real_validator_perspective() builds a real claude --agent validator call
    framed from one of the three perspectives, parsing a CATEGORY:/DETAIL:
    response format.
    
    Also fixes a real diagnostic bug found investigating an unrelated failure:
    org_node_trigger.py/work_graph_plan.py/work_graph_execute.py's nonzero-exit
    error paths only included stderr in the raised exception, silently
    dropping stdout -- which is where a real `claude` failure's actual detail
    often lives. A real Coder call failed with exit 1 and empty stderr,
    giving zero diagnostic signal; fixed to include both streams (truncated).
    
    18 new mocked stdlib unittest cases + 1 gated real test (3 real Validator
    perspective calls judging a deliberately-injected wall-collision bug,
    expecting agreement on root_cause_category=coder). 146 total mocked tests
    across U-001-015, all passing.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    bboonnee authored
     
    Browse File »