Skip to content

feat(tui): configure permission prompt height and fullscreen - #53719 - #55748

Closed
alko89 wants to merge 3 commits into
anomalyco:devfrom
alko89:tui-permission-prompt
Closed

alko89 wants to merge 3 commits into
anomalyco:devfrom
alko89:tui-permission-prompt

Conversation

@alko89

@alko89 alko89 commented Oct 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #28191

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds two optional tui.json settings for permission prompts:

  • permission_prompt.max_height: maximum height in rows when collapsed. Defaults to 15.
  • permission_prompt.default_expanded: opens approval prompts in fullscreen by default. Defaults to false.

Each new permission request restores the configured expanded state. Updates to the same request preserve manual fullscreen changes, and Ctrl+F continues to toggle fullscreen. Always-allow confirmations stay collapsed.

Includes configuration validation, rendering tests, and documentation.

How did you verify your code works?

From packages/tui:

  • bun test test/cli/tui/permission.test.tsx test/config.test.tsx — 17 passed.
  • bun typecheck — passed.

Rendering tests cover configured height, fullscreen defaults, toggling, request updates, consecutive approvals, and always-allow confirmation. Formatting and diff checks also pass.

Screenshots / recordings

Not included. Behavior is covered by rendering tests.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #50903

Public API: adds optional TUI config keys permission_prompt.max_height and permission_prompt.default_expanded (backwards compatible)

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@alko89 alko89 closed this Oct 15, 2026

@opencode-agent opencode-agent Bot left a comment

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.

Thanks for picking up #28191. The logic is sound: the always-allow confirmation stays collapsed, Ctrl+F does nothing when fullscreen isn't offered, and fullscreen resets when the request id changes. The tests pass and the type check is clean on the branch. The main problem is the base it's built on.

The branch starts from a commit from before v2 became dev (Oct 6). Against the current dev it conflicts in both packages/tui/src/config/index.tsx and packages/tui/src/routes/session/permission.tsx. On current dev, the flat tui.json schema this PR extends now lives in config/v1/. The new schema groups settings (scroll, leader, prompt, session with session.permissions, …), so a top-level permission_prompt doesn't fit. The current permission prompt has also changed (Keymap layers, Escape now leaves fullscreen first). Please rebase onto the latest dev and put the two options where they fit in the new schema, for example next to session.permissions. Because of the conflicts, I couldn't run the change against current dev. After the rebase, before/after screenshots of the prompt with and without the settings would help.

The new rendering test is fairly heavy: a full provider stack to check one panel height. A smaller version covering the configured height and default_expanded would be easier to maintain.

Public API: adds the optional TUI config keys permission_prompt.max_height (positive integer, default 15) and permission_prompt.default_expanded (boolean, default false). This is backwards compatible, but the key names and location should follow the v2 config schema after the rebase.

Related: #50903

Comment thread packages/tui/src/config/index.tsx Outdated
}),
}).annotate({ description: "Prompt size settings" })

export const PermissionPrompt = Schema.Struct({

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.

On current dev, this flat schema has moved to config/v1/. The v2 Info in this file groups settings (scroll, leader, prompt, session with session.permissions, …). After rebasing, these two options should go into the v2 schema in that grouped style, not a new top-level permission_prompt key, so the v2 CLI actually reads them.

@alko89 alko89 reopened this Oct 15, 2026
@alko89
alko89 force-pushed the tui-permission-prompt branch from 8b03d28 to 58459cd Compare October 15, 2026 15:03
@alko89

alko89 commented Oct 18, 2026

Copy link
Copy Markdown
Author

Thanks for the review — addressed in f4dc8d9 (on top of the update-branch merge):

  • Config location: the two options now live in the v2 grouped schema at session.permission_prompt.max_height / default_expanded, nested inside the session group right next to session.permissions (packages/tui/src/config/index.tsx). Resolved/resolve() carry them through unchanged, so the v2 CLI reads them.
  • Lighter rendering test: test/cli/tui/permission.test.tsx now renders SessionQuestion directly with only ConfigProvider + Keymap.Provider + ThemeProvider (no client/data/location/toast stack). It covers the configured height (default 15 / custom 30), default_expanded opening fullscreen with a ctrl+f round-trip, and non-fullscreen questions staying collapsed.
  • Simplification: dropped the expanded/onToggleFullscreen prop threading and the request-id reset effect. SessionQuestion seeds its expanded state from config (only when fullscreen is offered), and per-request reset comes from the existing keyed <Show when={promptedPermissions()[0]?.id} keyed> at the mount site — same-request updates still preserve manual fullscreen toggles. The component diff vs dev is now 3 lines.
  • Docs: tui.mdx documents the real v2 paths; removed the top-level block from the legacy-example JSON so it doesn't advertise a key the v2 schema rejects. (That example section still documents v1-era keys — pre-existing, happy to fix separately.)

Screenshots not included yet; behavior is covered by the rendering tests. Verification: bun run check green at root, targeted tests pass incl. --rerun-each 3 stability runs.

@alko89 alko89 closed this by deleting the head repository Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE: TUI permission prompt - configurable default height and expanded state

1 participant