inspect: treat equal parent and agent deadlines as timeout fallback · Entire
inspect: treat equal parent and agent deadlines as timeout fallback
9a77f5b→main·
dipree·4w ago·2 files·+20 added/-1 removed
When Wait loses the context. DeadlineExceeded sentinel and the fallback compares context deadlines, an inspector deadline equal to the parent deadline should still be classified as the inspector deadline firing. Use !After(parentDeadline) instead of strict Before, and add a regression for equal parent/agent deadlines.
Sessions
78c921d43c81 View transcript
?\ Checkout the hand off doc that I just added. Pi·Opus 4.8·1 step
Changes
- cmd/entire/cli/review
- Mrun.go +1/-1
- Mrun_test.go +19
76 unmodified lines
77
78
79
80
80
81
82
83
76 unmodified lines
return false
}
parentDeadline, parentHasDeadline := parentCtx.Deadline()
return !parentHasDeadline || agentDeadline.Before(parentDeadline)
return !parentHasDeadline || !agentDeadline.After(parentDeadline)
// timedOutError reports the per-inspector timeout as a user-facing error.
Mcmd/entire/cli/review/run.go +1/-1
581 unmodified lines
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
581 unmodified lines
}
}
func TestInspectorDeadlineFiredFallbackAllowsEqualParentDeadline(t *testing.T) {
t.Parallel()
deadline := time.Now().Add(20 * time.Millisecond)
parentCtx, cancelParent := context.WithDeadline(context.Background(), deadline)
defer cancelParent()
agentCtx, cancelAgent := context.WithDeadline(parentCtx, deadline)
defer cancelAgent()
select {
case <-agentCtx.Done():
case <-time.After(time.Second):
t.Fatal("agent context deadline did not fire")
}
waitErr := errors.New("agent failed: " + context.DeadlineExceeded.Error())
if !inspectorDeadlineFired(parentCtx, agentCtx, waitErr) {
t.Fatal("equal parent/agent deadlines should still classify as inspector deadline fallback")
}
}
func TestRun_InspectorTimeout(t *testing.T) {
t.Parallel()
rec := &stubSinkRecorder{}