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:
2026-08-28 03:08:45 +04:00
parent 61442d801c
commit 2417a39a1e
6 changed files with 86 additions and 6 deletions
+30
View File
@@ -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
}