Skip to content

Commit eda22ae

Browse files
authored
fix(ui): stop misreporting limited Custodian access (#123011)
1 parent 7d6dfa1 commit eda22ae

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎ui/src/e2e/device-scope-upgrade.e2e.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,24 @@ describeControlUiE2e("Control UI live device scope upgrade", () => {
194194
},
195195
);
196196

197+
it("does not misreport limited Custodian access as an outdated Gateway", async () => {
198+
const context = await createContext();
199+
const page = await context.newPage();
200+
const gateway = await installMockGateway(page, {
201+
featureMethods: ["chat.metadata", "chat.startup", "openclaw.chat", ...SCOPE_UPGRADE_METHODS],
202+
operatorScopes: LIMITED_SCOPES,
203+
});
204+
205+
await page.goto(`${server.baseUrl}custodian?intent=new-agent`);
206+
await page.getByText("This browser has limited access.", { exact: true }).waitFor();
207+
208+
expect(
209+
await page.getByText("Update the Gateway to continue setup with OpenClaw.").count(),
210+
).toBe(0);
211+
expect(await gateway.getRequests("openclaw.chat")).toHaveLength(0);
212+
await captureProof(page, "custodian-limited.png");
213+
});
214+
197215
it("keeps manual repair guidance when the banner module fails to load", async () => {
198216
const context = await createContext();
199217
const page = await context.newPage();

‎ui/src/pages/custodian/custodian-page-agent-create.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,19 @@ describe("custodian new-agent flow", () => {
117117
expect(request.mock.calls[0]?.[1]).toMatchObject({ welcomeVariant: "new-agent" });
118118
});
119119

120-
it("does not start new-agent chat with read-only operator access", async () => {
120+
it("does not misreport limited access as an outdated Gateway", async () => {
121121
const request = vi.fn();
122122
const { context } = createContext(request);
123123
context.gateway.snapshot.hello = {
124124
...context.gateway.snapshot.hello!,
125125
auth: { role: "operator", scopes: ["operator.read"] },
126126
};
127127

128-
await mountPage(context);
128+
const page = await mountPage(context);
129129
await Promise.resolve();
130130

131131
expect(request).not.toHaveBeenCalled();
132+
expect(page.querySelector('[role="alert"]')).toBeNull();
132133
});
133134

134135
it("refreshes the roster and opens the created agent hatch session", async () => {

‎ui/src/pages/custodian/custodian-session-store.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ export class CustodianSessionStore {
450450
const client = snapshot.phase === "connected" ? snapshot.client : null;
451451
const chatSupported =
452452
client !== null && canCallGatewayMethod(snapshot, "openclaw.chat", "operator.admin");
453+
const chatUnsupported = isGatewayMethodAdvertised(snapshot, "openclaw.chat") === false;
453454
const configuredInferenceState = this.resolveConfiguredInferenceState();
454455
const inferenceStateChanged = configuredInferenceState !== this.configuredInferenceState;
455456
this.configuredInferenceState = configuredInferenceState;
@@ -489,7 +490,7 @@ export class CustodianSessionStore {
489490
if (!chatSupported) {
490491
this.sessionStarted = false;
491492
this.abandonPendingUserTurn(pendingParams);
492-
this.error = t("custodian.unsupportedGateway");
493+
this.error = chatUnsupported ? t("custodian.unsupportedGateway") : null;
493494
return;
494495
}
495496
this.chatAvailable = true;
@@ -506,7 +507,7 @@ export class CustodianSessionStore {
506507
return;
507508
}
508509
if (!chatSupported) {
509-
this.error = t("custodian.unsupportedGateway");
510+
this.error = chatUnsupported ? t("custodian.unsupportedGateway") : null;
510511
return;
511512
}
512513
if (configuredInferenceState === "unresolved") {

0 commit comments

Comments
 (0)