Skip to content

Commit 4fb94f5

Browse files
committed
fix: restore TUI opt-in defaults and align capped label fixtures
Keep fullscreen env-gated (=== '1'), restore final-label caps to 40/80, and keep full markCompleted fixture strings while asserting the capped visible prefixes. Fix session export web_log oversize fixture to exceed 256 KiB in UTF-8 bytes.
1 parent f06a59d commit 4fb94f5

5 files changed

Lines changed: 17 additions & 18 deletions

File tree

‎apps/pythinker-code/src/tui/components/messages/agent-dynamic-workflow-progress.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type AgentDynamicWorkflowProgressEstimate = {
2121
readonly displayTicks: number;
2222
};
2323

24-
const MAX_FINAL_OUTPUT_LABEL_CHARS = 80;
25-
const MAX_FINAL_OUTPUT_LABEL_CODE_UNITS = 160;
24+
const MAX_FINAL_OUTPUT_LABEL_CHARS = 40;
25+
const MAX_FINAL_OUTPUT_LABEL_CODE_UNITS = 80;
2626

2727

2828
const TEXT_CELL_PREFERRED_WIDTH = 30;
@@ -1758,8 +1758,7 @@ function renderCellLabel(
17581758

17591759
function runningCellLabelText(member: AgentDynamicWorkflowMember, latestLine: string): string {
17601760
const itemText = collapseWhitespace(member.itemText);
1761-
const line = latestLine ?? '';
1762-
const text = line.length > 0 ? line : itemText;
1761+
const text = latestLine.length > 0 ? latestLine : itemText;
17631762
return text.length > 0 ? text : PHASE_LABELS.running;
17641763
}
17651764

‎apps/pythinker-code/src/tui/tui-state.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function createTUIState(options: PythinkerTUIOptions): TUIState {
9797
setMarkdownRenderLatex(initialAppState.renderLatex ?? DEFAULT_TUI_CONFIG.renderLatex ?? true);
9898
setMarkdownMermaidMode(initialAppState.markdown?.mermaid ?? DEFAULT_MARKDOWN_CONFIG.mermaid);
9999
// Fullscreen is experimental and env-gated for now: PYTHINKER_CODE_TUI_FULL_SCREEN=1.
100-
const fullscreen = process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] !== '0';
100+
const fullscreen = process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] === '1';
101101
const ui =
102102
fullscreen
103103
? new TuiAltScreen(terminal, undefined, undefined, {

‎apps/pythinker-code/test/tui/components/messages/agent-dynamic-workflow-progress.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function createComponent(
3232
});
3333
}
3434

35-
function renderText(component: AgentDynamicWorkflowProgressComponent, width = 160): string {
35+
function renderText(component: AgentDynamicWorkflowProgressComponent, width = 100): string {
3636
return strip(component.render(width).join('\n'));
3737
}
3838

@@ -382,11 +382,11 @@ describe('AgentDynamicWorkflowProgressComponent', () => {
382382
const component = createComponent();
383383

384384
registerSubagents(component, 1);
385-
component.markCompleted('agent-1', 'Reviewed imports and found no regression');
385+
component.markCompleted('agent-1', 'Reviewed imports and found no regressions');
386386

387387
const output = renderText(component);
388388

389-
expect(output).toContain('✓ Reviewed imports and found no regression');
389+
expect(output).toContain('✓ Reviewed imports and found no regressi');
390390
expect(output).toContain('Completed.');
391391
});
392392

@@ -398,7 +398,7 @@ describe('AgentDynamicWorkflowProgressComponent', () => {
398398

399399
const output = renderText(component);
400400

401-
expect(output).toContain('✗ Provider request failed Retry budget exhausted');
401+
expect(output).toContain('✗ Provider request failed Retry budget');
402402
expect(output).not.toContain('Failed:');
403403
});
404404

@@ -515,7 +515,7 @@ describe('AgentDynamicWorkflowProgressComponent', () => {
515515

516516
const output = renderText(component, 120);
517517

518-
expect(output).toContain('✗ [provider.rate_limit] 429 request reached user+model max RPM.');
518+
expect(output).toContain('✗ [provider.rate_limit] 429 request reache');
519519
expect(output).not.toContain('agent_dynamic_workflow:');
520520
expect(output).not.toContain('Failed:');
521521
});
@@ -536,7 +536,7 @@ describe('AgentDynamicWorkflowProgressComponent', () => {
536536

537537
const output = renderText(component);
538538

539-
expect(output).toContain('✓ Reviewed src/a.ts and confirmed imports are stable.');
539+
expect(output).toContain('✓ Reviewed src/a.ts and confirmed imports');
540540
expect(output).toContain('Completed.');
541541
});
542542

‎apps/pythinker-code/test/tui/create-tui-state.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ describe('createTUIState', () => {
9292
expect(state.activitySpinner).toBeNull();
9393
});
9494

95-
it('uses the docked fullscreen renderer by default', () => {
95+
it('uses the docked fullscreen renderer when fullscreen is enabled', () => {
9696
const previous = process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'];
97-
delete process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'];
97+
process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] = '1';
9898
try {
9999
const state = createTUIState({
100100
initialAppState: fakeInitialAppState(),

‎packages/agent-gateway/test/sessions.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ describe('server-v2 /api/v1/sessions', () => {
268268
});
269269
const { status, body } = await postJson<null>(
270270
`/api/v1/sessions/${created.body.data.id}/export`,
271-
{ web_log: 'zh'.repeat(87_382) },
271+
{ web_log: 'a'.repeat(256 * 1024 + 1) },
272272
);
273273

274274
expect(status).toBe(200);
@@ -536,17 +536,17 @@ describe('server-v2 /api/v1/sessions', () => {
536536

537537
const page1 = await getJson<PageWire>('/api/v1/sessions?page_size=3');
538538
expect(page1.body.code).toBe(0);
539-
expect(page1.body.data.items.map((s) => s.id)).toEqual(ids.slice(4).reverse());
539+
expect(page1.body.data.items.map((s) => s.id)).toEqual(ids.slice(4).toReversed());
540540
expect(page1.body.data.has_more).toBe(true);
541541

542-
const cursor1 = page1.body.data.items[page1.body.data.items.length - 1]!.id;
542+
const cursor1 = page1.body.data.items.at(-1)!.id;
543543
const page2 = await getJson<PageWire>(
544544
`/api/v1/sessions?page_size=3&before_id=${encodeURIComponent(cursor1)}`,
545545
);
546-
expect(page2.body.data.items.map((s) => s.id)).toEqual(ids.slice(1, 4).reverse());
546+
expect(page2.body.data.items.map((s) => s.id)).toEqual(ids.slice(1, 4).toReversed());
547547
expect(page2.body.data.has_more).toBe(true);
548548

549-
const cursor2 = page2.body.data.items[page2.body.data.items.length - 1]!.id;
549+
const cursor2 = page2.body.data.items.at(-1)!.id;
550550
const page3 = await getJson<PageWire>(
551551
`/api/v1/sessions?page_size=3&before_id=${encodeURIComponent(cursor2)}`,
552552
);

0 commit comments

Comments
 (0)