Skip to content

fix(ai): keep platform agents in catalog regardless of alias-map timing (ADR-0063 follow-up) - #2192

Closed
xuyushun441-sys wants to merge 2 commits into
mainfrom
fix/ai-agent-catalog-alias
Closed

fix(ai): keep platform agents in catalog regardless of alias-map timing (ADR-0063 follow-up)#2192
xuyushun441-sys wants to merge 2 commits into
mainfrom
fix/ai-agent-catalog-alias

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Follow-up to #2181 (ADR-0063/0064). Found during live verification on the EE rig: GET /api/v1/ai/agents returned only {ask} — the build agent was missing — because listAgents() filtered the catalog by the in-memory registerAgentAlias values, and the cloud studio package's metadata_assistantbuild alias wasn't applied to the runtime's map at request time (bundle module-load ordering). A missed alias must never hide a real platform agent.

Change

  • listAgents() recognises a platform agent by the intrinsic package-protection envelope stamped on built-ins at registration (_provenance/_lock/_packageId, or a still-public protection block) via isPlatformAgentRecord(...), with the alias-table values kept only as a belt-and-suspenders fallback.
  • Stray tenant custom agents (ADR-0063 §2, withdrawn) still stay filtered out of the catalog.

Pairs with cloud-side robustness for the studio alias registration (objectstack-ai/cloud#419).

Verified on the EE rig after the fix; no spec/schema change (no liveness impact).

🤖 Generated with Claude Code

os-zhuangand others added 2 commits June 22, 2026 17:01
…ecouple agent catalog from it
Live EE-rig verification of ADR-0063/0064 surfaced two coupled defects in the
AI agent catalog/alias layer:
1. GET /api/v1/ai/agents omitted `build` even though build chat worked.
2. POST /api/v1/ai/agents/metadata_assistant/chat 404'd — the legacy alias was dead.
Root cause (deeper than the suspected record-init order): `@objectstack/service-ai`
ships BOTH an ESM (`import`→index.js) and a CJS (`require`→index.cjs) build, and the
alias table was a module-level `new Map()` — so each build got its OWN copy. The
cloud AI Studio plugin is bundled as CJS and `require`s the CJS copy to register
`metadata_assistant`→`build`, while the framework agent routes load as ESM and read
the ESM copy — the alias was written to a Map nobody read.
- agent-aliases: anchor the registry (and its `data_chat`→`ask` seed) on a
`Symbol.for` key on globalThis so the ESM and CJS builds share ONE table.
- agent-runtime.listAgents: stop keying catalog membership solely on the in-memory
alias-table values. Decide membership from an INTRINSIC, persisted package
signal (`_provenance:'package'`/`_lock`, or a pre-translation `protection`
block), with the alias values kept as a fallback union. A missed alias must
never hide a real platform agent (ADR-0063 §2 still hides stray tenant agents).
- ask-agent: carry a package `protection` block (lock:'full'); translate it to the
runtime `_lock`/`_provenance` envelope at register via applyProtection so the
catalog signal is present and the built-in persona is locked against overlay edits.
Tests: globalThis-shared registry; listAgents surfaces a platform agent via the
intrinsic signal with NO alias registered, and still hides an envelope-less tenant
agent. Full service-ai suite green (409).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 22, 2026 9:29am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

No hand-written docs reference the 0 changed package(s). ✅

@xuyushun441-sys

Copy link
Copy Markdown
ContributorAuthor

Closing as a duplicate — the framework catalog/alias fix already landed via #2190 (commit 6fefb1a), which cloud#419 pins. This branch is an earlier divergent copy of the same fix; merging it would regress #2190's refinements.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang