Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased

### Fixed
- While `prodex ui` waited for an answer, its progress line was wider than the terminal, so it wrapped, and each redraw cleared only the wrapped row: found 2026-11-09 at 80 columns, the line for "prompt sent, waiting for answer (budget 5m)" was 102 columns, and a new row appeared every 250 ms until the answer came. The label is now cut to fit the terminal, counted in columns so Korean text fits as well, and the elapsed time, budget and "ctrl-c to stop" stay whole.
- `prodex tasks complete --artifact path=text` wrote the file before it looked at the task, so a completion that was then refused had already replaced it. Found 2026-11-09: completing a finished task again, or naming a task id that does not exist, overwrote that path's saved answer, and `prodex results artifact` for the task that owned it failed from then on with "Result artifact changed after finalization". Completing an open task with another task's artifact path replaced that task's answer and was accepted, and a path refused as not a result artifact was written anyway. The task and the paths are now checked first, a finished task's files are left alone, and a path that already holds other text is refused.
- The "Model hints" a consult saves with its answer (and the `model_hints:` line of `prodex pro browser status`) could carry the prompt instead of the model. They were read from the first model selector in the page and from every visible form, and a page can hold more than the composer: with a message open for editing ("Edit message"), each line of that message naming a word such as "Pro", "latest", "high" or "auto" was saved as a hint, and after a new chat the home page's hidden composer, still mounted ahead of the conversation's, supplied its own model. Text left typed in the composer was read the same way. Hints now come only from the visible composer outside the messages, without the text typed into it.
- Editing a file through the MCP repo tools (`repo_write_file_dry_run`, then `repo_write_file_apply`) reset its file mode. The new content is written to a new file that replaces the old one, and that file got the default mode: found 2026-11-09, an edited `build.sh` lost its executable bit (755 became 644), and `repo_stage_reviewed_paths` then staged `mode change 100755 => 100644`, so the commit broke the script. A file kept at 600 became readable by everyone. The replacement now takes the mode of the file it replaces.
Expand Down
11 changes: 9 additions & 2 deletions src/tui-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,19 @@ export async function runInteractiveConsult(io: TuiIo, deps: InteractiveDeps): P
tick += 1;
io.write(
CLEAR_LINE +
renderProgressBar({ elapsedMs: now() - startedAt, budgetMs, label, tick, width: Math.min(28, terminalWidth() - 52) })
renderProgressBar({
elapsedMs: now() - startedAt,
budgetMs,
label,
tick,
width: Math.min(28, terminalWidth() - 52),
columns: process.stdout.columns ?? 100
})
);
}, 250);
try {
const code = await deps.runConsult(args, (line) => {
label = progressLabel(line).slice(0, 60);
label = progressLabel(line);
});
clearInterval(timer);
io.write(CLEAR_LINE);
Expand Down
29 changes: 22 additions & 7 deletions src/tui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ export interface ProgressBarInput {
width?: number;
/** Advances the spinner; a still frame reads as a hang. */
tick?: number;
/** The terminal's width; the line is kept narrower than it. */
columns?: number;
}

const SPINNER = ["|", "/", "-", "\\"];
Expand All @@ -426,11 +428,24 @@ export function renderProgressBar(input: ProgressBarInput): string {
// Saying how to abort belongs on the waiting line itself: a consult can run
// for many minutes and the only other thing on screen is the bar.
const stop = "ctrl-c to stop";
if (!input.budgetMs || input.budgetMs <= 0) return `${spinner} ${input.label} ${elapsed} ${stop}`;
const width = Math.max(4, input.width ?? 28);
const ratio = input.elapsedMs / input.budgetMs;
const filled = Math.min(width, Math.round(Math.min(ratio, 1) * width));
const bar = `${"#".repeat(filled)}${"-".repeat(width - filled)}`;
const over = ratio > 1 ? " over budget" : "";
return `${spinner} [${bar}] ${elapsed} / ${formatElapsed(input.budgetMs)} ${input.label}${over} ${stop}`;
let compose: (label: string) => string;
if (!input.budgetMs || input.budgetMs <= 0) {
compose = (label) => `${spinner} ${label} ${elapsed} ${stop}`;
} else {
const width = Math.max(4, input.width ?? 28);
const ratio = input.elapsedMs / input.budgetMs;
const filled = Math.min(width, Math.round(Math.min(ratio, 1) * width));
const bar = `${"#".repeat(filled)}${"-".repeat(width - filled)}`;
const over = ratio > 1 ? " over budget" : "";
const budget = formatElapsed(input.budgetMs);
compose = (label) => `${spinner} [${bar}] ${elapsed} / ${budget} ${label}${over} ${stop}`;
}
const line = compose(input.label);
if (input.columns === undefined || displayWidth(line) < input.columns) return line;
// The line is redrawn in place, and one that wraps leaves a row behind on
// every redraw (found 2026-11-09: 102 columns at 80, a new row every 250
// ms). The label gives way first; a terminal too narrow even for the rest
// gets the line cut.
const room = input.columns - 1 - displayWidth(compose(""));
return truncateToWidth(compose(room > 0 ? truncateToWidth(input.label, room) : ""), input.columns - 1);
}
21 changes: 21 additions & 0 deletions tests/tui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { formatCommand } from "../src/tui-run.js";
const { effortChoices, SEND_KINDS } = await import("../src/tui-flow.js");
const {
consultArgsFromChoices,
displayWidth,
conversationThreadUrl,
moveCursor,
parseAttachmentLine,
Expand Down Expand Up @@ -507,6 +508,26 @@ describe("progress bar", () => {
expect(bar).toContain("over budget");
});

// Found 2026-11-09 at 80 columns: the frame for "prompt sent, waiting for
// answer (budget 5m)" was 102 columns wide, so it wrapped, and each redraw
// cleared only the wrapped row: a new line every 250 ms, ten in 2.5 s.
it("fits the terminal, cutting the label rather than the rest", () => {
const label = "prompt sent, waiting for answer (budget 5m)";
const bar = renderProgressBar({ elapsedMs: 0, budgetMs: 20 * 60_000, label, width: 28, columns: 80 });
expect(displayWidth(bar)).toBeLessThanOrEqual(79);
expect(bar).toContain("ctrl-c to stop");
expect(bar).toContain("0s / 20m");
expect(bar).toContain("prompt sent");
const korean = renderProgressBar({ elapsedMs: 0, label: "프롬프트를 보냈고 답변을 기다리는 중입니다 아주 길게", columns: 40 });
expect(displayWidth(korean)).toBeLessThanOrEqual(39);
const narrow = renderProgressBar({ elapsedMs: 0, budgetMs: 60_000, label, width: 4, columns: 30 });
expect(displayWidth(narrow)).toBeLessThanOrEqual(29);
});

it("leaves a line that fits as it is", () => {
expect(renderProgressBar({ elapsedMs: 0, label: "generating", columns: 200 })).toBe(renderProgressBar({ elapsedMs: 0, label: "generating" }));
});

it("degrades to an elapsed counter when there is no budget to measure against", () => {
const bar = renderProgressBar({ elapsedMs: 5_000, label: "deep research", width: 20 });
expect(bar).toContain("deep research");
Expand Down
Loading