Skip to content

feat(canvas): render misconfigured workspaces with configuration_status from agent_card - #2781

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/canvas-show-misconfigured-state
May 4, 2026
Merged

HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/canvas-show-misconfigured-state

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

Closes molecule-controlplane#467. The CP-side change was a no-op — the workspace-server already returns the agent_card JSONB blob with `configuration_status` / `configuration_error` fields (populated by molecule-core PR #2756). The gap was canvas's blindness to those fields.

Before

A workspace whose `adapter.setup()` failed (typically missing/rotated LLM credential) appeared identical to a healthy one: green "Online" status, no error indication. Operator had to dig into logs to discover the env var to set.

After

Misconfigured tile shows:

  • Amber status dot + glow (distinct from emerald online and red failed)
  • "Not configured" label
  • Truncated `configuration_error` preview row (same visual as existing degraded-error preview)
  • aria-label includes the full error for screen readers
  • title attribute carries the error for hover tooltip

Override only applies when `status === "online" AND configuration_status === "not_configured"` — genuinely offline / failed / provisioning workspaces keep existing treatment.

Changes

  • `canvas/src/lib/design-tokens.ts` — STATUS_CONFIG gains `not_configured` entry
  • `canvas/src/store/canvas-topology.ts` — `getConfigurationStatus` + `getConfigurationError` helpers (strict equality on JSONB fields, defensive against unknown values)
  • `canvas/src/components/WorkspaceNode.tsx` — derives effectiveStatus, mounts the configuration_error preview row, threads error into aria-label + title

Test plan

11 new in `canvas-topology-configuration-status.test.ts`, all pass:

`getConfigurationStatus`:

  • null agentCard
  • no configuration_status field
  • returns "ready" when agent reports ok
  • returns "not_configured" when agent reports failure
  • ignores unknown values defensively (string "starting", number, null)

`getConfigurationError`:

  • null agentCard
  • returns null when status is "ready" (defensive against stale errors)
  • returns the error string when status is "not_configured"
  • returns null when error missing
  • returns null when error is empty string
  • returns null when error is non-string

`tsc --noEmit` clean. Component-level visual rendering verified via the unit tests on the helpers + existing WorkspaceNode integration patterns.

E2E verification post-merge

After canvas redeploys to Vercel, operators will see "Not configured: Neither OPENAI_API_KEY nor MINIMAX_API_KEY is set" right on a workspace tile that's launched without an LLM key, instead of a confused-looking green "Online" workspace that 503s every request.

🤖 Generated with Claude Code

…status from agent_card

Closes molecule-controlplane#467 (issue filed against CP, but resolution
landed canvas-side because the workspace-server ALREADY returns the
agent_card JSONB blob with configuration_status / configuration_error
fields populated by molecule-core PR #2756). No CP-side change needed —
the gap was the canvas's blindness to those fields.

Before this PR, a workspace whose adapter.setup() failed (typically
missing/rotated LLM credential) appeared identical to a healthy one in
the canvas tile: green "Online" status, no error indication. The
operator had to dig into workspace logs to discover the env var to set.

This PR surfaces the state via the existing status-pill UX:

1. STATUS_CONFIG gains a "not_configured" entry — amber dot/glow,
   "Not configured" label. Distinct from "online" (emerald) and
   "failed" (red) — the workspace is reachable, it just needs config.

2. canvas-topology exposes getConfigurationStatus / getConfigurationError
   helpers — strict equality on the JSONB field so unknown values
   pass through as null instead of crashing the tile renderer.

3. WorkspaceNode derives an `effectiveStatus` that overrides
   data.status with "not_configured" when (status === "online" AND
   agent_card.configuration_status === "not_configured"). The override
   only applies on top of "online" — a genuinely offline / failed /
   provisioning workspace keeps its existing treatment.

4. The configuration_error string surfaces in two places: the tile's
   aria-label (screen reader access) + a truncated preview row at the
   bottom of the tile (same visual as the existing "degraded error
   preview" — mirrors the established pattern for in-tile error
   surfacing).

Test coverage: 11 new in canvas-topology-configuration-status.test.ts.
Each helper covered for the happy path, missing fields, defensive
ignores of unknown values, and an end-to-end "stale ready overrides
old error" guard.

Once this lands + canvas redeploys, operators see "Not configured:
Neither OPENAI_API_KEY nor MINIMAX_API_KEY is set" right on the
workspace tile instead of a confused-looking green "online" workspace
that silently 503s every JSON-RPC request.

Pairs with: molecule-core PR #2756 (decouple agent-card from setup),
            #2775 (boot_routes pin), #2778 (secret_redactor)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue May 4, 2026
Merged via the queue into staging with commit 3f2cc8c May 4, 2026
21 of 22 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the feat/canvas-show-misconfigured-state branch May 4, 2026 22:24
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