Skip to content
Python

Approval card: a site off the allowed sites says so and offers "Always allow"

Rohit C Prasadd241959e5aee
diff --git a/surfaces/gui/src/cardPayloads.ts b/surfaces/gui/src/cardPayloads.ts
index e2c22ef5..808e5b25 100644
--- a/surfaces/gui/src/cardPayloads.ts
+++ b/surfaces/gui/src/cardPayloads.ts
@@ -29,6 +29,7 @@ export function approvalItemFromPayload(d: any): ApprovalItem {
category: d.category,
standingTarget: d.standing_target || undefined,
searchProvider: d.search_provider || undefined,
+ siteWall: d.site_wall || undefined,
provenance: d.provenance || undefined,
reviewerUnsure: d.reviewer_unsure || undefined,
escalation: d.escalation || undefined,
diff --git a/surfaces/gui/src/components/ApprovalCard.test.tsx b/surfaces/gui/src/components/ApprovalCard.test.tsx
index 4d385976..b9f63fd0 100644
--- a/surfaces/gui/src/components/ApprovalCard.test.tsx
+++ b/surfaces/gui/src/components/ApprovalCard.test.tsx
@@ -516,6 +516,31 @@ describe("ApprovalCard — §1.9 egress cards", () => {
expect(screen.getByText(/leaves this computer → bbc\.com/)).toBeTruthy();
});
+ it("a site off the sandbox's allowed sites says so and offers to add it (OPE-219)", () => {
+ const onApprove = vi.fn();
+ const walled = fetchApproval({
+ args: { url: "https://weather.com/today" },
+ reason: "weather.com is not on your allowed sites",
+ escalation: { kind: "human_required", reason: "weather.com is not on your allowed sites" },
+ siteWall: "weather.com",
+ });
+ render(<ApprovalCard item={walled} onApprove={onApprove} />);
+ // Its own plain line, not the generic "requires a human decision" banner.
+ expect(screen.getByTestId("approval-site-wall").textContent).toBe("weather.com is not on your allowed sites.");
+ expect(screen.queryByTestId("approval-escalation")).toBeNull();
+ // Once, this session, and the durable choice that writes the machine's list.
+ expect(screen.getByText("Allow weather.com for this session")).toBeTruthy();
+ fireEvent.click(screen.getByTestId("approval-always-site"));
+ expect(onApprove).toHaveBeenCalledWith("always_site");
+ expect(screen.getByTestId("approval-always-site").textContent).toBe("Always allow weather.com");
+ });
+
+ it("an ordinary fetch card has no allowed-sites line or button", () => {
+ render(<ApprovalCard item={fetchApproval()} onApprove={vi.fn()} />);
+ expect(screen.queryByTestId("approval-site-wall")).toBeNull();
+ expect(screen.queryByTestId("approval-always-site")).toBeNull();
+ });
+
it("web_fetch with an unparseable url falls back to once/deny only", () => {
render(<ApprovalCard item={fetchApproval({ args: { url: "not a url" } })} onApprove={vi.fn()} />);
expect(screen.queryByText(/for this session/)).toBeNull();
diff --git a/surfaces/gui/src/components/ApprovalCard.tsx b/surfaces/gui/src/components/ApprovalCard.tsx
index 6b0e2b81..7a436404 100644
--- a/surfaces/gui/src/components/ApprovalCard.tsx
+++ b/surfaces/gui/src/components/ApprovalCard.tsx
@@ -389,6 +389,19 @@ function Buttons({
{t("approval.btn.always_search")}
</button>
)}
+ {/* OPE-219: the one durable choice on the allowed-sites card. It writes the site into
+ the machine's sandbox list, so it is offered in Auto-approve too: standing policy
+ the user sets, not an in-flow session grant. */}
+ {!offerStanding && item.siteWall && (
+ <button
+ className="btn"
+ title={t("approval.btn.always_site_title", { host: item.siteWall })}
+ onClick={() => onApprove("always_site")}
+ data-testid="approval-always-site"
+ >
+ {t("approval.btn.always_site", { host: item.siteWall })}
+ </button>
+ )}
{!autoApprove && item.name === "run_shell" && (
<button className="btn" onClick={() => onApprove("always_command")}>
{t("approval.btn.always_command")}
@@ -473,7 +486,15 @@ export function ApprovalCard({
</div>
) : null;
// Quiet, not a warning: the reviewer hesitating is context, not danger.
- const reviewerUnsure = <ApprovalEscalation escalation={item.escalation} reviewerUnsure={item.reviewerUnsure} />;
+ // OPE-219: a site the sandbox's allowed sites do not include. Its own plain line, in
+ // place of the generic "requires a human decision" banner the engine also sends.
+ const reviewerUnsure = item.siteWall ? (
+ <div className="text-meta text-muted mt-1" data-testid="approval-site-wall">
+ {t("approval.site_wall_note", { host: item.siteWall })}
+ </div>
+ ) : (
+ <ApprovalEscalation escalation={item.escalation} reviewerUnsure={item.reviewerUnsure} />
+ );
// §35 compact row: routine workspace writes — one line, preview expands inline from the
// tool args. Standing/grant flows keep the full card (they carry §25 consent weight).
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index ed2c5653..a2b5e674 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -660,7 +660,9 @@
"always_trust": "Always allow this tool",
"always_trust_title": "Allow {{name}} without asking, permanently — survives restarts; revoke any time on the server's page in Connectors",
"this_run": "Allow for this request",
- "this_run_title": "Covers {{name}} until the agent finishes answering your current message. Later calls in this answer run without showing you their arguments first — you'll see them in the transcript afterward. Nothing survives past this answer."
+ "this_run_title": "Covers {{name}} until the agent finishes answering your current message. Later calls in this answer run without showing you their arguments first — you'll see them in the transcript afterward. Nothing survives past this answer.",
+ "always_site": "Always allow {{host}}",
+ "always_site_title": "Adds {{host}} to the allowed sites in Settings ▸ Sandbox, for commands and web tools, on this machine"
},
"preview_less": "show less",
"preview_all_lines": "show all {{n}} lines",
@@ -681,7 +683,8 @@
"save_skill_footer": "Approving adds it to your skills on this computer — usable in every conversation from then on.",
"search_note": "Queries go to your configured search provider.",
"search_note_current": "Queries go to your configured search provider (currently: {{provider}}).",
- "reviewer_unsure": "reviewer wasn’t sure: {{note}}"
+ "reviewer_unsure": "reviewer wasn’t sure: {{note}}",
+ "site_wall_note": "{{host}} is not on your allowed sites."
},
"search": {
"placeholder": "Search chats",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index 0a967356..450a1788 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -650,7 +650,9 @@
"always_trust": "总是允许此工具",
"always_trust_title": "永久允许{{name}}且不再询问 —— 重启后依然生效;可随时在连接器中该服务器页面撤销",
"this_run": "本次请求内允许",
- "this_run_title": "在智能体回答完您当前这条消息之前,{{name}} 的后续调用将不再展示参数、直接执行 —— 事后可在会话记录中查看。回答结束后此授权即失效,不会保留任何设置。"
+ "this_run_title": "在智能体回答完您当前这条消息之前,{{name}} 的后续调用将不再展示参数、直接执行 —— 事后可在会话记录中查看。回答结束后此授权即失效,不会保留任何设置。",
+ "always_site": "始终允许 {{host}}",
+ "always_site_title": "将 {{host}} 加入 设置 ▸ 沙盒 的允许网站列表,对本机的命令和网页工具生效"
},
"preview_less": "收起",
"preview_all_lines": "展开全部 {{n}} 行",
@@ -670,7 +672,8 @@
"save_skill_footer": "批准后会将其添加到本机的技能中 —— 此后每个会话都可使用。",
"search_note": "查询会发送到你配置的搜索服务商。",
"search_note_current": "查询会发送到你配置的搜索服务商(当前:{{provider}})。",
- "reviewer_unsure": "审查器不确定:{{note}}"
+ "reviewer_unsure": "审查器不确定:{{note}}",
+ "site_wall_note": "{{host}} 不在你允许的网站列表中。"
},
"search": {
"placeholder": "搜索会话",
diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.ts
index 6cf4346d..e1ab348a 100644
--- a/surfaces/gui/src/types.ts
+++ b/surfaces/gui/src/types.ts
@@ -51,6 +51,7 @@ export type ApprovalDecision =
| "always_tool"
| "always_command"
| "always_domain"
+ | "always_site"
| "always_task"
// OPE-136 §4: durable per-MCP-tool trust — writes a rule to the user-local
// override store; survives sessions; revocable on the server's detail page.
@@ -177,6 +178,9 @@ export type Item =
// web_search only (§1.9): the LIVE configured provider name, resolved server-side
// when the card was raised — the grant description names the actual destination.
searchProvider?: string;
+ // OPE-219: the host the sandbox's allowed-sites wall stopped. The card says so and
+ // offers "Always allow <host>", which adds it to Settings ▸ Sandbox ▸ allowed sites.
+ siteWall?: string;
// OPE-114 §1: set when the action would run a file the agent itself created or
// downloaded this session ("setup.py was created by the agent 3 steps ago"). The
// one fact that cannot be read off the command text. Engine-authored, fixed