Add /graph G3: dynamic replan from DISCOVERED work items
Workers, verifiers, and serial node goals can now surface out-of-scope work
as line-anchored 'DISCOVERED: <text>' markers (fence-stripped and
placeholder-filtered — the templates' own examples are fenced so verbatim
echoes never parse; worker summaries embedded in verifier prompts get the
marker neutralized alongside NODE_RESULT/NODE_VERDICT). Discoveries queue on
the orchestration as persisted state and fold into the graph at dispatch
boundaries: a replanner subagent produces a strictly APPEND-ONLY appendix,
validated against the live graph (existing-id deps allowed; edges onto
gn-final rejected — they would cycle the moment the final-gating extension
lands; Blocks deps on Failed/Blocked nodes rejected as DeadDep so the
attempt-2 feedback loop repairs the artifact). Installing an appendix bumps
plan_version, freezes an immutable graph.baseline.v{N}.json next to the
prior versions, extends gn-final's gate (demoting a Ready final back to
Waiting), and recomputes readiness.
DiscoveredFrom edges are audit metadata, never scheduling gates: an origin
is always terminal at replan time, so gating on it is either a no-op or a
permanent wedge — and a failed node's discoveries are still real work.
Replanning is bounded by KIGI_GRAPH_REPLAN_CAP (default 3; 0 disables it
quietly): past the cap, after the final node has achieved, or on replan
failure, discoveries drain to history only — a working graph is never
paused for a failed enhancement pass, and it always converges. The budget
gate now precedes the replan boundary (a budget-dead graph keeps its
discoveries queued for a later --budget top-up instead of spending two
replanner runs first), and both planner runners delete stale artifacts
before spawning so a child that responds without writing can never get a
previous pass's file validated as its own output.
Tests: validate_replan unit coverage (existing-id resolution,
DiscoveredFrom dedup, collisions, dead deps vs dead origins, terminal-node
edges, combined-graph cycles), tracker appendix/regate/audit-edge tests,
and two e2e flows — discovery → replan → appended node runs to Achieved
with both baselines frozen, and cap-0 draining to history while the graph
still converges. kigi-shell 4935 lib tests green; workspace clippy clean.
This commit is contained in:
@@ -118,6 +118,18 @@ edges stay deterministic Rust. The harness appends a terminal
|
||||
`persist_graph_state` chokepoint (checkpoint ⇔ badge tick); old
|
||||
pagers degrade via `#[serde(other)] Unknown`. PTY scenarios:
|
||||
`graph_slash_presession{,_disabled}.yaml`.
|
||||
- G3: dynamic replan. `DISCOVERED: <text>` line markers (fence-stripped,
|
||||
placeholder-filtered) from workers/verifiers/the serial node's final
|
||||
text queue as `pending_discoveries`; at each dispatch boundary
|
||||
`maybe_replan_graph` (`acp_session_impl/graph_replan.rs`) runs a
|
||||
replanner subagent producing an APPEND-ONLY appendix
|
||||
(`validate_replan`: existing-id deps allowed, edges onto `gn-final`
|
||||
rejected — they would cycle after the final-gating extension),
|
||||
bumps `plan_version`, freezes `graph.baseline.v{N}.json`, and regates
|
||||
`gn-final` (Ready→Waiting). Bounded by `KIGI_GRAPH_REPLAN_CAP`
|
||||
(default 3, 0 = off); past the cap — and after the final node has
|
||||
achieved — discoveries drain to history only. Replan failure degrades
|
||||
(history + notice); it never pauses a working graph.
|
||||
|
||||
## Milestones (PRD §8.3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user