Repository navigation
fix(registry): show public agents when the session cookie is stale - #7825
Merged
Merged
Conversation
Since #7462, optionalAuth returns 401 for a present-but-unusable wos-session cookie instead of treating the caller as anonymous. The Agents page swallowed that error and rendered an empty registry. Retry the public list once with credentials omitted on 401, and show an error instead of an empty grid for any other failure. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, well-targeted UI fix.
Checked:
server/public/agents.html:fetchRegistryAgentsnow retries a stale-cookie 401 anonymously and fails-closed to an error surface instead of rendering an empty registry. Dropping thedata.agents || datafallback is verified dead against the endpoint contract (registry-api.ts:1713 returns{ agents: [...], count }).- App-only change with no protocol surface touched (no
static/schemas/source/**,docs/reference/**,dist/**, or release scripts), so no changeset is required and none is needed. - Both branches covered by tests in
server/tests/unit/public-agent-registry-ui.test.ts; test plan fully checked.
Gate evaluation:
- No critical/high findings (row 1 n/a).
gated_paths: false, so row 2 does not apply despitereview_decision: REVIEW_REQUIRED.high_risk: false; no deleted/modified high-risk paths (rows 3, 5 n/a).- No medium findings (rows 4, 8 n/a).
- No no-auto-approve team match (row 7 n/a).
- No prior decision (row 6 n/a).
Falls through to row 9 → approve.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reported in Slack: https://adcontextprotocol.org/registry/ showed an empty Agents list for a signed-in user (repro: open the site in two tabs, log in on one, refresh the other).
Since #7462,
optionalAuthreturns 401 when awos-sessioncookie is present but unusable, instead of treating the caller as anonymous./api/registry/agentssits behindoptAuth. The Agents page then diddata.agents || data,.map()threw on the error object, thecatchswallowed it, and the page rendered zero agents. Meanwhile the HTML render path (getUserFromRequest) quietly treats the same cookie as logged out, and the AdCP session bridge skips because a cookie is present, so the page never recovers.Verified against production:
Changes
server/public/agents.html: a newfetchRegistryAgents()helper used by all three list fetches. On a 401 it retries once withcredentials: 'omit'. A request with no cookie at all is still anonymous under fix(auth): hydrate primary authorization snapshots per request #7462's policy, so this keeps it intact. Any other failure now shows an error message instead of an empty grid.server/tests/unit/public-agent-registry-ui.test.ts: behavioral tests that run the helper against a mockedfetch: 401 → anonymous retry succeeds; 503 surfaces as an error without a retry.Brands, Properties, Policies and Members call endpoints that don't use
optionalAuth, so they weren't affected.When the retry kicks in, that load shows only public agents. Members-only agents need a valid session.
Follow-ups (not in this PR)
getUserFromRequestrefreshes sessions without callingstoreRefreshedSession. Other copies of the cookie (the AdCP copy made by the bridge, in-flight requests) then can't recover and turn into dead cookies. That's the likely source of the stale cookie.optionalAuthendpoints (events, committees, perspectives,/api/config) can probably fail the same way.Test plan
npx vitest run tests/unit/public-agent-registry-ui.test.ts(6 passed)node --check🤖 Generated with Claude Code
Open workspace in Conductor