Skip to content

feat: agent config modal for start/restart#237

Open
EugeneOsipenko wants to merge 16 commits intomarcus:mainfrom
EugeneOsipenko:new-agent-config-modal
Open

feat: agent config modal for start/restart#237
EugeneOsipenko wants to merge 16 commits intomarcus:mainfrom
EugeneOsipenko:new-agent-config-modal

Conversation

@EugeneOsipenko
Copy link
Contributor

@EugeneOsipenko EugeneOsipenko commented Mar 15, 2026

Summary

  • New modal when pressing 's' to start/restart an agent on a worktree — lets you choose agent type, toggle skip-permissions, and select a prompt template
  • When agent is running, the existing attach/restart choice modal now routes "Restart" through the new config modal
  • Prompt picker correctly returns to whichever modal opened it (agent config or create workspace)
Снимок экрана 2026-03-15 в 14 15 23

Test plan

  • Press 's' on a worktree with no agent → agent config modal opens with pre-selected agent type
  • Select different agent, toggle skip permissions, pick a prompt → start agent with those options
  • Press 's' on a worktree with running agent → attach/restart modal → choose restart → agent config modal opens
  • Open prompt picker from agent config modal → select prompt → returns to agent config modal
  • Cancel prompt picker from agent config modal → returns to agent config modal
  • Open prompt picker from create workspace modal → still works as before
  • Press Esc in agent config modal → returns to list view
  • Enter on prompt field opens picker, Enter on agent list absorbs, Enter on Start submits

🤖 Generated with Claude Code

EugeneOsipenko and others added 16 commits March 15, 2026 12:51
Design for a new modal that appears when starting or restarting an
agent on a worktree, allowing users to choose agent type, toggle
skip-permissions, and select a prompt template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
13 tasks across 6 chunks covering types, messages, state fields,
modal builder, key/mouse/command handlers, entry point rewiring,
and prompt picker return routing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
renderPromptPickerModal always used renderCreateModal as its background.
When opened from the agent config modal, the create modal's text inputs
were uninitialized (nil cursor), causing a nil pointer panic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The modal's HandleKey falls through to primaryAction (submit) when
the focused section doesn't consume Enter. This caused Enter on the
prompt selector or agent list to immediately submit instead of
activating the focused element. Now Enter is handled manually by
checking FocusedID, matching the pattern used by handleCreateKeys.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract openAgentConfigModal(wt, isRestart) eliminating duplicate
  12-line init blocks in two places
- Extract openPromptPicker(prompts, returnMode) eliminating duplicate
  4-line blocks in 6 places across keys.go and mouse.go
- Remove agentConfigFocusSet field — move initial SetFocus into
  ensureAgentConfigModal when modal is first built, avoiding the
  bug where focus flag wasn't reset on re-open
- Revert p.ctx nil guard in StartAgentWithOptions (test-only concern);
  fix tests to provide &plugin.Context{} instead
- Remove os/filepath imports from keys.go (no longer needed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@marcus
Copy link
Owner

marcus commented Mar 15, 2026

Hey @EugeneOsipenko! Starling here (AI assistant on the project). 👋

This is a really nice UX improvement — pressing 's' on a worktree today drops you straight into starting the agent with whatever defaults, so having a config modal to pick agent type, toggle skip-permissions, and select a prompt template before committing is a meaningful quality-of-life upgrade.

A few things I like:

  • The "restart" path routing through the new config modal is the right call — muscle memory says 'restart' and you still get to adjust options before kicking it off
  • Prompt picker correctly returning to whichever modal opened it is good modal hygiene
  • 228-line new modal with 169 lines of tests is a healthy ratio

The test plan is thorough — 8 manual scenarios covering the full interaction tree. That's the right level of detail for UI state machine work.

This is your second contribution after #231 (the .gitignore cleanup) — thank you for keeping at it. Flagging for Marcus/Kestrel review. ✦

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.

2 participants