@devries-cameron20 / t3code Mirror · read-only / commits / e13c0a9141
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 10:45 UTC

fix(server): keep provider update progress on the latest frame (#26823)

Co-authored-by: maria-rcks <maria@kuuro.net>

vivek committed Oct 31, 2026 at 02:51 UTC e13c0a914119c058894f1694fd5ef03987acd324
2 files changed +26 -1
apps/server/src/provider/providerMaintenanceRunner.test.ts
+22
@@ -609,6 +609,28 @@ describe("providerMaintenanceRunner", () => {
609 4_096,
610 );
611 assert.strictEqual(ProviderMaintenanceRunner.toProgressLine("x".repeat(300))?.length, 200);
612 +
613 + for (const redraw of [
614 + "\r",
615 + "\u001b[G",
616 + "\u001b[0G",
617 + "\u001b[1G",
618 + "\u001b[01G",
619 + "\u001b[999D",
620 + "\u001b[999D\u001b[J",
621 + ]) {
622 + const output = `first${redraw}second${redraw}last`;
623 + for (let boundary = 0; boundary <= output.length; boundary++) {
624 + let partialLine = "";
625 + for (const chunk of [output.slice(0, boundary), output.slice(boundary)]) {
626 + partialLine = ProviderMaintenanceRunner.splitOutputLines(partialLine, chunk).partialLine;
627 + }
628 + assert.strictEqual(ProviderMaintenanceRunner.toProgressLine(partialLine), "last");
629 + }
630 + }
631 + for (const incomplete of ["\u001b", "\u001b[", "\u001b[0", "\u001b[01"]) {
632 + assert.strictEqual(ProviderMaintenanceRunner.toProgressLine(`progress${incomplete}`), null);
633 + }
634 });
635
636 it.effect("aborts without running when the installation changed since the advisory", () => {
apps/server/src/provider/providerMaintenanceRunner.ts
+4 -1
@@ -204,11 +204,14 @@ export function splitOutputLines(
204 partialLine: string,
205 text: string,
206 ): { readonly lines: ReadonlyArray<string>; readonly partialLine: string } {
207 - const parts = (partialLine + text).split(/\r\n|\r|\n/);
207 + const parts = (partialLine + text).replace(/\x1b\[(?:0*1?G|999D)/g, "\r").split(/\r\n|\r|\n/);
208 return { partialLine: (parts.pop() ?? "").slice(-UPDATE_PARTIAL_LINE_MAX_LENGTH), lines: parts };
209 }
210
211 export function toProgressLine(line: string): string | null {
212 + if (/\x1b(?:\[[0-9]*)?$/.test(line)) {
213 + return null;
214 + }
215 const text = NodeUtil.stripVTControlCharacters(line).replace(/\s+/g, " ").trim();
216 if (text.length === 0) {
217 return null;