Skip to content

refactor(shared): derive WellKnownAgentType from TuiAgent - #19645

Merged
AmethystLiang merged 1 commit into
mainfrom
remove-wellknown-agent-type
Sep 11, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
remove-wellknown-agent-type

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​31 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​31
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​20

Problem

The WellKnownAgentType was manually-maintained and fell out of sync—three agents ('qwen-code', 'mistral-vibe', 'claude-agent-teams') were missing from the hardcoded 22-member list.

Solution

Derive WellKnownAgentType from TuiAgent (the source of truth for launchable agents) plus 'unknown'. This eliminates manual sync work and auto-covers all launchable agents.

Changed the type from a hardcoded union to TuiAgent | 'unknown', and added compile-time and runtime tests to verify coverage.

The hand-written 22-member WellKnownAgentType union was a stale copy of the
launchable-agent list, 15 members behind TuiAgent: aug, autohand,
claude-agent-teams, cline, codebuff, continue, crush, goose, kilo, kimi, kiro,
mistral-vibe, openclaw, qwen-code, rovo. All 21 non-'unknown' members it did
carry were already TuiAgent members, so the union is now derived
(`TuiAgent | 'unknown'`) and cannot drift again.

'unknown' stays outside TuiAgent: it is the "no agent identified yet" sentinel,
not a launchable agent.

AgentType is structurally unchanged. `(string & {})` absorbs the union, so
AgentType was and remains `string` — this is a documentation/staleness fix with
no behaviour change and zero consumers affected (WellKnownAgentType had none
repo-wide beyond the AgentType alias itself).

tui-agent.ts is a pure type union with no imports, so this adds no cycle.

Adds a type-level coverage test that fails to compile if anyone reverts to a
hand-written list.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • WellKnownAgentType now derived from TuiAgent — replaces the hand-maintained 22-member union with TuiAgent | 'unknown', so the well-known set can no longer drift from the launchable agents (qwen-code, mistral-vibe, claude-agent-teams were previously dropped).
  • Two compile-time contract tests — widenTuiAgent proves TuiAgent remains assignable to WellKnownAgentType (fail-to-compile if the union is ever narrowed below the launchable set), and keeps AgentType open to custom agent names pins the trailing (string & {}).

The refactor is sound: WellKnownAgentType has no production consumers (only AgentType, which stays open via (string & {}) and is semantically unchanged at runtime), all 21 prior members survive in the 36-member TuiAgent union, and the import type adds no runtime dependency. The two new tests are idiomatic "compile-time proof" guards matching existing patterns in the codebase; their expect(...) bodies are deliberately trivial since the value is in the type-level assertion. Verified agent-status-types.test.ts passes (55 tests).

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6a6de14a-500d-47f7-9828-f0ae0186e06b

📥 Commits

Reviewing files that changed from the base of the PR and between 12f2c6b and 701063b.

📒 Files selected for processing (2)
  • src/shared/agent-status-types.test.ts
  • src/shared/agent-status-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

WellKnownAgentType now derives from TuiAgent and retains the unknown value. The tests verify compatibility with TuiAgent, coverage for qwen-code, mistral-vibe, claude-agent-teams, unknown, and rovo, and continued support for custom AgentType values.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 70106

Well-known agent identifiers now automatically follow the launchable TUI agent set while retaining the unknown sentinel and custom agent support. The change is ready to merge with no identified current-head risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem and solution, but it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, boundary confirmation,… Complete the required template sections. Add an issue reference after "Fixes #"; provide testing details and checklist status; add N/A with a reason for Visual Proof; complete ELI5, Why, Review, boundary, Notes, and AI Disclosure sections…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states the primary change: deriving WellKnownAgentType from TuiAgent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem and solution, but it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, boundary confirmation, Notes, and the Checklist.

Resolution

Complete the required template sections. Add an issue reference after "Fixes #"; provide testing details and checklist status; add N/A with a reason for Visual Proof; complete ELI5, Why, Review, boundary, Notes, and AI Disclosure sections as applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@AmethystLiang
AmethystLiang merged commit 37603a6 into main Sep 11, 2026
29 checks passed
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.

1 participant