Stop counting harness chrome as agent progress, and shorten the lease
F41, live on run 5: the review agent produced nothing after 02:12 and the 02:46 renewal was granted anyway. The progress digest covered Claude Code's status footer, and one of its fields ticked inside the window. Reproduced the worker's stored progress_sha byte for byte from the live pane, so the branch taken was progress != ProgressSHA, not IsBusy and not an empty baseline. PaneProgress now cuts from the editor's lower rule and trims the spinner summary and version notice above it. AgentStatus still reads the raw capture, so the busy markers living in the footer are unaffected. Lease TTL moves to 5 minutes, from domain.LeaseTTL, with renewal at half of it. Reclaiming a stalled pane happens only at expiry, and 30 minutes per window made run 5's stall unbounded in practice. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVbaKucEYBjMqVeUgJUsc1
This commit is contained in:
@@ -374,6 +374,11 @@ func (b *TmuxBackend) LaunchTransport(harness string) LaunchTransport {
|
||||
// what is still unsubmitted; see inputState.
|
||||
var promptLine = regexp.MustCompile(`(?m)^[ \t]*[>❯][ \t]*(.*)$`)
|
||||
|
||||
// chromeLine matches the status lines Claude Code redraws on its own schedule:
|
||||
// the spinner summary with its elapsed timer, and the version notice. Neither
|
||||
// is the agent writing anything, and both change while a pane sits idle.
|
||||
var chromeLine = regexp.MustCompile(`^[ \t]*(?:[\x{273B}\x{273D}\x{2733}\x{2722}\x{00B7}*]|current:[ \t])`)
|
||||
|
||||
// separatorRow matches the rule Claude Code draws above and below its editor.
|
||||
var separatorRow = regexp.MustCompile(`^[\s─━┄┅┈┉-]+$`)
|
||||
|
||||
@@ -453,6 +458,31 @@ func (b *TmuxBackend) PaneProgress(ctx context.Context, s Session) (string, erro
|
||||
}
|
||||
kept = append(kept, line)
|
||||
}
|
||||
// Everything below the editor's lower rule is harness chrome: the model
|
||||
// name, the rolling usage percentage, the context counter, the update
|
||||
// banner. F41, live on run 5: the agent produced nothing after 02:12 and
|
||||
// the 02:46 renewal was granted anyway, because one of those fields ticked
|
||||
// inside the window. Progress means output the agent wrote, so the tail
|
||||
// after the last rule is dropped. AgentStatus reads the raw capture, so
|
||||
// the busy markers that live down there are unaffected.
|
||||
// ponytail: last rule wins, the editor is always the bottom-most one.
|
||||
for i := len(kept) - 1; i >= 0; i-- {
|
||||
if separatorRow.MatchString(kept[i]) {
|
||||
kept = kept[:i]
|
||||
break
|
||||
}
|
||||
}
|
||||
// The spinner summary and the version notice render above the editor, so
|
||||
// the rule cut alone leaves them in. On run 5 the notice was the one that
|
||||
// moved: "current: 2.1.247 - latest: 2.1.248" gained "Update installed".
|
||||
for len(kept) > 0 {
|
||||
last := kept[len(kept)-1]
|
||||
if strings.TrimSpace(last) == "" || separatorRow.MatchString(last) || chromeLine.MatchString(last) {
|
||||
kept = kept[:len(kept)-1]
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
return strings.Join(kept, "\n"), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -491,3 +491,42 @@ exit 0
|
||||
t.Fatalf("err=%v, want ErrPromptNotSubmitted", err)
|
||||
}
|
||||
}
|
||||
|
||||
// F41, live on run 5: the review agent produced nothing after 02:12 and the
|
||||
// 02:46 renewal was granted, because the digest covered the harness footer and
|
||||
// one of its fields ticked. The layout below is the real pane, with the usage
|
||||
// percentage and the version banner moved on.
|
||||
func TestPaneProgressIgnoresHarnessFooter(t *testing.T) {
|
||||
body := "────\n reviewed the diff, no blocking findings\n────\n❯ \n"
|
||||
footer := func(pct, banner string) string {
|
||||
return body +
|
||||
" [Opus 5] 📁 06G4A4F0TFXKZHJE48N05XN1HG | 7d: " + pct + "\n" +
|
||||
" cf474986 - Orchestra launch instructions | 57.9…\n" +
|
||||
" ⏵⏵ auto mode on (shift+tab to cycle) · " + banner + "\n"
|
||||
}
|
||||
before := paneTmux(t, footer("51%", "current: 2.1.247 · latest: 2.1.248"), 3)
|
||||
after := paneTmux(t, footer("52%", "✔ Update installed · Restart to update"), 3)
|
||||
a, err := before.PaneProgress(context.Background(), Session{PaneID: "s:1.0"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := after.PaneProgress(context.Background(), Session{PaneID: "s:1.0"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if a != b {
|
||||
t.Fatalf("footer churn changed the progress digest:\n%q\n%q", a, b)
|
||||
}
|
||||
if !strings.Contains(a, "reviewed the diff") {
|
||||
t.Fatalf("progress digest dropped harness output: %q", a)
|
||||
}
|
||||
worked := paneTmux(t, "────\n reviewed the diff, wrote .orchestra/done\n────\n❯ \n"+
|
||||
" [Opus 5] 📁 06G4A4F0TFXKZHJE48N05XN1HG | 7d: 51%\n", 3)
|
||||
c, err := worked.PaneProgress(context.Background(), Session{PaneID: "s:1.0"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if c == a {
|
||||
t.Fatal("real agent output left the progress digest unchanged")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user