Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
128dc99
fix(cli): prevent plan truncation in approval dialog by supporting un…
Adib234 Mar 3, 2026
36b06f7
address bot comment
Adib234 Mar 4, 2026
0f88ddb
address bot comments
Adib234 Mar 4, 2026
ec2d0a8
update to height based on all available height module fix overflow
Adib234 Mar 5, 2026
e5d9719
update snapshot
Adib234 Mar 5, 2026
c397c72
fix
Adib234 Mar 5, 2026
633ef48
update snapshot
Adib234 Mar 5, 2026
05b50f4
update snapshots
Adib234 Mar 5, 2026
f5c0253
plz work
Adib234 Mar 5, 2026
7490f28
update snapshots
Adib234 Mar 6, 2026
d879da6
test: update snapshots for AskUserDialog and ExitPlanModeDialog
Adib234 Mar 6, 2026
8cfc314
revert file change
Adib234 Mar 6, 2026
55cc847
use question.unconstrainedHeight again
Adib234 Mar 6, 2026
0a6fb84
prevent radio button area from getting truncated
Adib234 Mar 6, 2026
53a3fc9
address feedback from/review frontend
Adib234 Mar 6, 2026
5f0464d
make sure usually at most 1 line of history is present above plan con…
Adib234 Mar 7, 2026
c387024
make sure exit plan dialog takes up available height only when there'…
Adib234 Mar 9, 2026
e37954a
test: fix variable name in comment
jacob314 Mar 9, 2026
4216232
update minListHeight
Adib234 Mar 10, 2026
bd7aa56
remove changes to uiAvailableHeight
Adib234 Mar 10, 2026
a27a134
remove changes to uiAvailableHeight
Adib234 Mar 10, 2026
457ca8e
add unconstrainedHeight as false to exit plan mode dialog
Adib234 Mar 10, 2026
0aab89e
Merge branch 'main' into fix/askuserdialog-height
jacob314 Mar 10, 2026
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
23 changes: 18 additions & 5 deletions packages/cli/src/ui/components/AskUserDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useEffect,
useReducer,
useContext,
useState,
} from 'react';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
Expand Down Expand Up @@ -782,30 +783,42 @@ const ChoiceQuestionView: React.FC<ChoiceQuestionViewProps> = ({
}
}, [customOptionText, isCustomOptionSelected, question.multiSelect]);

const [actualQuestionHeight, setActualQuestionHeight] = useState(0);

const HEADER_HEIGHT = progressHeader ? 2 : 0;
const TITLE_MARGIN = 1;
const FOOTER_HEIGHT = 2; // DialogFooter + margin
const overhead = HEADER_HEIGHT + TITLE_MARGIN + FOOTER_HEIGHT;

const listHeight = availableHeight
? Math.max(1, availableHeight - overhead)
: undefined;
const questionHeight =

// Modulo the fixed overflow (overhead + 4 lines reserved for list), use all remaining height.
const maxQuestionHeight =
question.unconstrainedHeight && listHeight
? Math.max(5, listHeight - 4)
: 15;

const questionHeightLimit =
listHeight && !isAlternateBuffer
? Math.min(15, Math.max(1, listHeight - DIALOG_PADDING))
? Math.min(maxQuestionHeight, listHeight)
: undefined;

const maxItemsToShow =
listHeight && questionHeight
? Math.max(1, Math.floor((listHeight - questionHeight) / 2))
listHeight && actualQuestionHeight
? Math.max(1, Math.floor((listHeight - actualQuestionHeight) / 2))
: selectionItems.length;

return (
<Box flexDirection="column">
{progressHeader}
<Box marginBottom={TITLE_MARGIN}>
<MaxSizedBox
maxHeight={questionHeight}
maxHeight={questionHeightLimit}
maxWidth={availableWidth}
overflowDirection="bottom"
onHeightChange={setActualQuestionHeight}
>
<Box flexDirection="column">
<MarkdownDisplay
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/ui/components/ExitPlanModeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const ExitPlanModeDialog: React.FC<ExitPlanModeDialogProps> = ({
],
placeholder: 'Type your feedback...',
multiSelect: false,
unconstrainedHeight: true,
},
]}
onSubmit={(answers) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ describe('ToolConfirmationQueue', () => {
// hideToolIdentity is true for ask_user -> subtracts 4 instead of 6
// availableContentHeight = 19 - 4 = 15
// ToolConfirmationMessage handlesOwnUI=true -> returns full 15
// AskUserDialog uses 15 lines to render its multi-line question and options.
// AskUserDialog allocates questionHeight = availableHeight - overhead - minListHeight.
// listHeight = 15 - overhead (Header:0, Margin:1, Footer:2) = 12.
// maxQuestionHeight = listHeight - 4 = 8.
// 8 lines is enough for the 6-line question.
await waitFor(() => {
expect(lastFrame()).toContain('Line 6');
expect(lastFrame()).not.toContain('lines hidden');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scrol
Description 1
2. Option 2
Description 2
3. Option 3
Description 3

Enter to select · ↑/↓ to navigate · Esc to cancel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ Implementation Steps
6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts
7. Create token refresh mechanism in src/auth/TokenManager.ts
8. Add multi-factor authentication in src/auth/MFAService.ts
... last 22 lines hidden (Ctrl+O to show) ...
9. Implement session timeout handling in src/auth/SessionManager.ts
10. Add audit logging for auth events in src/auth/AuditLogger.ts
... last 20 lines hidden (Ctrl+O to show) ...

● 1. Yes, automatically accept edits
Approves plan and allows tools to run automatically
2. Yes, manually accept edits
Approves plan but requires confirmation for each tool
3. Type your feedback...

Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel
"
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/src/ui/components/shared/MaxSizedBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface MaxSizedBoxProps {
maxHeight?: number;
overflowDirection?: 'top' | 'bottom';
additionalHiddenLinesCount?: number;
onHeightChange?: (height: number) => void;
}

/**
Expand All @@ -38,6 +39,7 @@ export const MaxSizedBox: React.FC<MaxSizedBoxProps> = ({
maxHeight,
overflowDirection = 'top',
additionalHiddenLinesCount = 0,
onHeightChange,
}) => {
const id = useId();
const { addOverflowingId, removeOverflowingId } = useOverflowActions() || {};
Expand Down Expand Up @@ -80,6 +82,18 @@ export const MaxSizedBox: React.FC<MaxSizedBoxProps> = ({
? effectiveMaxHeight - 1
: effectiveMaxHeight;

const actualHeight =
visibleContentHeight !== undefined
? Math.min(contentHeight, visibleContentHeight)
: contentHeight;

const totalActualHeight =
actualHeight + (isOverflowing && effectiveMaxHeight !== undefined ? 1 : 0);

useEffect(() => {
onHeightChange?.(totalActualHeight);
}, [totalActualHeight, onHeightChange]);

const hiddenLinesCount =
visibleContentHeight !== undefined
? Math.max(0, contentHeight - visibleContentHeight)
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/confirmation-bus/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export interface Question {
multiSelect?: boolean;
/** Placeholder hint text. For type='text', shown in the input field. For type='choice', shown in the "Other" custom input. */
placeholder?: string;
/** Allow the question to consume more vertical space instead of being strictly capped. */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still need to get removed? I see in the latest push this was brought back

unconstrainedHeight?: boolean;
}

export interface AskUserRequest {
Expand Down
Loading