inspect: show the final judge phase in the TUI · Entire
inspect: show the final judge phase in the TUI
215ac8a→main· dipree·1mo ago·10 files·+319 added/-73 removed
Keep the dashboard alive after inspectors finish when profile-native auto synthesis is enabled. The judge now runs while the TUI shows a final phase row (for example 'judge: claude-code' with a judging spinner), then the TUI exits automatically and flushes the buffered dump/verdict output.
TTY auto-synthesis now buffers post-run stdout (DumpSink + SynthesisSink) while the alt-screen is active and flushes it after PostRunComplete, so the judge can update the TUI without corrupting terminal output. Legacy prompted synthesis still exits the TUI before prompting.
Also clarifies the Sink contract: AgentEvent must not block, but serialized RunFinished post-run work is allowed.
Sessions
36a94a62d738View transcript
?\ Checkout the hand off doc that I just added.Pi·Opus 4.8·2 steps
Changes
10
cmd/entire/cli/review
Mcmd.go+63/-4
Mcmd_test.go+46/-11
Mexport_test.go+4
Apostrun_sinks.go+36
Msynthesis_sink.go+11
Mtui_model.go+64/-8
Mtui_model_test.go+39/-16
Mtui_sink.go+44/-13
Mtui_sink_test.go+8/-19
types
Msink.go+4/-2
7 unmodified lines
8
9
10
11
12
13
14
1260 unmodified lines
1275
1276
1277
1277
1278
1279
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1 unmodified line
1289
1290
1291
1287
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1340
1341
1342
13 unmodified lines
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
7 unmodified lines
package review
import (
"bytes"
"context"
"errors"
"fmt"
1260 unmodified lines
// Non-TTY: [DumpSink, SynthesisSink?] — narrative dump plus profile-native
// final report when autoSynthesis is enabled.
// TTY: [TUISink, DumpSink, SynthesisSink?] — TUI owns the live dashboard;
// DumpSink renders the post-run narrative; SynthesisSink renders the final
// report after the TUI exits.
// TTY + profile-native auto synthesis: [TUISink, buffered DumpSink,\
// buffered SynthesisSink, TUI finalizer, buffer flusher]. The TUI stays up
// during the judge phase and post-run stdout is flushed after the alt-screen
// exits.
// TTY without auto synthesis: [TUISink, TUI finalizer, DumpSink,\
// SynthesisSink?]. Legacy prompted synthesis runs after the TUI exits so the
// prompt can safely use stdin/stdout.
// Prompted legacy synthesis is still only appended when canPrompt is true.
// Profile-native auto synthesis does not need stdin, so it is available in
1 unmodified line
func composeMultiAgentSinks(in multiAgentSinkInputs) []reviewtypes.Sink {
sinks := []reviewtypes.Sink{}
if in.isTTY {
sinks = append(sinks, NewTUISink(in.agentNames, in.cancelRun, in.out, os.Stdin))
tui := NewTUISink(in.agentNames, in.cancelRun, in.out, os.Stdin)
sinks = append(sinks, tui)
if in.autoSynthesis && in.synthesisProvider != nil {
postRunOut := &bytes.Buffer{}
sinks = append(sinks, DumpSink{W: postRunOut})
sinks = append(sinks, SynthesisSink{
Provider: in.synthesisProvider,
Writer: postRunOut,
InputTTY: in.canPrompt,
PromptYN: in.promptYN,
PerRunPrompt: in.perRunPrompt,
ProfileName: in.profileName,
Task: in.task,
MasterName: in.masterName,
Auto: true,
RunContext: in.runContext,
OnResult: in.onSynthesisResult,
OnStart: func() {
tui.FinalPhaseStarted(finalJudgeDisplayName(in.masterName))
},
OnComplete: func(err error) {
tui.FinalPhaseFinished(err)
},
})
sinks = append(sinks, tuiPostRunCompleteSink{tui: tui})
sinks = append(sinks, bufferFlushSink{buf: postRunOut, out: in.out})
return sinks
}
sinks = append(sinks, tuiPostRunCompleteSink{tui: tui})
sinks = append(sinks, DumpSink{W: in.out})
if in.synthesisProvider != nil && in.canPrompt {
sinks = append(sinks, SynthesisSink{
13 unmodified lines
return sinks
}
func finalJudgeDisplayName(masterName string) string {
masterName = strings.TrimSpace(masterName)
if masterName == "" {
return "final judge"
}
return "judge: " + masterName
}
// maybePostReviewToTrail delivers the final review output to the branch's trail
// when the profile selects the "trail" destination. It never fails the run:
// the review already happened, so a posting error (or a missing hook) is