fix: avoid preview-only pairing approval hint (#69226)

This commit is contained in:
Ayaan Zaidi
2026-04-20 13:34:58 +05:30
parent 24c4e458f9
commit aff96ea963
2 changed files with 19 additions and 4 deletions

View File

@@ -108,4 +108,19 @@ describe("overview view rendering", () => {
);
expect(container.textContent).toContain("openclaw devices approve req-123");
});
it("does not suggest preview-only latest approval when the request id is absent", async () => {
const container = document.createElement("div");
const props = createOverviewProps({
lastError: "scope upgrade pending approval",
lastErrorCode: "PAIRING_REQUIRED",
});
render(renderOverview(props), container);
await Promise.resolve();
expect(container.textContent).toContain("Scope upgrade pending approval.");
expect(container.textContent).toContain("openclaw devices list");
expect(container.textContent).not.toContain("openclaw devices approve --latest");
});
});

View File

@@ -111,9 +111,6 @@ export function renderOverview(props: OverviewProps) {
}
const copy = PAIRING_HINT_COPY[pairingState.kind];
const title = copy.titleKey ? t(copy.titleKey) : t("overview.pairing.hint");
const approveCommand = pairingState.requestId
? `openclaw devices approve ${pairingState.requestId}`
: "openclaw devices approve --latest";
return html`
<div class="muted" style="margin-top: 8px">
${title}
@@ -121,7 +118,10 @@ export function renderOverview(props: OverviewProps) {
? html`<div style="margin-top: 6px">${t(copy.summaryKey)}</div>`
: nothing}
<div style="margin-top: 6px">
<span class="mono">${approveCommand}</span><br />
${pairingState.requestId
? html`<span class="mono">openclaw devices approve ${pairingState.requestId}</span
><br />`
: nothing}
<span class="mono">openclaw devices list</span>
</div>
<div style="margin-top: 6px; font-size: 12px;">${t("overview.pairing.mobileHint")}</div>