Skip to content

fix(worlds): show live cron and subagent sprites - #11877

Merged
iamwhatever merged 1 commit into
mainfrom
fix/agent-worlds-live-agent-sources
Sep 19, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/agent-worlds-live-agent-sources

Conversation

@pepmach

@pepmach pepmach commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Agent Worlds ignored every live cron and subagent returned by the dashboard APIs. A running spawn_run child appeared in Chat, while Worlds showed only the idle parent slot and reported 0 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.

Source Before After
Cron jobs Cast {"jobs": [...]} as an array Read jobs and use is_running for live execution
Subagents Cast {"agents": [...]} as an array Read and filter agents

The hook keeps enabled cron jobs and any job with is_running: true, so pausing a manually started run does not remove its live sprite. In website/src/api/client.ts, the API client declares the jobs and agents envelope 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" beside is_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 -b
  • npm run lint
  • npm run build
  • bash scripts/docs-lint.sh
  • git diff --check

Manual verification

Enabled Agent Worlds through the Apps page in an isolated pod. Before the fix, /api/spawn reported one live child while Worlds rendered 1 agent present, 0 active. After rebuilding the same pod workflow, Worlds rendered the waiting child as a second sprite and reported 2 agents present, 1 active.

Screenshots / video

Before: Chat shows the running child; Worlds omits it and reports 0 active.

Live subagent omitted from Agent Worlds

After: the same waiting-task shape appears as a running sprite and Worlds reports 1 active.

Live subagent rendered in Agent Worlds

Cron sprite -- idle (enabled)

Agent Worlds: enabled cron sprite, idle

Cron sprite -- running

Agent Worlds: cron sprite while the job runs

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@pepmach
pepmach requested review from a team and hoang-phan98 September 18, 2026 19:44
@pepmach

pepmach commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Intent: Make Agent Worlds render active cron jobs and managed subagents from the list APIs it already polls.
Not a goal: Change registry scoping, poll cadence, or scene layout.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of b2f1059a7f1e3848302f8c4be229f74185508a39 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

Suggestions

[DESIGN-REVIEWED] b2f1059

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of b2f1059a7f1e3848302f8c4be229f74185508a39 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 ships

Inventory (7 items) — 7 justified

Intent: 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).

  1. Live subagents now appear as sprites in Agent Worlds — justified
  2. Cron jobs now appear as sprites in Agent Worlds — justified
  3. Cron sprite's running state now tracks actual execution (is_running; old last_status === 'running' was dead — backend pins last_status: "ok" | "error", cron.py:645) — justified
  4. A paused cron keeps its sprite while a manually started run executes — justified
  5. api.crons()/api.spawnList() declare typed envelope returns (7 and 2 real callers counted; typing removes the cast that caused the bug) — justified
  6. Cron and subagent specs document the Worlds polling contract — justified
  7. Regression test with real wire shapes — justified

[FIRST-PRINCIPLES-REVIEWED] b2f1059

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed b2f1059a7f1e3848302f8c4be229f74185508a39 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b2f1059

Verdict parsed from the review's SHA-scoped output markers for commit b2f1059a7f1e3848302f8c4be229f74185508a39.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b2f1059a7f1e3848302f8c4be229f74185508a39: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 5.6 flagged blocking issues on b2f1059a7f1e3848302f8c4be229f74185508a39; Opus 4.8 adjudication downgraded every one of them to advisory. Adjudication downgraded all 1 blocking finding(s) to advisory: the remedy each one requires is disproportionate to the harm it prevents. Read them as advice, not as merge conditions.

This comment is updated in place on each push.

Review details

BLOCKING -- website/src/hooks/useAgentSync.ts:69 -- Poll failures are still converted into an empty Worlds state (origin: validation)

const cronData = await api.crons() / const spawnData = await api.spawnList()
Network rejection or HTTP error -> polling catch suppresses it -> Worlds falsely renders no extra agents without an error surface.
Anchor: errors-use-error-notice
Fix: Expose polling failures and render them through ErrorNotice with askAgent.
[GPT-REVIEWED] b2f1059
[BLOCK-MERGE-DOWNGRADED] b2f1059

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

F1 concerns useAgentSync.ts swallowing poll rejections (lines 76/90) and rendering no extra cron/spawn sprites without an error surface.

  • Conditions: api.crons() (useAgentSync.ts:69) or api.spawnList() (useAgentSync.ts:83) rejects; caught-and-ignored at useAgentSync.ts:76 / useAgentSync.ts:90. Empty render only on initial failure — cronResult/spawnResult are reassigned only on success (:71, :85), so a later failure retains the last good data.
  • Recovery: self-correcting reschedule at useAgentSync.ts:78 (setTimeout(pollCron, 5000)) and :92 (setTimeout(pollSpawn, 3000)) — the next tick (3–5s) repaints.
  • The cited AUTOSDE errors-use-error-notice is blocking: true but its file-patterns is src/**/*.tsx (AUTOSDE.yaml:599–600) and it governs how an error surface renders; this is a .ts hook with no render and a deliberately swallowed background poll, so the blocking rule does not anchor here.
  • Harm rung LOW: a transient, self-correcting, non-destructive omission of decorative live sprites, stale data retained meanwhile. The real fix — threading error state out of an effect-based poller into a consuming .tsx and rendering ErrorNotice/askAgent on a decorative Worlds surface — is permanent complexity exceeding that harm.

[ADJUDICATION] b2f1059 total=1 uphold=0 downgrade=1
DOWNGRADE F1 website/src/hooks/useAgentSync.ts:69 reason=disproportionate-remedy
[GPT-ADJUDICATED] b2f1059

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b2f1059a7f1e3848302f8c4be229f74185508a39: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of b2f1059a7f1e3848302f8c4be229f74185508a39 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 18, 2026
@pepmach

pepmach commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

CI note: Backend Tests (3.12, 2) and Backend Tests (Windows) (2) fail on test/test_ci_fleet_routing_expression_parity.py::test_every_ci_yml_resolver_consumer_reads_the_resolver_not_a_literal -- the resolver-consumer allowlist has been red on main since #11699 landed (the allowlist did not move with the new backend-test consumer); the heal is #11876. This PR does not touch that test; the pair clears with the heal.

@pepmach
pepmach force-pushed the fix/agent-worlds-live-agent-sources branch from 24fee56 to 3f69d0d Compare September 18, 2026 21:31
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 18, 2026
Read the jobs and agents fields from their documented API envelopes so Agent Worlds can render running cron jobs and subagents.
@pepmach
pepmach force-pushed the fix/agent-worlds-live-agent-sources branch from 3f69d0d to b2f1059 Compare September 18, 2026 23:34
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 18, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 19, 2026 00:05

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

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.

@iamwhatever
iamwhatever merged commit 5bc1991 into main Sep 19, 2026
86 checks passed
@iamwhatever
iamwhatever deleted the fix/agent-worlds-live-agent-sources branch September 19, 2026 00:06
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 19, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
Read the jobs and agents fields from their documented API envelopes so Agent Worlds can render running cron jobs and subagents.
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.

Agent Worlds renders no live agents (sub-agents and cron agent sessions never appear as sprites)

2 participants