fix(workflows): remove background widget run cap and expire quit cards - #2134
Merged
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two linked fixes to the workflows
BACKGROUNDwidget inpackages/workflows/src/tui/widget.ts.The panel truncated to four runs, and quit runs never expired. Those two facts compounded: a quit run has no
endedAt, soisActivereported it as active forever, it never becamerecentlyEnded, and it never dropped off. Quit cards accumulated without bound and, under the four-run cap, crowded live runs off the panel. The cap made the leak visible; the leak made the cap bite.Changes
Removed the display cap.
MAX_VISIBLE_RUNSand itsordered.slice(0, MAX_VISIBLE_RUNS)inselectDisplayRunsare deleted rather than raised, so every qualifying top-level run renders. There was no overflow or "+N more" affordance to clean up.Quit cards expire on the finished-run rule. Quit runs are resumable, so expiry must not make them look terminal — stamping
endedAtwould changeisActive, the counts, and every other consumer of run state. Instead the run is expired from the display against the existingRECENT_ENDED_WINDOW_MSwindow:isQuitRunmoves aboveisActive, andisActivenow excludes quit runs.recentlyQuitmeasures the window fromquitAt, a display-only timestamp added toRunSnapshotand set inrecordRunPausedwhen a run first enters quit state.pausedAtwas unsuitable: a run can be paused long before it is quit, which would expire the card early or immediately.quitAtis cleared on resume.quitExpiryTimestampfalls back topausedAtthenstartedAtso snapshots written before this change still expire rather than pinning forever.Repaint scheduling.
nextWidgetRefreshDelayMspreviously scheduled expiry repaints only for runs withendedAt. It now schedules the quit expiry the same way, so a quit card leaves the screen on time instead of lingering until some unrelated event repaints the widget.Badges match cards.
countRunsran over all top-level runs, so aN quitbadge would keep counting quit runs whose cards had already expired. Counts and theN runssubtitle now derive from the display set.Before / after, six runs of which two were quit
Before: the four newest runs rendered; the two oldest were silently dropped, and both quit cards stayed forever, so over time the quit pair permanently occupied half the panel while live runs went unseen. After: all six render; roughly 30 s after each quit, that card disappears on a scheduled repaint and the panel settles to the four live runs with a header reading
4 runs.Discoverability
An expired quit card does not make the run unreachable.
statusRunsand theworkflowstatusaction readsnap.runs, which this change does not touch, andresumableis untouched — asserted directly inquit card expires from the widget after the recent window while status stays resumable.Tests
Extended the existing suites; no parallel ones. Time-dependent assertions derive from the exported
RECENT_ENDED_WINDOW_MSrather than hardcoding 30000.test/unit/widget-rendering.test.tsmore than four concurrent runs all render without truncationquit card expires from the widget after the recent window while status stays resumableexpired quit runs do not contribute counts after their cards disappear— covers the wide and collapsed forms across the 80-column breakpointquit runs schedule the expiry repaint from quitAttest/unit/store.test.tsrecords quit time separately from paused time and clears it on resumeVerification
npm run checkandnpm run test:unitboth passed as pre-push hooks on this branch: 609 test files, 5686 passed, 2 skipped, zero failures.Known non-blocking observations
Recorded by review as P3 observations, not defects, and left unfixed to keep the change scoped:
publishLocalQuitcan run twice without an intervening resume: once withresumable: falsewhen the durable write is refused, then again on the retry that upgrades the record. TheenteringQuitguard is false on that second call, soquitAtkeeps the first quit's timestamp; if the retry lands more than one window later, the card does not reappear even though the run has just become resumable. The run stays discoverable throughstatusthroughout.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Greptile Summary
This change removes expired quit workflow runs from BACKGROUND widget cards, totals, and badges while preserving active workflow cards and their attention indicators.
The widget expiry boundary was exercised with an expired quit run alongside an active run awaiting input at wide and collapsed widths. The resulting widget showed one active card,
BACKGROUND 1 runin wide mode, and1 background · 1 ●in collapsed mode, with no stale quit card or quit count. The focused widget-rendering suite passed all 29 tests.Confidence Score: 5/5
What T-Rex did
Reviews (1): Last reviewed commit: "fix(workflows): align widget header coun..." | Re-trigger Greptile