Skip to content

fix(artifacts): an interactive artifact calls its agent's API outside its agent's chat - #6738

Open
dam-application[bot] wants to merge 2 commits into
mainfrom
fix/6737-artifact-standalone-agent-api
Open

dam-application[bot] wants to merge 2 commits into
mainfrom
fix/6737-artifact-standalone-agent-api

Conversation

@dam-application

@dam-application dam-application Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What and why

An interactive HTML artifact opened with Open in new tab (/artifacts/<id>/view) could not reach its agent's Artifact API. The page's server answered 401 to every data request. The Artifacts library's docked panel had the same fault. Both places mount ArtifactPanel with no chat agent (agentId={null}), and that closed the whole bridge, the Agent API relay included.

This change splits the Agent API condition out of canUseArtifactBridge. The relay now needs only the latest version of a non-public interactive HTML page that an agent published. Sending a prompt into the open chat still needs that chat to be the publishing agent's.

Reviewer guide

  • What changes in substance: a new canUseArtifactAgentApi(artifact, version) gates the Agent API relay at every mount. canUseArtifactBridge is now that condition plus "the open chat is the artifact's agent", and gates only onSendPrompt. canStartArtifactSession reuses the new condition, as it was the same check.
  • Where to look closely: the relay is now also on beside another agent's chat (open). The page still calls only its own agent: the call names the artifact, and the api-server resolves the agent from it and checks ownership on every call (agentApiAccess). No new server path.
  • Ruled out: passing the artifact's own agentId into the panel on the standalone page. That would also turn on send-prompt-to-chat with no chat, which the issue says must stay off.

Scope

  • packages/ui/src/modules/artifacts/lib/artifact-bridge.ts — the split condition.
  • packages/ui/src/modules/artifacts/components/artifact-panel.tsx — the relay uses the new condition; bridgeOpen is renamed chatPromptOpen.
  • Tests: artifact-prompt.test.ts (condition with agentId=null), new artifact-panel-agent-api.test.ts (what the frame gets at each mount).
  • Docs: docs/architecture/artifact-library.md and the Artifact Bridge entry in docs/ubiquitous-language.md say where the relay works.

Testing

  • mise run check: passed.
  • mise run test: stopped at one vm-runner test, boot::tests::an_entry_holding_a_locked_file_is_kept_whole. It fails every time in this sandbox and this change does not touch vm-runner. The full UI suite then ran alone: 342 files, 2283 tests passed.
  • The new panel test fails on main for the standalone page, a restricted artifact and the library panel (3 of 6 cases), and passes with the change.
  • No demo: showing it for real needs an agent that serves an Artifact API inside an Environment. The unit tests cover the gate.

Fixes #6737

Written by this agent — https://dam-dev.apps.dam-cl.fmaas.res.ibm.com/a/agent-677ca492fbca62dd?s=5759df75-6a4e-4283-8674-27060cf88aeb

🤖 Generated with Claude Code

dam-application Bot and others added 2 commits November 19, 2026 14:57
… its agent's chat

The standalone page (Open in new tab) and the Artifacts library dock
ArtifactPanel with agentId=null, which closed the whole bridge, so the
frame relayed no Agent API requests and the page's server answered 401.
Split the Agent API condition out of canUseArtifactBridge: the relay now
needs only the latest version of a non-public interactive HTML page an
Agent published; sending a prompt into the chat still needs that chat.

Fixes #6737

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dam-application dam-application Bot added agent/karel Claims and pull requests of software-developer agent Karel (agent-677ca492fbca62dd) code-guardian:review Add this label to trigger an automatic review by code-guardian. labels Nov 19, 2026
@github-actions github-actions Bot added qa:design and removed code-guardian:review Add this label to trigger an automatic review by code-guardian. agent/karel Claims and pull requests of software-developer agent Karel (agent-677ca492fbca62dd) labels Nov 19, 2026

@dam-code-protector dam-code-protector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Code Guardian 🛡️ — ⚠️ Code Review @ 9825756

PR #6738: fix(artifacts): an interactive artifact calls its agent's API outside its agent's chat

Author: dam-application[bot] | Branch: fix/6737-artifact-standalone-agent-api → main | Changes: +229 −21 (6 files)

Summary

The PR splits the Agent API gate out of canUseArtifactBridge, so a page calls its Agent outside that Agent's chat. Prompts into the open chat keep the old gate.

2 suggestion(s) dropped under the 🟢 budget.

Findings

  • 🟡 Warning: Two in-tree statements still say that request works only beside the publishing Agent's chat. The platform-artifacts skill tells agents that elsewhere in the app the call times out after 3 minutes. The architecture page says that the preview outside that chat sends no requests. Agents build pages from that skill, so they design for a failure that no longer occurs. Reported by Documentation Check (doc-drift). (packages/agents/base/rootfs/app/working-dir/.agents/skills/platform-artifacts/SKILL.md:127, docs/architecture/artifact-library.md:84).
    Fix: State in both places that request and whoami work wherever the owner opens the latest version in the app. Then regenerate the skill's entry in dam-skill-manifest.json.
  • ✅ Looks good: The new panel test fails 4 of 6 cases on main and passes at HEAD. The api-server still checks owner, kind, interactivity and visibility on every relayed call.

Documentation Check (doc-drift)

✅ No findings.

Issue Fit

✅ No findings.

TypeScript Engineering Review

✅ No findings.

React UI Engineering Review

  • 🟢 Suggestion: canUseArtifactBridge now gates only a prompt into the open chat, but its name still says "the bridge". The panel renames its result to chatPromptOpen to stay readable. A name such as canSendArtifactChatPrompt stops a later caller from gating request with it again. (packages/ui/src/modules/artifacts/components/artifact-panel.tsx:121).

Verdict

COMMENT — The code change is correct, but the agent-facing skill still states the old rule for request.


Review by Code Guardian 🛡️ · automated code guardian · ibm/aws/claude-opus-5-5 on pi

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI - Artifact opened in a new tab cannot call its agent's API

0 participants