Commit 3ca1185
feat(agentex-ui): filter out build-only agents from the agents list (#264)
## Summary
Fast follow to the build-time-agent-creation work.
[AGX1-308](https://linear.app/scale-epd/issue/AGX1-308) added a
`BUILD_ONLY` (`"BuildOnly"`) value to `AgentStatus`: agents registered
at build time have an `agents` row but no `acp_url` and are not routable
until deploy-time registration flips them to `Ready`.
Before this change those rows rendered in the agents list as a
greyed-out, disabled badge, cluttering the list of deployed, routable
agents. This PR filters them out.
## Changes
- `agentex-ui/components/agents-list/agents-list.tsx`: filter agents
with the `BuildOnly` status out of the displayed list, alongside the
existing `selectedAgentName` filter.
## Notes
- **Where the filter lives:** done in the presentation component rather
than the `useAgents` hook, which is documented as fetching "the complete
list of agents." Keeps the hook pure and does display filtering at the
view layer.
- **SDK type gap:** the published `agentex` SDK (`0.1.0-alpha.9`) is
stale: its `Agent.status` union doesn't include `'BuildOnly'` yet. The
constant is typed as `string` so the comparison type-checks cleanly
without a cast, with a comment flagging the gap. When the SDK is
regenerated to include `BuildOnly`, the constant can be narrowed.
- **Dependency:** relies on the SDK actually returning `BuildOnly` to
the frontend ([AGX1-310](https://linear.app/scale-epd/issue/AGX1-310)).
Harmless before then since no agent carries that status.
## Verification
- `tsc --noEmit` → clean
- `next lint` → no warnings/errors
- pre-commit hooks → passed
Closes AGX1-311
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Filters agents with `BuildOnly` status out of the displayed agents list
so build-time-only (non-routable) agent rows don't appear alongside
deployed agents.
- Introduces a module-level `BUILD_ONLY_STATUS` constant (typed as
`string` due to an acknowledged SDK type gap) and applies a pre-filter
before the existing `selectedAgentName` filter.
- Filter lives in the presentation component rather than in `useAgents`,
cleanly separating display logic from data-fetching concerns.
<details><summary><h3>Confidence Score: 5/5</h3></summary>
The change is a one-line filter addition; it correctly hides
non-routable build-time agents and is harmless before the backend starts
returning the new status.
The logic is straightforward and the edge cases (no BuildOnly agents
yet, selectedAgentName interaction) are handled correctly. The only note
is that routableAgents could be memoized, but that is a minor style
point with no correctness impact.
No files require special attention.
</details>
<h3>Important Files Changed</h3>
| Filename | Overview |
|----------|----------|
| agentex-ui/components/agents-list/agents-list.tsx | Adds a
BUILD_ONLY_STATUS constant and filters agents with that status before
display; logic is correct and well-documented, minor opportunity to
memoize the derived array. |
</details>
<details><summary><h3>Flowchart</h3></summary>
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[agents prop] --> B{filter: status !== BuildOnly}
B -->|routableAgents| C{selectedAgentName set?}
C -->|Yes| D[filter: name === selectedAgentName]
C -->|No| E[use routableAgents as-is]
D --> F[displayedAgents]
E --> F
F --> G{any agents?}
G -->|Yes| H[render AgentBadge list]
G -->|No| I[render No agents found]
```
</details>
<a
href="https://app.greptile.com/api/ide/cursor?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fagents-list%2Fagents-list.tsx%3A32-34%0AThe%20%60routableAgents%60%20filter%20re-runs%20on%20every%20render%20even%20when%20%60agents%60%20hasn't%20changed.%20Wrapping%20it%20in%20%60useMemo%60%20prevents%20redundant%20work%20and%20aligns%20with%20the%20team's%20practice%20of%20memoizing%20derived%20values%20used%20in%20component%20render%20logic.%0A%0A%60%60%60suggestion%0A%20%20const%20routableAgents%20%3D%20useMemo%28%0A%20%20%20%20%28%29%20%3D%3E%20agents.filter%28agent%20%3D%3E%20agent.status%20!%3D%3D%20BUILD_ONLY_STATUS%29%2C%0A%20%20%20%20%5Bagents%5D%0A%20%20%29%3B%0A%60%60%60%0A%0A&pr=264&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursorDark.svg?v=3"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursor.svg?v=3"><img
alt="Fix All in Cursor"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursor.svg?v=3"
height="20"></picture></a> <a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fagents-list%2Fagents-list.tsx%3A32-34%0AThe%20%60routableAgents%60%20filter%20re-runs%20on%20every%20render%20even%20when%20%60agents%60%20hasn't%20changed.%20Wrapping%20it%20in%20%60useMemo%60%20prevents%20redundant%20work%20and%20aligns%20with%20the%20team's%20practice%20of%20memoizing%20derived%20values%20used%20in%20component%20render%20logic.%0A%0A%60%60%60suggestion%0A%20%20const%20routableAgents%20%3D%20useMemo%28%0A%20%20%20%20%28%29%20%3D%3E%20agents.filter%28agent%20%3D%3E%20agent.status%20!%3D%3D%20BUILD_ONLY_STATUS%29%2C%0A%20%20%20%20%5Bagents%5D%0A%20%20%29%3B%0A%60%60%60%0A%0A&repo=scaleapi%2Fscale-agentex&pr=264&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=3"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=3"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=3"
height="20"></picture></a> <a
href="https://chatgpt.com/codex/deeplink?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22scaleapi%2Fscale-agentex%22%20on%20the%20existing%20branch%20%22ronakpatel%2Fagx1-311-fast-follow-agentex-ui-filter-out-build-only-agents%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22ronakpatel%2Fagx1-311-fast-follow-agentex-ui-filter-out-build-only-agents%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fagents-list%2Fagents-list.tsx%3A32-34%0AThe%20%60routableAgents%60%20filter%20re-runs%20on%20every%20render%20even%20when%20%60agents%60%20hasn't%20changed.%20Wrapping%20it%20in%20%60useMemo%60%20prevents%20redundant%20work%20and%20aligns%20with%20the%20team's%20practice%20of%20memoizing%20derived%20values%20used%20in%20component%20render%20logic.%0A%0A%60%60%60suggestion%0A%20%20const%20routableAgents%20%3D%20useMemo%28%0A%20%20%20%20%28%29%20%3D%3E%20agents.filter%28agent%20%3D%3E%20agent.status%20!%3D%3D%20BUILD_ONLY_STATUS%29%2C%0A%20%20%20%20%5Bagents%5D%0A%20%20%29%3B%0A%60%60%60%0A%0A"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=3"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=3"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=3"
height="20"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
agentex-ui/components/agents-list/agents-list.tsx:32-34
The `routableAgents` filter re-runs on every render even when `agents` hasn't changed. Wrapping it in `useMemo` prevents redundant work and aligns with the team's practice of memoizing derived values used in component render logic.
```suggestion
const routableAgents = useMemo(
() => agents.filter(agent => agent.status !== BUILD_ONLY_STATUS),
[agents]
);
```
`````
</details>
<sub>Reviews (1): Last reviewed commit: ["feat(agentex-ui): filter out
build-only
..."](ab5cd7a)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=35237524)</sub>
<!-- /greptile_comment -->
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 35fcae2 commit 3ca1185
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
26 | 36 | | |
27 | | - | |
28 | | - | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
0 commit comments