Skip to content

Commit af2178c

Browse files
PR Batch Testerclaude
andcommitted
fix(settings): show unfinished progress frames and cap the buffered line
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent aa66887 commit af2178c

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎apps/server/src/provider/providerMaintenanceRunner.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ describe("providerMaintenanceRunner", () => {
443443
layerNonWindowsPlatform,
444444
layerLatestVersionHttpClient("0.0.0"),
445445
layerMockSpawner(() => ({
446-
stdout: "Checking for updates\nDownloading 2.1.293\n\u001b[32m 40%\u001b[0m\r 80%\r",
446+
stdout: "Checking for updates\nDownloading 2.1.293\n\u001b[32m 40%\u001b[0m\r 80%",
447447
exitCode: Deferred.await(exited),
448448
})),
449449
),
@@ -461,6 +461,10 @@ describe("providerMaintenanceRunner", () => {
461461
"==> Pouring",
462462
);
463463
assert.strictEqual(ProviderMaintenanceRunner.toProgressLine(" \t "), null);
464+
assert.strictEqual(
465+
ProviderMaintenanceRunner.splitOutputLines("x".repeat(5_000), "y").partialLine.length,
466+
4_096,
467+
);
464468
assert.strictEqual(ProviderMaintenanceRunner.toProgressLine("x".repeat(300))?.length, 200);
465469
});
466470

‎apps/server/src/provider/providerMaintenanceRunner.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const UPDATE_OUTPUT_MAX_BYTES = 10_000;
4545
// installer's output is sampled rather than forwarded line by line.
4646
const UPDATE_PROGRESS_INTERVAL = Duration.seconds(1);
4747
const UPDATE_PROGRESS_MAX_LENGTH = 200;
48+
// An installer may write for minutes without a line ending; only its tail matters.
49+
const UPDATE_PARTIAL_LINE_MAX_LENGTH = 4_096;
4850

4951
export interface ProviderMaintenanceCommandResult {
5052
readonly stdout: string;
@@ -138,7 +140,11 @@ const runProviderMaintenanceCommandWithSpawner = Effect.fn("ProviderMaintenanceR
138140
Stream.tap((chunk) => {
139141
const split = splitOutputLines(partialLine, decoder.decode(chunk, { stream: true }));
140142
partialLine = split.partialLine;
141-
const line = split.lines.map(toProgressLine).findLast((value) => value !== null);
143+
// A progress bar that redraws with a leading `\r` keeps its newest
144+
// frame unterminated, so that frame is the latest status.
145+
const line =
146+
toProgressLine(split.partialLine) ??
147+
split.lines.map(toProgressLine).findLast((value) => value !== null);
142148
return line ? Ref.set(pendingProgress, line) : Effect.void;
143149
}),
144150
);
@@ -208,7 +214,7 @@ export function splitOutputLines(
208214
text: string,
209215
): { readonly lines: ReadonlyArray<string>; readonly partialLine: string } {
210216
const parts = (partialLine + text).split(/\r\n|\r|\n/);
211-
return { partialLine: parts.pop() ?? "", lines: parts };
217+
return { partialLine: (parts.pop() ?? "").slice(-UPDATE_PARTIAL_LINE_MAX_LENGTH), lines: parts };
212218
}
213219

214220
/** Turn one raw output line into a short status message, or null if it has no text. */

‎apps/web/src/components/settings/ProviderInstanceCard.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@ export function ProviderInstanceCard({
944944
<ProviderStatusDiagnostic detail={statusDiagnostic}>
945945
<span
946946
tabIndex={statusDiagnostic ? 0 : undefined}
947+
aria-live="polite"
947948
className="pointer-events-auto line-clamp-2 [overflow-wrap:anywhere]"
948949
>
949950
{updateProgress ? (

0 commit comments

Comments
 (0)