Give a duplicated coworker the endpoint it was copied from - #328
Open
zopeVaibhav wants to merge 1 commit into
Open
Give a duplicated coworker the endpoint it was copied from#328zopeVaibhav wants to merge 1 commit into
zopeVaibhav wants to merge 1 commit into
Conversation
zopeVaibhav
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 2, 2026 07:23
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.
Closes #327.
What this changes
Duplicating a coworker now gives back a copy that runs where the original ran.
duplicate()wrote the managed Bot's address into every copy without reading the source, so duplicating a coworker hosted at its own AG-UI endpoint produced one answering from a different process under the same name, title and role. The copy'sbuiltInflipped to true as a result, and the connection section hides the endpoint entirely once that is set, so the swap was invisible on the one screen somebody would check.The managed address is the fallback
create()already applies to a coworker given no endpoint. This makesduplicate()treat it the same way rather than as a rule, which fixes three things at once:The endpoint alone is inherited, never the rest of the configuration.
authis a reference into the vault, so copying it would leave two coworkers sharing one credential, where rotating either one's key silently changes the other's. A copy starts with no key and fails closed at its endpoint until somebody gives it one.Not changed here:
avatarSeedis copied from the source and is pinned by an existing test, so a copy still renders the source's avatar. That is worth deciding on its own rather than inside this change.Where it runs
INSERTgains a value read from the row being copied, inside the transaction that already reads it.duplicate()reads its source and writes its copy in one transaction, and the value it now writes comes from that transaction's own read rather than from process configuration. Two replicas duplicating the same source produce two copies with distinct minted ids, exactly as before.Boundary and audit
ManagedAgentUnavailableErrorstill fires, on a strictly smaller set of cases (no managed Bot and no endpoint on the source), and is mapped by the samemapStoreErrorpath as before.Changelog
Unreleased.Proof
Five tests added to
server/tests/agent-profile-store.integration.test.ts, which exercises the real store against Postgres.Run against the unfixed code first, two fail and three pass. The two that fail are the proof; the three that pass pin behaviour this change must not break.
After the change:
The three that passed both before and after:
hasAuthand onauthFromConfigurationover its stored row),Verified end to end against a running server as well, not only in tests. A coworker created at
http://localhost:4201/ag-uiduplicates to a copy athttp://localhost:4201/ag-uiwithbuiltIn: false; an endpoint-less coworker duplicates to the managed address withbuiltIn: true; and a second server started with bothMANAGED_AGENT_*variables unset returns201for the first case where it returned400before.Full server suite run with the local dev server and worker stopped, since they contend on the same database and make the lease tests flap. The set of failing tests is identical with and without this change (six, all pre-existing, in
routine-sweep.integration.test.tsandagent-handoff-*.integration.test.ts); compared by test name rather than by count.typecheck,lintandformatare clean.