Autonomy reliability: A1 completion-loop + Slice 225 DW autarky + Slice 226 Iron Gate alignment - #69473
Open
drussell23 wants to merge 4 commits into
Open
Autonomy reliability: A1 completion-loop + Slice 225 DW autarky + Slice 226 Iron Gate alignment#69473drussell23 wants to merge 4 commits into
drussell23 wants to merge 4 commits into
Conversation
ROOT CAUSE (§51.11.34-ROADMAP A1): GOAL-001::file-00 emitted=1 done=0 forever. The multi_step orchestrator emits sub-goal envelopes and writes a PROPOSED row to the goal_decomposition completion ledger at EMIT time, but NOTHING ever wrote the terminal COMPLETED/FAILED transition back. done_count (which counts 'completed' rows) was therefore STRUCTURALLY pinned at 0 -- a roadmap sub-goal could dispatch and succeed any number of times (440 dispatches observed) and the roadmap would never advance. The cost/noise work was necessary but orthogonal; this was the real, non-economic autonomy blocker. FIX: wire the writeback into the orchestrator terminal hook (_slice12q_record_terminal) -- the same fail-soft, recorder-independent seam the Slice-134 episodic synapse fires from. When a terminal op carries roadmap sub-goal provenance via ctx.intake_evidence_json (sub_goal_id + parent_goal_id, stamped by the multi_step emit path), the terminal state is mapped to a CompletionStatus (applied -> COMPLETED; any other terminal -> FAILED) and appended to the canonical completion ledger via mark_sub_goal_status. The multi_step orchestrator reads it -> done_count advances -> roadmap progresses. Leverages existing architecture (no duplication): same hook as the episodic synapse, same mark_sub_goal_status writer the emit path already uses, same ledger path (verified byte-equal: planner ledger_path() == multi_step completion_ledger_path() == .jarvis/goal_decomposition_ledger.jsonl). Gated JARVIS_SUBGOAL_COMPLETION_WRITEBACK_ENABLED (default TRUE; OFF is byte-identical to the legacy severed loop). Fail-soft -- NEVER perturbs the FSM. Also adds module-level 'import json' to orchestrator.py (was only imported locally inside one function). Verified: 5 new TDD tests (RED->GREEN) + 286 regression tests green (episodic synapse, multi_step, goal_decomposition, orchestrator wiring, roadmap integration) + e2e loop-closure (terminal applied -> COMPLETED -> multi_step reads done) + production path-match assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> [integrity-verified: a4efed0dc5e5]
ROOT CAUSE (live soak GOAL-001::file-00): the DW primary is severed at the 30s
_PRIMARY_MAX_TIMEOUT_S reflex cap to hand off to the Claude fallback for the §5
cascade. But when Claude is out of credits its breaker trips (terminal_quota),
so severing DW just accelerates exhaustion into a DEAD lane: DW cut at 30s ->
Claude 400 'credit balance too low' -> EXHAUSTION -> generation_failed, no patch
ever produced. file-00's heavy generation never got enough DW runway.
FIX: _compute_primary_budget gains fallback_dead. When the Claude breaker is
OPEN/HALF_OPEN (read-only via the existing _claude_breaker_open predicate the
Slice 127 P2.1 IMMEDIATE reroute uses), DW gets the FULL remaining budget up to
a cost-safety ceiling (JARVIS_DW_AUTARKY_MAX_BUDGET_S, default 180s = the COMPLEX
window) instead of the 30s/75s cap. Mirrors the existing force_batch precedent
('Claude disabled -> no fallback to reserve -> full runway'). _call_primary
stamps fallback_dead from the breaker + emits a '⚡ DW AUTARKY ENGAGED' warning
when the budget expands (operator visibility).
Gated JARVIS_DW_AUTARKY_ENABLED default-TRUE; OFF (or breaker CLOSED) is the
byte-identical legacy cascade. No duplication: reuses _claude_breaker_open +
_envf_or_default + the force_batch pattern.
6 TDD tests RED->GREEN + 49 cascade-regression green. The 3 pre-existing
test_primary_budget_tier3_cap failures predate this branch (stale 30s
expectations the heavy-TTFT-scalar slice already superseded; verified via stash).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
[integrity-verified: fa6e16253a04]
ROOT CAUSE (live soak GOAL-001::file-00, this boot): a catch-22 between two
independent complexity-keyed decisions. DW healthy, generated a candidate in
10.5s ($0.00085) — but the Iron Gate rejected it for exploration_insufficient:
0/1 across BOTH GENERATE attempts -> generation_failed. NOT provider exhaustion
(that's the separate terminal_quota mode Slice 225 fixed).
The contradiction:
* doubleword_provider _generate_realtime: complexity in {trivial,simple} ->
skip the Venom tool loop (cost) -> model gets NO read_file/search_code.
* exploration_engine/orchestrator Iron Gate: non-trivial ops need >=1
exploration call ('read the target file').
A 'simple' op on a venom-eligible route is denied the tools, then rejected for
not using them. The intended escape (preloaded-prompt credit) silently fails
when the target is too large to inline (semantic_index.py = 3246 lines).
FIX (single source of truth, no duplication): two shared predicates in
exploration_engine.py — exploration_gate_demands_tools(complexity) and
compute_tool_loop_suppressed(...) — that BOTH the capability plane (provider
tool-skip) and the security plane (gate) consult, so they can't contradict. DW
_generate_realtime now calls compute_tool_loop_suppressed; when the gate will
demand exploration for a simple op on a venom-eligible route, the loop stays ON.
trivial stays gate-exempt; BACKGROUND/SPECULATIVE keep their route-based preload-
credit skip; L2 repair single-shot still skips. Emits a loud '⚡ CAPABILITY
ALIGNMENT' warning when the override engages (operator pref: escalate capability
anomalies, never silent re-route).
VERIFY-FIRST: the Prime/Claude provider skips tools route-based only (no
complexity skip) -> no catch-22 there -> fix is correctly DW-only (no duplicate
change). Gated JARVIS_GATE_ALIGNMENT_ENABLED default-TRUE; OFF = byte-identical
legacy simple-skip.
13 TDD tests RED->GREEN + 164 regression green (iron gate / terminal worker /
exploration / venom).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
[integrity-verified: 99dadf5fa700]
💡 PR Description Suggestions |
📊 PR Size AnalysisSize: 💡 This PR is large. Ensure it focuses on a single feature or fix. Review Checklist
|
🤖 CI/CD Pipeline ResultsStatus: success Pipeline Stages
|
| primary_budget, _PRIMARY_MAX_TIMEOUT_S, | ||
| getattr(context, "provider_route", "?"), | ||
| getattr(context, "op_id", "?")[:16], | ||
| model_id or "(unspecified)", |
| """ | ||
| from __future__ import annotations | ||
|
|
||
| import importlib |
| """ | ||
| from __future__ import annotations | ||
|
|
||
| import os |
| if line: | ||
| try: | ||
| out.append(json.loads(line)) | ||
| except Exception: |
…ATCH race) ROOT CAUSE (live soak GOAL-001::file-00, layer 3): the proactive transport hedge races RT (which runs the Venom tool loop -> exploration) against BATCH (single completion, NO tool loop, zero exploration). hedged_race returns the FIRST success, so when the batch arm finishes first its un-explored candidate reaches the Iron Gate -> exploration_insufficient: 0/1 -> generation_failed. The performance layer was silently defeating the security floor. (Verify-first confirmed list_dir/glob_files ARE credited by the active gate set orchestrator.py:4810, so the fix is purely the race, NOT a deep-exploration heuristic — that would have regressed.) FIX: hedged_race gains prefer_fast. When set, a winning BATCH result is held in a speculative buffer and the race keeps waiting for the RT arm; batch is used ONLY if RT ruptures/fails/yields no success — so the hedge's entire reason for being (rupture protection) is fully preserved; batch just can't PRE-EMPT an RT arm that's actively exploring. In prefer_fast mode the done-set is processed fast-first so a co-completed RT success wins over a stable success. The caller derives prefer_fast from the SAME Slice-226 predicate exploration_gate_demands_tools(complexity) — one source of truth now spans the capability plane (tools available), security plane (exploration required), AND concurrency plane (which arm may claim the slot). Emits a loud '⚡ HEDGE GOVERNOR' warning when it engages. Master JARVIS_HEDGE_GATE_AWARE_ENABLED default-TRUE; OFF = byte-identical legacy FIRST_COMPLETED. Phase-2 trace verified hedged_race is pure asyncio tasks + asyncio.wait — no locks, no deadlock risk. 9 TDD tests RED->GREEN + 59 hedge regression green (slices 188/189/190/192/194). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> [integrity-verified: 257827f304cb]
🤖 CI/CD Pipeline ResultsStatus: success Pipeline Stages
|
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.
Banks three validated, independently-valuable fixes from the GOAL-001::file-00 debugging arc. Each closes a distinct, structural autonomy blocker; all are gated default-TRUE with byte-identical legacy fallback.
A1 — close the severed sub-goal completion feedback loop (
bf3dd4ac5d)The multi_step orchestrator wrote only
PROPOSEDto the goal_decomposition completion ledger; nothing ever wroteCOMPLETED/FAILEDback when a dispatched op reached terminal, sodone_countwas structurally pinned at 0 — the roadmap could never advance. Fix: a fail-soft writeback at the orchestrator terminal hook (_slice12q_record_terminal, same seam as the Slice-134 episodic synapse) keyed bysub_goal_id. GateJARVIS_SUBGOAL_COMPLETION_WRITEBACK_ENABLED. Live-proven: terminal → COMPLETED/FAILED → multi_step reads it.Slice 225 — Sovereign DW Autarky (
c157707362)DW primary was severed at the 30s reflex cap to hand off to Claude — but when Claude is out of credits (
terminal_quota) that sever just accelerates exhaustion into a dead lane. Fix:_compute_primary_budget(fallback_dead=)grants DW the full budget (≤180s) when_claude_breaker_open(). Mirrors the existingforce_batchprecedent. GateJARVIS_DW_AUTARKY_ENABLED; emits⚡ DW AUTARKY ENGAGED. Live-validated: 2 engagements granting DW 143.9s.Slice 226 — Iron Gate / DW capability alignment (
64ea63e202)A catch-22: DW skipped the Venom tool loop for
simpleops (cost), but the Iron Gate required ≥1 exploration call for every non-trivial op — so a simple op was denied tools, then rejected for not using them. Fix: two shared predicates inexploration_engine.py(exploration_gate_demands_tools+compute_tool_loop_suppressed) that both the provider (capability plane) and the gate (security plane) consult, so they can't contradict. GateJARVIS_GATE_ALIGNMENT_ENABLED; emits⚡ CAPABILITY ALIGNMENT. Verify-first kept it DW-only (Prime provider skips route-based only, no catch-22).Tests
24 new TDD tests (5 + 6 + 13) + regression green (286 for A1, 49 cascade for 225, 164 iron-gate/exploration for 226).
🤖 Generated with Claude Code
Summary by cubic
Fixes four autonomy blockers: restores roadmap sub-goal progress, prevents dead-lane fallback stalls, keeps tools available when the gate demands exploration, and stops the batch hedge from pre-empting the exploring arm. Default-on, safely gated, with legacy behavior when disabled.
JARVIS_SUBGOAL_COMPLETION_WRITEBACK_ENABLED.JARVIS_DW_AUTARKY_MAX_BUDGET_S) instead of the 30s/75s cap; gateJARVIS_DW_AUTARKY_ENABLED(emits “⚡ DW AUTARKY ENGAGED”).exploration_engine.pykeep the Venom tool loop available when the gate demands exploration for non-trivial ops; DW-only, BACKGROUND routes unchanged; gateJARVIS_GATE_ALIGNMENT_ENABLED(emits “⚡ CAPABILITY ALIGNMENT”).hedged_raceaddsprefer_fastso a faster batch result won’t pre-empt the RT/tool-loop arm when exploration is required; rupture fallback preserved; gateJARVIS_HEDGE_GATE_AWARE_ENABLED(emits “⚡ HEDGE GOVERNOR”).Written for commit 4123d1e. Summary will update on new commits.