Model stages: outcome-first output shape and one in-session outcome repair

The prompt now says output.md must start with # outcome and the outcome
word alone on the next line, then # handoff, then detail. Runs 241/243
followed the old "start with # handoff" wording and dropped the outcome.

When a completed turn lacks a valid outcome, the OpenCode/agent and Pi
clients send one short follow-up in the same session asking only for the
outcome line. An outcome-only reply goes at the top of the original report;
a still-invalid reply fails with the same validation error as before. The
follow-up's tokens accrue to the session usage. No outcome is inferred.

Missing tools/evidence now name blocked when declared, else error. The
parser tolerates a trailing period on the outcome word.
This commit is contained in:
2026-11-04 17:20:58 +00:00
parent b5927505cc
commit 88dfc051e5
13 changed files with 457 additions and 16 deletions
+6
View File
@@ -241,6 +241,12 @@ func (c *AgentClient) Generate(ctx context.Context, config ModelConfig, prompt s
if len(data) > 0 {
c.Transcript = string(data)
}
if err == nil {
text, data, err = c.repairOutput(ctx, config, c.SessionID, text)
if len(data) > 0 {
c.Transcript = string(data)
}
}
// Budgeted stages already settle through the single watch.finish read. For an
// unbudgeted V2 stage the watch was never started, so record best-effort final
// session usage from exactly one bounded aggregate read; missing/invalid usage