Skip to content

fix(marketplace): the agent detail page never loaded its agent - #740

Merged
philmerrell merged 1 commit into
developfrom
fix/agent-detail-page-load
Jul 25, 2026
Merged

fix(marketplace): the agent detail page never loaded its agent#740
philmerrell merged 1 commit into
developfrom
fix/agent-detail-page-load

Conversation

@philmerrell

@philmerrell philmerrell commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What

AgentDetailPage called load() from its constructor. load() reads this.id() — an input.required<string>() bound by withComponentInputBinding() — and the router sets that input after construction. The read threw NG0950 before AgentApiService.getAgent() was ever called.

The throw landed inside load()'s own try/catch, which turned it into this.error.set('Failed to load this agent.'). The page rendered a plausible error banner with no HTTP request behind it: no console error, no failed request in the network tab, nothing to grep for.

/agents/:id has been in this state since phase 3 (66f38346) — the detail page has never successfully loaded in a browser.

Fix: move both init calls to ngOnInit, which runs after input binding.

How it was found

Running the phase 5–7 dev smoke test, where the detail page is the only surface carrying the pin control.

Before / after on dev, same URL: previously the error banner with zero requests to :8000; now GET /agents/{id} → 200, GET /agents/{id}/runnability → 200, and the page renders the hero band, details, "What it can access" and the runnability line.

The rest of that smoke test passed — the phase 5/6 pin acceptance path (pin → unpin → reload → seed role pin → tombstone beats seed → lock overrides) behaves exactly as specced.

Test coverage

There is no agent-detail.page.spec.ts at all, which is why CI never caught this. A regression spec is tracked separately.

⚠️ For whoever writes it: the spec must set the input the way the router does — after creation, e.g. via RouterTestingHarness or componentRef.setInput() post-creation. Passing id at construction time reproduces neither the bug nor the fix, so a naive spec would pass against the broken code.

Verification

  • npm test (i.e. ng test) — 136 files, 1560 tests, all passing on this branch
  • npx tsc --noEmit -p tsconfig.app.json — clean
  • Verified live against dev through localhost:4200

Note on flakiness: a first run showed 6 failures in agents/agent-form/agent-form.page.spec.ts (5000ms timeouts); a re-run was fully green. That's the known load-dependent flake in that file, unrelated to this change.

Deploy

frontend-deploy.yml only. No backend, no CDK.

🤖 Generated with Claude Code

`AgentDetailPage` called `load()` from its constructor, and `load()` reads
`this.id()` — an `input.required<string>()` bound by `withComponentInputBinding()`.
The router sets that input *after* construction, so the read threw NG0950 before
`AgentApiService.getAgent()` was ever called.

The throw landed inside `load()`'s own try/catch, which turned it into
`this.error.set('Failed to load this agent.')`. So the page rendered a plausible
error banner with **no HTTP request behind it** — no console error, no failed
request, nothing to grep for. `/agents/:id` has been in this state since phase 3
(66f3834); the detail page has never successfully loaded in a browser.

Moved both init calls to `ngOnInit`, which runs after input binding.

Found while running the phase 5-7 dev smoke test, where the detail page is the
only surface carrying the pin control. There is no `agent-detail.page.spec.ts` at
all, which is why CI never caught it — a regression spec is tracked separately.
Note that a spec asserting this must set the input the way the router does (after
creation, e.g. via `RouterTestingHarness`); passing `id` at construction time
reproduces neither the bug nor the fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@philmerrell

Copy link
Copy Markdown
Contributor Author

Related: #741 — a separate, deeper bug in the same feature found during the same smoke test (the @-mention forks conversation history across two cached agent instances). Independent of this fix; no shared files.

⚠️ Coordination note for the regression spec being written for this page: it depends on this PR. Branched off develop before #740 merges, a correct spec will fail — that is the bug reproducing, not a broken test.

@philmerrell

Copy link
Copy Markdown
Contributor Author

Correction to my earlier note: the claim that the SPA suite "fails wholesale with an Angular JIT error, pre-existing, npm ci is the likely cure" was wrong. The cause was that I ran bare npx vitest run — there is no standalone vitest config in this repo, so specs must run via ng test (npm test). The body's verification section is updated: 136 files / 1560 tests all pass on this branch.

@philmerrell
philmerrell merged commit ac5fde4 into develop Jul 25, 2026
4 checks passed
@philmerrell
philmerrell deleted the fix/agent-detail-page-load branch July 25, 2026 20:56
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