Skip to content

feat(agents): set active session agent from agents menu - #1349

Merged
kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:feat/526-active-agent-menu
May 26, 2026
Merged

kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:feat/526-active-agent-menu

Conversation

@chioarub

@chioarub chioarub commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Show the current session agent in the /agents dialog.
  • Mark the active agent in the agents list.
  • Add a session-scoped Set as active agent action from the agent menu.
  • Apply an agent frontmatter model when switching the active session agent, matching startup --agent behavior when no explicit model override is active.

Why

Fixes #526. Users could inspect and manage agents, but they could not easily see which agent was active or switch the active session agent without restarting with --agent.

Behavior

  • /agents now shows Current session agent: <name> or none.
  • The active agent row is marked in the list.
  • Selecting Set as active agent updates the active agent for the current session.
  • If the selected agent has model frontmatter and the user has not explicitly chosen a model, the next turn uses the same effective model startup --agent would have selected.
  • Explicit user model overrides are preserved.
  • Switching back to an inheriting agent clears only a prior agent-managed model and restores the base model.
  • Existing view/edit/delete/create behavior is unchanged.

Out of scope

  • Persisting active-agent selection to settings
  • Changing --agent parsing
  • Agent loading or override precedence changes
  • Provider, OAuth, permission, or tool execution changes

Testing

  • bun install --frozen-lockfile — passed
  • bun install --cwd web --frozen-lockfile — passed
  • bun test src/components/agents/ src/components/PromptInput/PromptInputQueuedCommands.test.tsx --max-concurrency=1 — passed, 15 tests
  • bun test src/components/StartupScreen.test.ts src/tools/BashTool/BashTool.errorOutput.test.ts --max-concurrency=1 — passed, 40 tests
  • git diff --check — passed
  • bun run build — passed
  • bun run smoke — passed
  • bun test --max-concurrency=1 — passed, 2885 tests passed, 2 skipped, 0 failed, with a clean test home/provider environment
  • python -m pytest -q python/tests — passed, 44 tests
  • bun run security:pr-scan -- --base upstream/main — passed
  • bun run test:provider — passed, 596 tests
  • npm run test:provider-recommendation — passed, 78 tests
  • bun run --cwd web typecheck — passed
  • bun run --cwd web build — passed

Review update validation:

  • bun test src/screens/replActiveAgentModel.test.ts src/components/agents/AgentsMenu.test.tsx src/components/agents/AgentsList.test.tsx — passed, 11 tests
  • git diff --check — passed

Additional non-CI check:

  • bun run typecheck — fails on existing repository-wide TypeScript baseline issues unrelated to this PR, including missing generated modules and unrelated test typing errors. This command is not part of .github/workflows/pr-checks.yml.

Fixes #526

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Findings

  • [P2] Apply the selected agent model when switching active agents
    src/screens/REPL.tsx:2561
    The new menu path updates mainThreadAgentDefinition, bootstrap agent type, session metadata, and AppState.agent, but it never updates the main loop model. Startup --agent already applies an agent-specific model when no explicit --model was provided, so an agent with frontmatter like model: haiku or model: sonnet behaves differently depending on whether the user starts with --agent or chooses the same agent from /agents. Since issue #526 asks users to switch active agents without restarting, the next turn should use the same effective model that startup would have selected, or the UI should avoid claiming the session agent was fully switched. Please update the runtime setter to mirror the startup model-selection path, while preserving explicit user model overrides.

@chioarub

Copy link
Copy Markdown
Contributor Author

Addressed the requested model-selection behavior in 785c726.

The /agents runtime setter now mirrors startup --agent model selection when no explicit model override is active: it applies the selected agent frontmatter model, preserves explicit user model overrides, and only restores the base model when switching away from a prior agent-managed model to an inheriting agent.

Added focused regression coverage for:

  • applying an agent model without an explicit override
  • preserving explicit model overrides
  • restoring the base model after an agent-managed model
  • leaving the model untouched when an inheriting agent has no agent-managed model to clear

Validation:

  • bun test src/screens/replActiveAgentModel.test.ts src/components/agents/AgentsMenu.test.tsx src/components/agents/AgentsList.test.tsx — 11 pass
  • git diff --check — passed

I also updated the PR description so the behavior and test list match the current implementation.

@chioarub
chioarub requested a review from jatmn May 25, 2026 06:20

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing the active-agent model-selection follow-up.

No issues here, LGTM.

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kevincodex1
kevincodex1 merged commit 7419d38 into Twigpine:main May 26, 2026
2 checks passed
discopops pushed a commit to discopops/openclaude that referenced this pull request May 28, 2026
* feat(agents): set active session agent from agents menu

* fix agents menu model switching
Gravirei added a commit to Gravirei/openclaude that referenced this pull request May 28, 2026
- fix(autocompact): retry circuit breaker after cooldown (Twigpine#1375)
- fix(provider): require API key input when adding OpenGateway (Twigpine#1384)
- fix(provider): allow remote Ollama without OPENAI_API_KEY (Twigpine#952)
- fix(codex-stream): recover tool args delivered only via done events (Twigpine#1262)
- fix: route MiniMax compacting through Anthropic-compatible API (Twigpine#1154)
- fix(thinking): disable thinking for unsupported Ollama models (Twigpine#1376)
- feat(agents): set active session agent from agents menu (Twigpine#1349)
- fix(repl): show permission prompts while draft input is present (Twigpine#1393)
- fix(model): include profile models in descriptor picker (Twigpine#1361)
- Improve warning notice formatting (Twigpine#1415)
- fix(codex): allow credential storage fallback (Twigpine#1347)
- fix(attribution): make git attribution opt-in by default (Twigpine#1335)
- fix(agent): allow custom model overrides (Twigpine#1337)
- feat(query): robust multi-lingual and structural continuation nudge (Twigpine#1280)
- fix(watchers): debounce skills and settings reload bursts (Twigpine#1370)
- feat: configure API retry backoff (Twigpine#370) (Twigpine#1095)
- chore(main): release 0.15.0 (Twigpine#1325)
- ci: retrigger CodeQL after action download outage (Twigpine#1374)
- Fix launcher heap setup for long sessions (Twigpine#1242)
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jun 5, 2026
* feat(agents): set active session agent from agents menu

* fix agents menu model switching
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.

Feat: Set a active agent

3 participants