fix(marketplace): the agent detail page never loaded its agent - #740
Conversation
`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>
|
Related: #741 — a separate, deeper bug in the same feature found during the same smoke test (the
|
|
Correction to my earlier note: the claim that the SPA suite "fails wholesale with an Angular JIT error, pre-existing, |
What
AgentDetailPagecalledload()from its constructor.load()readsthis.id()— aninput.required<string>()bound bywithComponentInputBinding()— and the router sets that input after construction. The read threw NG0950 beforeAgentApiService.getAgent()was ever called.The throw landed inside
load()'s owntry/catch, which turned it intothis.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/:idhas 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; nowGET /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.tsat all, which is why CI never caught this. A regression spec is tracked separately.RouterTestingHarnessorcomponentRef.setInput()post-creation. Passingidat 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 branchnpx tsc --noEmit -p tsconfig.app.json— cleanlocalhost:4200Note 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.ymlonly. No backend, no CDK.🤖 Generated with Claude Code