Skip to content

Commit 071974d

Browse files
feat(desktop): disclose that remote agents lose team instructions
Local spawn resolves a linked team's instructions and hands them to the harness as BUZZ_ACP_TEAM_INSTRUCTIONS. The deploy payload has no team field, so a provider-backed record starts without its team's standing rules — the agent runs, answers, and simply does not know the rules its team was written to enforce. That is observable behaviour, not metadata, and the surfaces that offer or describe a remote agent were presenting the record as equivalent to a local one. Say it in both places. The create flow states it the moment "elsewhere" is the answer, before a team is even picked; the edit dialog states it for a record where it is already true, next to the pin that makes the record remote. One owner for the copy and the condition, so the two surfaces cannot drift into different accounts of the same limitation. Carrying the resolved text to the host is the real fix and a protocol change. Until then, disclosure is the honest answer. Signed-off-by: Troy Hoffman <[email protected]>
1 parent 7bbb95d commit 071974d

4 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import assert from "node:assert/strict";
2+
import { describe, it } from "node:test";
3+
4+
import {
5+
losesTeamInstructionsRemotely,
6+
REMOTE_TEAM_INSTRUCTIONS_ACTIVE_NOTICE,
7+
REMOTE_TEAM_INSTRUCTIONS_NOTICE,
8+
} from "./remoteTeamInstructions.ts";
9+
10+
const provider = { type: "provider", id: "ssh", config: {} };
11+
const local = { type: "local" };
12+
13+
describe("losesTeamInstructionsRemotely", () => {
14+
it("is true for a team-linked record that runs through a provider", () => {
15+
assert.equal(
16+
losesTeamInstructionsRemotely({ backend: provider, teamId: "team-1" }),
17+
true,
18+
);
19+
});
20+
21+
it("is false for a team-linked record on this computer", () => {
22+
// Local spawn resolves the team's instructions and passes them to the
23+
// harness, so there is nothing to disclose.
24+
assert.equal(
25+
losesTeamInstructionsRemotely({ backend: local, teamId: "team-1" }),
26+
false,
27+
);
28+
});
29+
30+
it("is false for a remote record with no team", () => {
31+
for (const teamId of [null, undefined, "", " "]) {
32+
assert.equal(
33+
losesTeamInstructionsRemotely({ backend: provider, teamId }),
34+
false,
35+
`teamId ${JSON.stringify(teamId)}`,
36+
);
37+
}
38+
});
39+
40+
it("is false when the record carries no backend yet", () => {
41+
assert.equal(
42+
losesTeamInstructionsRemotely({ backend: null, teamId: "team-1" }),
43+
false,
44+
);
45+
assert.equal(losesTeamInstructionsRemotely({ teamId: "team-1" }), false);
46+
});
47+
});
48+
49+
describe("the disclosure copy", () => {
50+
it("names team instructions in both surfaces, so neither reads as generic", () => {
51+
for (const copy of [
52+
REMOTE_TEAM_INSTRUCTIONS_NOTICE,
53+
REMOTE_TEAM_INSTRUCTIONS_ACTIVE_NOTICE,
54+
]) {
55+
assert.ok(/team/i.test(copy), copy);
56+
assert.ok(copy.trim().length > 0);
57+
}
58+
});
59+
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { ManagedAgentBackend } from "@/shared/api/types";
2+
3+
/**
4+
* What a remote agent loses that a local one keeps: its team's standing rules.
5+
*
6+
* Local spawn resolves the linked team's instructions and hands them to the
7+
* harness as `BUZZ_ACP_TEAM_INSTRUCTIONS` (`managed_agents::runtime`). The
8+
* deploy payload has no team field, so a provider-backed record starts without
9+
* them — the agent runs, answers, and simply does not know the rules its team
10+
* was written to enforce.
11+
*
12+
* That is observable behaviour, not metadata, so the surfaces that offer or
13+
* describe a remote agent say it out loud rather than presenting the remote
14+
* record as equivalent to a local one. Carrying the resolved text to the host
15+
* is the real fix and a protocol change; until then, disclosure is the honest
16+
* answer.
17+
*
18+
* One owner so the create surface and the edit surface cannot drift into two
19+
* different accounts of the same limitation.
20+
*/
21+
22+
/** What a remote agent does not receive. Stated unconditionally. */
23+
export const REMOTE_TEAM_INSTRUCTIONS_NOTICE =
24+
"Agents that run elsewhere do not receive team instructions. A team-linked agent deployed to a host starts without its team's standing rules.";
25+
26+
/** The same fact for a record that HAS a team, where it is already true. */
27+
export const REMOTE_TEAM_INSTRUCTIONS_ACTIVE_NOTICE =
28+
"This agent runs elsewhere, so it does not receive its team's instructions. Team rules apply to agents running on this computer only.";
29+
30+
/**
31+
* Whether a record is one the limitation currently bites: linked to a team AND
32+
* running through a provider.
33+
*
34+
* A local team-linked record gets its instructions and needs no notice; a
35+
* provider-backed record with no team has nothing to lose yet.
36+
*/
37+
export function losesTeamInstructionsRemotely(agent: {
38+
backend?: ManagedAgentBackend | null;
39+
teamId?: string | null;
40+
}): boolean {
41+
return agent.backend?.type === "provider" && Boolean(agent.teamId?.trim());
42+
}

‎desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import {
1212
} from "@/features/agents/hooks";
1313
import { agentLocationLabel } from "@/features/agents/lib/agentLocationLabel";
1414
import { providerRecordHarness } from "@/features/agents/lib/pinnedHarness";
15+
import {
16+
losesTeamInstructionsRemotely,
17+
REMOTE_TEAM_INSTRUCTIONS_ACTIVE_NOTICE,
18+
} from "@/features/agents/lib/remoteTeamInstructions";
1519
import type {
1620
ManagedAgent,
1721
RespondToMode,
@@ -995,6 +999,20 @@ export function AgentInstanceEditDialog({
995999
selectedRuntimeId === "custom" && !inheritHarness
9961000
}
9971001
/>
1002+
{/* Observable parity loss, not metadata: local spawn hands the
1003+
harness `BUZZ_ACP_TEAM_INSTRUCTIONS`, and the deploy payload has
1004+
no team field, so this record is running without its team's
1005+
standing rules right now. Stated where the record's remoteness
1006+
is already the subject rather than presenting it as equivalent
1007+
to a local agent. See `remoteTeamInstructions`. */}
1008+
{losesTeamInstructionsRemotely(agent) ? (
1009+
<p
1010+
className="text-xs text-warning"
1011+
data-testid="edit-agent-remote-team-instructions-notice"
1012+
>
1013+
{REMOTE_TEAM_INSTRUCTIONS_ACTIVE_NOTICE}
1014+
</p>
1015+
) : null}
9981016
{/* Only the local branch above renders a harness dropdown, so only
9991017
it can raise "Add custom harness". */}
10001018
{pinnedHarness ? null : (

‎desktop/src/features/agents/ui/WhereToRunSection.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from "@/features/agents/hooks";
99
import { NO_BACKEND_PROVIDER_HINT } from "@/features/agents/lib/backendProviderLabel";
1010
import { addedExclusiveHarnessIds } from "@/features/agents/lib/exclusiveRemoteHarness";
11+
import { REMOTE_TEAM_INSTRUCTIONS_NOTICE } from "@/features/agents/lib/remoteTeamInstructions";
1112
import { useGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
1213
import {
1314
discoverProviderHarnesses,
@@ -423,6 +424,16 @@ export function WhereToRunSection({
423424
from trusted sources.
424425
</p>
425426
</div>
427+
{/* Stated the moment "elsewhere" is the answer, and unconditionally:
428+
the team is chosen after this section, so waiting for one to be
429+
picked would surface the limitation only where it is already too
430+
late to weigh. See `remoteTeamInstructions`. */}
431+
<p
432+
className="text-xs text-muted-foreground"
433+
data-testid="remote-team-instructions-notice"
434+
>
435+
{REMOTE_TEAM_INSTRUCTIONS_NOTICE}
436+
</p>
426437
{probeError ? (
427438
<p className="rounded-2xl border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive">
428439
Could not probe provider: {probeError}

0 commit comments

Comments
 (0)