fix(weak-model-gates): stop three gates from stalling weak stage models
Diagnosed from session 508c8d58 (frontend freestyle run, WorkflowFailed): three independent weak-model-hostile gates, none a model-capability problem. - shell: split a collapsed single-string command line (["npm create vite …"]) into tokens instead of rejecting it as a "collapsed array". The model reliably re-emits this shape; rejecting looped bootstrap_frontend until stage_loop_break. JSON-escape mangles (quotes/commas in argv[0]) stay rejected. - recovery: a stage_loop_break route now gets a "Stuck-loop ticket", not the "Contract arbitration ticket". The arbitration prompt told the model to read and reconcile "the files named below" — but a tool-syntax loop names zero files, sending the recovery agent grepping the repo for 40+ turns until the repair ladder exhausted. - plan lint: H3 (unreferenced_prompt_artifact) demoted from hard failure to soft finding, and seeds excluded from it. It word-matches artifact IDs in free prose and cannot tell a forgotten dep from a descriptive mention, so as a hard gate it burned architect retries on words it couldn't reword away (analysis/dod). Hard tier is now deterministic graph facts only (H1/H2). Tests: ShellToolTest, PlanLinterTest, RecoveryRoutingTest green; detekt clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Ly2mMnt9TCZbvhcC1JfuV
This commit is contained in:
+16
-2
@@ -82,10 +82,24 @@ fun buildRecoveryTicketEntry(events: List<StoredEvent>, stageId: StageId): Conte
|
||||
val ticket = events
|
||||
.mapNotNull { it.payload as? FailureTicketOpenedEvent }
|
||||
.lastOrNull { it.routeTo == stageId } ?: return null
|
||||
val content = if (ticket.escalated) {
|
||||
val intent = events.mapNotNull { it.payload as? InitialIntentEvent }.lastOrNull()?.intent
|
||||
val content = if (ticket.gate == STAGE_LOOP_BREAK_GATE) {
|
||||
// A stuck-loop route is NOT a cross-file contract dispute — the gate output names no files, it
|
||||
// is the SAME action (often a malformed tool call) repeated until the loop-break tripped. The
|
||||
// arbitration prompt (read/reconcile the named files) sends the model hunting for files that
|
||||
// don't exist. Tell it plainly: the last action is futile, take a materially different one.
|
||||
"## Stuck-loop ticket\n" +
|
||||
"Stage '${ticket.stageId.value}' repeated the SAME failing action until it tripped the " +
|
||||
"'${ticket.gate}' gate. Retrying that action again is futile — it will fail identically. The " +
|
||||
"exact failure is below; it is a single stuck step, NOT a dispute between files, so do not go " +
|
||||
"looking for files to reconcile. If it is a malformed tool call, fix the call's shape and " +
|
||||
"continue the task; otherwise take a materially different route to the same goal. Serve the " +
|
||||
"intent" + (intent?.let { " below" } ?: "") + ", then control returns to verification." +
|
||||
(intent?.let { "\n### Intent (authoritative)\n$it" } ?: "") +
|
||||
"\n### Gate output (the failing action)\n${ticket.evidence}"
|
||||
} else if (ticket.escalated) {
|
||||
// Tier 2: the owner loop couldn't settle it — a cross-file contract dispute. The arbiter holds
|
||||
// the intent and reconciles ALL sides in one pass.
|
||||
val intent = events.mapNotNull { it.payload as? InitialIntentEvent }.lastOrNull()?.intent
|
||||
"## Contract arbitration ticket\n" +
|
||||
"Stage '${ticket.stageId.value}' keeps failing the '${ticket.gate}' gate even after the " +
|
||||
"file owners repaired their own layers — so this is NOT a bug in one file. The files named " +
|
||||
|
||||
Reference in New Issue
Block a user