Repository navigation
fix(worlds): show live cron and subagent sprites - #11877
Conversation
|
Intent: Make Agent Worlds render active cron jobs and managed subagents from the list APIs it already polls. |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. Suggestions
[DESIGN-REVIEWED] b2f1059 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Item 4 — a paused cron with a live run now stays visible — is the one judgement call inside the fix; confirm #11802 intended it. What this change shipsInventory (7 items) — 7 justifiedIntent: make Agent Worlds actually show the live crons and subagents the dashboard APIs already return — a FIX (issue #11802; both envelope shapes verified against the backend handlers).
[FIRST-PRINCIPLES-REVIEWED] b2f1059 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 5.6 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- website/src/hooks/useAgentSync.ts:69 -- Poll failures are still converted into an empty Worlds state (origin: validation)
Adjudication (Opus 4.8) — is blocking on each finding proportionate?F1 concerns
[ADJUDICATION] b2f1059 total=1 uphold=0 downgrade=1 False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify live that a paused cron's sprite (enabled: false, is_running: true) disappears once its run completes — the one state no screenshot can distinguish. [UX-REVIEWED] b2f1059 |
|
CI note: |
24fee56 to
3f69d0d
Compare
Read the jobs and agents fields from their documented API envelopes so Agent Worlds can render running cron jobs and subagents.
3f69d0d to
b2f1059
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: /api/crons and /api/spawn answer with {jobs} / {agents} envelopes rather than bare arrays, so the sprite lists filtered an array that was never there and always rendered empty; the fix reads the envelope and keys running off is_running. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/learn-cron-dashboard.md, docs/system-specs/modules/subagent.md.
Read the jobs and agents fields from their documented API envelopes so Agent Worlds can render running cron jobs and subagents.
Problem / Motivation
Agent Worlds ignored every live cron and subagent returned by the dashboard APIs. A running
spawn_runchild appeared in Chat, while Worlds showed only the idle parent slot and reported0 active.Why it matters
Agent Worlds advertises an at-a-glance view of live agents, crons, and subagents. Dropping two of those three sources makes the app look idle during real delegated or scheduled work.
What changed (motivation → approach → change)
In
website/src/hooks/useAgentSync.ts, both list endpoints return envelope objects, but the hook cast those objects to arrays. Calling.filter()threw, and the hook's best-effort catches kept the extra-agent list empty.{"jobs": [...]}as an arrayjobsand useis_runningfor live execution{"agents": [...]}as an arrayagentsThe hook keeps enabled cron jobs and any job with
is_running: true, so pausing a manually started run does not remove its live sprite. Inwebsite/src/api/client.ts, the API client declares thejobsandagentsenvelope return types, so callers compile against those fields without casts.The regression test supplies the real wire shapes and expects one live sprite from each source. It keeps
last_status: "ok"besideis_running: true, proving a cron's latest outcome cannot substitute for its current execution state. The cron and subagent specs document these contracts.Backwards compatibility
Compatible: the API responses and rendered layout are unchanged; the existing hook reads fields those responses already provide.
Tests
npx vitest run src/test/useAgentSync.defaultLabel.test.tsx(6 passed; the paused-running cron case failed before the filter fix)npx vitest run src/components/CrewWakeSection.test.tsx src/test/SubagentProgressBar.test.tsx(54 passed)npx tsc -bnpm run lintnpm run buildbash scripts/docs-lint.shgit diff --checkManual verification
Enabled Agent Worlds through the Apps page in an isolated pod. Before the fix,
/api/spawnreported one live child while Worlds rendered1 agent present, 0 active. After rebuilding the same pod workflow, Worlds rendered the waiting child as a second sprite and reported2 agents present, 1 active.Screenshots / video
Before: Chat shows the running child; Worlds omits it and reports
0 active.After: the same waiting-task shape appears as a running sprite and Worlds reports
1 active.Cron sprite -- idle (enabled)
Cron sprite -- running
Related Issues
Fixes #11802
Pattern harvest
Rule candidate: review-prompt
Pattern: Frontend list consumers must read the documented response envelope instead of casting the response object to an array.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)