Skip to content

Fix custom agents missing in settings (issue 287)#304

Merged
subsy merged 1 commit intomainfrom
fix/issue-287-agent-settings
Feb 14, 2026
Merged

Fix custom agents missing in settings (issue 287)#304
subsy merged 1 commit intomainfrom
fix/issue-287-agent-settings

Conversation

@subsy
Copy link
Owner

@subsy subsy commented Feb 14, 2026

Summary

  • Include configured agent names from [[agents]] in the TUI settings agent dropdown.
  • Fall back to first configured agent when neither nor is set so the settings UI reflects runtime selection.
  • Normalize loaded TOML configs where was accidentally parsed into an agent options table by promoting it to top-level .
  • Treat configured as an agent-configured state for setup status checks.

Testing

  • bun run typecheck
  • bun run build
  • bun test src/config/index.test.ts

Fixes: #287

Summary by CodeRabbit

Release Notes

  • New Features

    • Agents configured via CLI are now visible alongside plugin-provided agents in the interface.
  • Bug Fixes

    • Improved configuration handling for legacy or malformed layouts.
    • Enhanced setup status detection to recognise configured agents.
  • Tests

    • Added test coverage for configuration normalisation and setup status detection.

@vercel
Copy link

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ralph-tui Ignored Ignored Preview Feb 14, 2026 0:14am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Walkthrough

This pull request resolves issue #287 by enabling configured custom agents to appear in the TUI settings modal. The changes merge agent names from config file settings with registered agent plugins, normalise configuration layouts, broaden setup status detection to recognise configured agents, and refactor the availableAgents prop type across components from AgentPluginMeta[] to string[].

Changes

Cohort / File(s) Summary
Configuration loading and normalisation
src/config/index.ts, src/config/index.test.ts
Adds normalizeConfigAfterLoad helper to promote nested defaultAgent from agents[].options to top-level; integrates normalisation into loadConfigFile; expands setup status detection to treat configured agents array as evidence of configuration. Test coverage added for legacy config promotion and agent-configured scenarios.
Agent availability computation
src/commands/run.tsx
Derives agent names from storedConfig.agents[].name and merges with registered agent plugins to compute unified availableAgentNames list, which is then passed to RunApp, replacing direct usage of availableAgents.
Component prop signature updates
src/tui/components/RunApp.tsx, src/tui/components/SettingsView.tsx
Changes availableAgents/agents prop type from AgentPluginMeta[] to string[]; updates buildSettingDefinitions and agent setting construction logic to work with string array; removes AgentPluginMeta object-to-id mapping and adds fallback chain for value extraction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references the issue being fixed and clearly describes the primary change: making custom agents visible in the settings UI.
Linked Issues check ✅ Passed All objectives from issue #287 are met: configured agents now appear in settings dropdown, defaultAgent is reflected in UI, and normalisation handles legacy config layouts.
Out of Scope Changes check ✅ Passed All changes are directly aligned with resolving issue #287. No unrelated functionality has been modified or introduced outside the stated objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/issue-287-agent-settings

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/tui/components/SettingsView.tsx (1)

80-81: Fallback to config.agents?.[0]?.name could return a value absent from the agents options list.

If the first configured agent name doesn't match any entry in the agents string[] prop (e.g., due to a typo or a plugin that failed to register), getValue returns a value not present in options. The select cycling logic handles this gracefully (indexOf returns -1, cycling starts from index 0), so there's no crash — but the UI would briefly show the unrecognised name before the user cycles.

This is a minor edge case; no action needed unless you want to add a guard.

src/commands/run.tsx (1)

1125-1148: availableAgentNames memo recomputes every render because availableAgents is unstable.

agentRegistry.getRegisteredPlugins() (line 1127) is called directly in the render body and likely returns a new array reference each time. Since availableAgents is in the dependency array of the availableAgentNames memo (line 1147), the memo never caches effectively.

Consider wrapping the plugin list in its own useMemo or computing everything in a single memo:

Suggested consolidation
-  const availableAgents = agentRegistry.getRegisteredPlugins();
   const availableTrackers = trackerRegistry.getRegisteredPlugins();
-  const configuredAgentNames = useMemo(
-    () =>
-      Array.from(
-        new Set(
-          (storedConfig?.agents ?? [])
-            .map((agent) => agent.name)
-            .filter((name): name is string => typeof name === 'string' && name.length > 0),
-        ),
-      ),
-    [storedConfig?.agents],
-  );
-  const availableAgentNames = useMemo(
-    () =>
-      Array.from(
-        new Set(
-          [...availableAgents.map((agent) => agent.id), ...configuredAgentNames],
-        ),
-      ),
-    [availableAgents, configuredAgentNames],
-  );
+  const availableAgentNames = useMemo(
+    () =>
+      Array.from(
+        new Set([
+          ...agentRegistry.getRegisteredPlugins().map((agent) => agent.id),
+          ...(storedConfig?.agents ?? [])
+            .map((agent) => agent.name)
+            .filter((name): name is string => typeof name === 'string' && name.length > 0),
+        ]),
+      ),
+    // agentRegistry contents are stable after initialisation;
+    // only storedConfig?.agents changes at runtime (settings save).
+    [storedConfig?.agents],
+  );

This keeps availableAgents (now only used for trackers) out of the dependency array and avoids the redundant intermediate memo. If the registry can genuinely change at runtime, add a trigger signal instead.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 55.38462% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.52%. Comparing base (1bf4156) to head (be4e275).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/commands/run.tsx 0.00% 21 Missing ⚠️
src/config/index.ts 81.81% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
+ Coverage   44.48%   44.52%   +0.04%     
==========================================
  Files          96       96              
  Lines       30283    30345      +62     
==========================================
+ Hits        13470    13512      +42     
- Misses      16813    16833      +20     
Files with missing lines Coverage Δ
src/config/index.ts 59.00% <81.81%> (+2.45%) ⬆️
src/commands/run.tsx 10.92% <0.00%> (-0.09%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@subsy subsy merged commit 339178e into main Feb 14, 2026
12 of 13 checks passed
@subsy subsy deleted the fix/issue-287-agent-settings branch February 14, 2026 12:23
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.

Custom agents don't show up in TUI settings

1 participant

Comments