Repository navigation
feat(chat): unified AgentProfile chat-input picker (start-new-with-profile) (#3727) - #1446
simonrosenberg wants to merge 11 commits into
Conversation
…ofile) (#3727) Collapse the two divergent local chat-input pickers (SwitchProfileButton + the ACP use of ChatInputModel) into one AgentProfile picker. Selecting a profile starts a NEW conversation launched from it via agent_profile_id (no live in-conversation switch, per product direction); on the home page it activates the profile so the next conversation launches from it. Cloud is unchanged — AgentProfiles are local-first (cloud surface tracked by #3730). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
…ve-profile launch The agent_profile_id launch wiring grew createConversation's positional signature, which broke every create-call-site test that asserts the call (home launcher, task card, conversation-panel menus, launch route). Only append the [sandboxId, agentProfileId] tail when actually launching from a profile, so a no-profile create is unchanged — fixing those 10 tests without churn and keeping the legacy path lower-risk. Add a regression test that a new local conversation launches from the active AgentProfile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
…o feat-unified-chat-input-picker
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
…o feat-unified-chat-input-picker # Conflicts: # src/i18n/translation.json
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 Acceptable — works but has two gaps worth fixing before merge
The unified picker design is clean and the end-to-end wiring is correct. Two things need attention before merge:
-
isSwitchingis computed but never consumed — the trigger button can be double-clicked while acreateConversationmutation is in flight, creating duplicate conversations. This is a UX regression vs the oldSwitchProfileButtonwhich disabled itself duringisPending. -
buildStartConversationRequesthas zero unit coverage for theagentProfileIdpath — the three!options.agentProfileIdguards (XOR betweenagent_profile_id/agent_settings, ACP tag suppression,secrets_encryptedsuppression) are the most important logic this PR adds to the adapter, and they're completely untested at the unit level.
Detailed inline comments below.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM
All new local-backend conversation creates now route through theeffectiveAgentProfileIdpath, silently changing the launch mode for every user who has an active AgentProfile set. Theagent_profile_idXORagent_settingslogic in the adapter is the correctness linchpin — it should have tests.
VERDICT: ❌ Needs rework — two concrete fixes required (button disabled state, adapter unit tests).
KEY INSIGHT: The isSwitching value is faithfully computed but never threaded into the UI, making the guard a no-op.
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing. See the customization docs for the required frontmatter format.- Re-request a review — the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
- When your PR is merged, the guideline file goes through normal code review by repository maintainers.
Resolve with AI? Install the iterate skill in your agent and run
/iterateto automatically drive this PR through CI, review, and QA until it's merge-ready.Was this review helpful? React with 👍 or 👎 to give feedback.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
| /** True inside a conversation (selecting starts a NEW one), false on home. */ | ||
| isInConversation: boolean; | ||
| isLoading: boolean; | ||
| isSwitching: boolean; |
There was a problem hiding this comment.
🟠 Important: isSwitching is dead state — the picker button stays enabled during a mutation, allowing double-submit.
isSwitching is exported in the interface and computed at line 78, but neither ChatInputProfilePicker nor ChatInputProfileMenuContent destructures it. That means a user can click a second profile while createConversation is still in flight, firing a second mutation and creating a duplicate conversation.
The old SwitchProfileButton disabled itself via isPending. Thread isSwitching into the picker button:
| isSwitching: boolean; | |
| isSwitching: boolean; |
Then in ChatInputProfilePicker:
const { profiles, currentProfileName, isLoading, isSwitching } = useChatInputProfileState();
// …
<button
…
disabled={isSwitching}
aria-busy={isSwitching}| // Only extend the call with the [sandboxId, agentProfileId] tail when | ||
| // launching from a profile, so a plain create stays byte-identical to | ||
| // the legacy agent_settings path (#3727). sandboxId is unused here. | ||
| const profileArgs: [undefined, string] | [] = effectiveAgentProfileId |
There was a problem hiding this comment.
🟡 Suggestion: track this profileArgs spread as named tech debt.
Passing [undefined, effectiveAgentProfileId] to skip position 9 (sandboxId) and hit position 10 (agentProfileId) is a side-effect of createConversation having accumulated 10 positional parameters. The comment makes the intent clear and the test explicitly validates call?.[8] / call?.[9], so this is not a bug — but it signals that createConversation should eventually be refactored to an options object. A // TODO: refactor createConversation to an options object comment or a tracking ticket would keep this visible.
| expect(payload.agent_settings!.agent_kind).toBe("acp"); | ||
| expect(payload.secrets_encrypted).toBeUndefined(); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
🟠 Important: no unit tests for the agentProfileId path in buildStartConversationRequest.
The adapter diff only adds ! non-null assertions to existing tests. The three !options.agentProfileId guards — the XOR between agent_profile_id / agent_settings, ACP tag suppression, and secrets_encrypted suppression — are the most critical logic this PR introduces in the adapter, and they're completely untested at the unit level.
Please add a describe block such as:
describe("agentProfileId path", () => {
it("sets agent_profile_id and omits agent_settings", () => {
const payload = buildStartConversationRequest({
settings: makeSettings(),
agentProfileId: "profile-xyz",
});
expect(payload.agent_profile_id).toBe("profile-xyz");
expect(payload.agent_settings).toBeUndefined();
});
it("does not stamp the ACP server tag when launching from a profile", () => {
const acpSettings = makeSettings({ agent_kind: "acp", acp_server: "http://localhost:8000" });
const payload = buildStartConversationRequest({
settings: acpSettings,
agentProfileId: "profile-xyz",
});
expect(payload.tags).toBeUndefined();
});
it("does not set secrets_encrypted when launching from a profile", () => {
const payload = buildStartConversationRequest({
settings: makeSettings(),
agentProfileId: "profile-xyz",
secretsEncrypted: true,
});
expect(payload.secrets_encrypted).toBeUndefined();
});
});Without these tests, a future refactor of the !options.agentProfileId guards could silently regress the XOR invariant.
… adapter path Address review feedback on #1446: - thread isSwitching into the picker trigger (disabled + aria-busy) so re-opening the menu can't fire a second createConversation while one is in flight — the menu closes on select, so this was the only double-submit path - add buildStartConversationRequest unit tests for the agentProfileId path: the agent_profile_id XOR agent_settings invariant, ACP server-tag suppression (proven against the no-profile case that does stamp it), and secrets_encrypted suppression - note the createConversation positional-params tech debt with a refactor TODO Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
…(local) Per UX review: a single "Agent" Settings tab instead of two. On local backends the "Agent" nav entry now points at the AgentProfile library (select an existing profile / create-save a new one), and the separate "Agent profiles" entry is dropped. Conversations launch from the active profile (#3727), so the legacy global agent-settings page is superseded and removed from the local nav (still reachable by direct URL, so the mock-llm-acp e2e and bookmarks keep working). Cloud has no AgentProfile surface yet (#3730), so it keeps the legacy "Agent" page unchanged — done as a follow-up. Nav-only change: routes are untouched (/settings/agent = legacy, /settings/agents = library); the local "Agent" item is repointed to the library with the library subtitle. Adds nav coverage for both local and cloud. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
The single local "Agent" tab is the profile library, so label it "Agent Profiles" — paralleling the LLM tab, which is "LLM Profiles" on local and "LLM" on cloud. Cloud keeps "Agent" (legacy global page). Reuses the existing SETTINGS$NAV_AGENT_PROFILES key (aligned its en casing to "Agent Profiles" to match "LLM Profiles"). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
…hide/reveal switch) The "All configured servers" toggle hid/revealed the server list, which wasn't intuitive. Replace it with an always-visible checkbox list plus a master "All servers" checkbox that ticks/unticks every box at once. Tri-state semantics are preserved: checking "All servers" stores null (all configured servers, incl. future ones), unchecking stores []; toggling individual boxes stores the explicit list, and re-ticking every configured server canonicalizes back to null so "all" keeps tracking new servers. Dangling-ref round-trip + warning unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
…itor Session mode isn't worth exposing: the SDK auto-detects the right mode per provider (bypassPermissions for Claude Code, full-access for Codex, …), and a wrong value can crash session init (e.g. Gemini "yolo" on some CLI versions). Remove the input; persist null (→ auto-detect) on create and round-trip any existing value on edit so a save never resets a seeded mode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
… the standalone page (local) Condenser is an OpenHands-only agent setting (ACP CLIs manage their own context), so surface it per-profile in the editor's OpenHands branch — a new AgentProfileCondenserFields sub-form (enable toggle + max size) mirroring the verification sub-form, reusing the SCHEMA$CONDENSER$* i18n keys. Condenser moves from the round-tripped extras to first-class state: sent on create + edit, other condenser fields round-trip via spread, max_size clamped to the server's >= 20. The condenser stores no LLM/credential (it reuses the profile's resolved LLM). Drop the standalone /settings/condenser page from the local nav (it's now per-profile); cloud keeps it until AgentProfiles land there (#3730). The route is untouched, so cloud + direct URL still work. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Verification is already configured per-profile in the Agent Profiles editor (AgentProfileVerificationFields), so the standalone /settings/verification page is redundant on local — drop it from the nav alongside Condenser. The per-profile verification is secret-free (drops critic_api_key, reusing the profile's LLM key), so nothing is lost on local. Cloud keeps the page until AgentProfiles land there (#3730); the route is untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
🛑 Mock-LLM E2E Tests56/58 passed · 1 failed · 1 skipped · Commit:
🔍 Failure details (1)❌ chromium › settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
❌ Mock-LLM E2E Tests58/60 passed · 1 failed · 1 skipped Commit:
🔍 Failure details (1)❌ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same modelPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
| Status | Test | Duration |
|---|
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)
Wire agent_profile_id (mutually exclusive with agent_settings) through buildStartConversationRequest, AgentServerConversationService.createConversation, and useCreateConversation, so an activated AgentProfile actually reaches conversation start — the launch path the library needs to be functional. New local conversations default to the active AgentProfile; a profile launch skips the current-settings ACP tag, encrypted-settings and subscription checks (the server resolves the profile). Plain creates stay byte-identical to the legacy agent_settings path. Cloud is unchanged (no /api/agent-profiles yet). Ported from #1446 so this PR is self-sufficient; excludes the picker UI and the settings-IA changes (those follow with the chat-input picker / Agents-hub work). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… adapter path Address review feedback on #1446: - thread isSwitching into the picker trigger (disabled + aria-busy) so re-opening the menu can't fire a second createConversation while one is in flight — the menu closes on select, so this was the only double-submit path - add buildStartConversationRequest unit tests for the agentProfileId path: the agent_profile_id XOR agent_settings invariant, ACP server-tag suppression (proven against the no-profile case that does stamp it), and secrets_encrypted suppression - note the createConversation positional-params tech debt with a refactor TODO Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 4953d71)
|
Closing — this PR is fully subsumed by #1463 (the AgentProfile master-detail editor + Agents-hub IA), which became the single home for the per-profile work. Mapping every commit here against #1463:
Only genuinely unique change here was dropping the ACP "Session mode" field; we've decided to keep that field in #1463 (a knowledgeable user can set it), so nothing is lost by closing this. All follow-up work continues on #1463. |
HUMAN: New ChatInputProfilePicker / ChatInputProfileMenuContent + useChatInputProfileState hook
AGENT:
Closes part of the AgentProfile epic (OpenHands/software-agent-sdk#3727). Stacked on #1440 (base
feat-agent-profiles-library) — review/merge that first.Verification (agent):
npm run typecheck— clean.npx vitest runon the touched suites — 102 passing (newchat-input-profile-picker.test.tsx6, updatedchat-input-actions.test.tsx,chat-input-model.test.tsx, bothagent-server-adaptersuites).eslint+prettierclean on changed files; husky pre-commit (eslint --fix, staged typecheck, translation-completeness) passed — added all 15 languages for the 3 new i18n keys./api/agent-profiles); flagging for human QA below.Why
Two divergent chat-input pickers (
SwitchProfileButtonfor local OpenHands,ChatInputModelfor cloud + ACP) meant the control behaved differently per surface. This unifies the local surfaces onto a single AgentProfile-aware picker so the UI never lies about what a click does.Summary
ChatInputProfilePicker/ChatInputProfileMenuContent+useChatInputProfileStatehook. Lists the user's AgentProfiles, marks the current one (fromlaunched_profileprovenance in a conversation, oractive_agent_profile_idon home).agent_profile_id; on home it activates the profile so the next conversation launches from it. No live in-conversation profile/model switching.agent_profile_idthrough the local conversation-start path (buildStartConversationRequestsendsagent_profile_idXORagent_settings;createConversation+useCreateConversationaccept it and default to the active profile). This is the launch wiring feat(agent-profiles): library, kind-aware editor, and launch-from-active-profile; dissolve ACP nav lockout (#3726, #3728) #1440 omitted — without it, an activated profile never reaches conversation start.SwitchProfileButton+switch-profile-context-menu(replaced on local). Cloud keepsChatInputModelunchanged.Deviations / scope (please review):
deriveSwitchPlan(shipped in ts-client 1.26.0) is intentionally not used yet; live switch-live can be a fast-follow.agent_settingspath if/api/agent-profilesis unavailable). Broad-ish behavior change worth a careful look.Issue Number
OpenHands/software-agent-sdk#3727 (epic #3713)
How to Test
npm run dev:frontendagainst it.launched_profileprovenance on the new conversation).Video/Screenshots
n/a — backend-dependent flow; see How to Test.