Skip to content

fix(workspace): use SDK constant for agent-card readiness probe - #2193

Merged
hongmingwang-moleculeai merged 1 commit into
stagingfrom
fix/agent-card-well-known-path-probe
Apr 27, 2026
Merged

fix(workspace): use SDK constant for agent-card readiness probe#2193
hongmingwang-moleculeai merged 1 commit into
stagingfrom
fix/agent-card-well-known-path-probe

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

External user reported /.well-known/agent.json 404 from the workspace runtime. The route IS mounted — the probe in workspace/main.py was looking at the wrong place.

After the a2a-sdk 1.x bump, the SDK started mounting the agent card at the new canonical path (the value of a2a.utils.constants.AGENT_CARD_WELL_KNOWN_PATH). The initial-prompt readiness probe still hardcoded the pre-1.x literal, so it 404'd every attempt and silently fell through to "Initial prompt: server not ready after 30s, skipping". Net effect: every workspace silently dropped its initial_prompt from config.yaml — the agent never sent the kickoff self-message, and users hit a fresh chat with no context.

Fix

Import AGENT_CARD_WELL_KNOWN_PATH from a2a.utils.constants and use it directly in the probe URL. The SDK constant is now the single source of truth — any future rename travels through automatically.

Regression coverage

Two static invariants in workspace/tests/test_agent_card_well_known_path.py:

  1. No hardcoded /.well-known/agent.json literal anywhere in main.py.
  2. The probe URL fstring interpolates AGENT_CARD_WELL_KNOWN_PATH (catches a "fix" that imports the constant for show but reverts to a literal in the actual GET).

(A runtime cross-check against create_agent_card_routes() was prototyped but the workspace tests/conftest.py mocks the entire a2a package for executor unit tests, so the real SDK isn't reachable in this directory's pytest session. The two static checks are sufficient: by always following the SDK constant we follow any rename automatically; SDK's own constant↔mount alignment is the SDK's responsibility.)

Verification

  • Manually inside ghcr.io/molecule-ai/workspace-template-langgraph:latest: AGENT_CARD_WELL_KNOWN_PATH == '/.well-known/agent-card.json' and create_agent_card_routes(card) mounts at exactly that path — constant + mount are aligned in the runtime image.
  • Workspace test suite: 1209 passed, 2 xfailed.

Test plan

  • CI green
  • On a freshly-provisioned workspace with initial_prompt set in config.yaml, confirm the agent receives the kickoff self-message (no longer "server not ready after 30s, skipping" in container logs)

🤖 Generated with Claude Code

The initial-prompt readiness probe in workspace/main.py hardcoded the
pre-1.x well-known path. After the a2a-sdk 1.x bump the SDK started
mounting the agent card at the new canonical path (the value of
`a2a.utils.constants.AGENT_CARD_WELL_KNOWN_PATH`), so the probe
returned 404 every attempt and silently fell through to "server not
ready after 30s, skipping". Net effect: every workspace silently
dropped its `initial_prompt` from config.yaml — the agent never sent
the kickoff self-message, and users hit a fresh chat with no context.

Reported by an external user as "/.well-known/agent.json 404 — the
a2a-sdk agent card route was not being mounted at the expected path".
The route IS mounted; the probe was looking at the wrong place.

Fix imports `AGENT_CARD_WELL_KNOWN_PATH` from `a2a.utils.constants`
and uses it directly in the probe URL — the SDK constant is now the
single source of truth, so any future rename travels through
automatically.

Adds two static regression tests pinning the invariant:
  1. No hardcoded `/.well-known/agent.json` literal anywhere in
     main.py.
  2. The probe URL fstring interpolates AGENT_CARD_WELL_KNOWN_PATH
     (catches a "fix" that imports the constant for show but reverts
     to a literal in the actual GET).

Verified manually inside ghcr.io/molecule-ai/workspace-template-langgraph
that AGENT_CARD_WELL_KNOWN_PATH == '/.well-known/agent-card.json' and
that `create_agent_card_routes(card)` mounts at exactly that path —
constant + mount are aligned in the runtime image, so the probe will
now find the server.

Full workspace test suite: 1209 passed, 2 xfailed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged via the queue into staging with commit b9c867a Apr 27, 2026
14 checks passed
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…2193 — mkdir /home/hongming perm denied halting prod rollout)
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…— unblock fleet-wide deploys (#2193)' (#2196) from sre/fix-auto-deploy-writable-home-2193 into main
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