Skip to content

fix(agents): trust the deployment-run managed agent address - #932

Open
sx4im wants to merge 2 commits into
CopilotKit:mainfrom
sx4im:fix-888-managed-agent-loopback
Open

sx4im wants to merge 2 commits into
CopilotKit:mainfrom
sx4im:fix-888-managed-agent-loopback

Conversation

@sx4im

@sx4im sx4im commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

What this changes

Fixes #888. A Bot with no endpoint ("Run it here") is bound to the deployment's managed agent (MANAGED_AGENT_AG_UI_URL). When that address was on loopback, every message to the Bot failed at the endpoint check ("this deployment will not dial ... : that address is inside OpenBot's own network"), even though the address is the deployment's own setting, not something a person typed.

The managed agent's host and port (and a picked harness URL when one is installed) now join the allowed hosts the endpoint check consults, so only person-typed addresses go through the private-network refusal. The never-allowed list is still checked first, so this cannot admit the metadata address or a non-web address.

Where it runs

Config parsing at boot; the set is built once and read on every agent dial.

  • New state that outlives a request? None. The set is built at boot from configuration.
  • What happens on the second replica? Identical outcome: same environment, same set.
  • Anything serialised? Nothing new.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No.

Boundary and audit

  • Every acting call still goes through the gateway: resolve, decide, audit, then act.
  • New refusals and new failures each write a row. No new refusal paths; strictly fewer false refusals.
  • Nothing new is trusted from the client that the server can resolve itself.

Changelog

  • A line in CHANGELOG.md under Unreleased.

Proof

bun test server/tests/config.test.ts: 151 pass, 0 fail. bun test server/tests/agent-endpoint.test.ts: 48 pass, 0 fail. tsc --noEmit clean on server. New tests cover: the managed agent's host:port joining the set, the picked harness URL joining, and the #888 repro end to end (checkAgentEndpoint on http://127.0.0.1:41706/ag-ui refuses without the implicit trust and allows with the config's set).

Fixes #888

A Bot with no endpoint (Run it here) is bound to MANAGED_AGENT_AG_UI_URL.
When that address was on loopback, every message failed at the endpoint
check, even though the address is the deployment's own setting rather
than something a person typed. The managed agent's host and port (and a
picked harness URL, when one is installed) now join the allowed hosts the
endpoint check consults, so only person-typed addresses go through the
private-network refusal.

Fixes CopilotKit#888

This branch has not been deployed

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

Labels

None yet

2 participants