Skip to content

Commit e2d5356

Browse files
committed
improve(ui): rebuild agent GitHub identity panel on settings primitives
The panel from #125199 rendered raw wire enums in code tags, used form-grid/field markup whose styles the agents page never loads (bare unstyled inputs outside the card), referenced non-existent avatar classes, and put callouts inside the settings group. Rebuild it on the canonical settings primitives: status rows with dot status and friendly source/evidence labels, a System/This Agent segmented scope control, the settings secret input (gains a disabled prop), a danger status row for errors, and a quiet-inherit + primary-save action row. Retitle to "GitHub Identity" and move it below Tool Access and Available Right Now. Add a .settings-account primitive for the 20px round avatar. Live-tested on an isolated dev gateway: native-credential verify via the GitHub API, segmented scope switching, and the empty-token error row. Controller behavior unchanged.
1 parent b295ae1 commit e2d5356

7 files changed

Lines changed: 290 additions & 110 deletions

File tree

‎docs/gateway/config-tools.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Controls elevated exec access outside the sandbox:
215215

216216
GitHub CLI identity is native by default. When `tools.github` is omitted, local agent tools, the Codex harness, and Agent Settings follow normal `gh` resolution: `GH_TOKEN` or `GITHUB_TOKEN` from the Gateway process takes precedence, followed by the runtime user's `gh` keyring/config. The Git author comes from the selected agent's workspace.
217217

218-
Use **Agents → Tools → GitHub CLI Identity** to configure a managed fine-grained personal access token. The browser places the pasted token in the secret store as a one-use handoff. The Gateway hard-deletes that handoff before passing its value to `gh auth login` on stdin, verifies the account, publishes an account-owned managed `gh` profile, and stores only this secret-free config:
218+
Use **Agents → Tools → GitHub Identity** to configure a managed fine-grained personal access token. The browser places the pasted token in the secret store as a one-use handoff. The Gateway hard-deletes that handoff before passing its value to `gh auth login` on stdin, verifies the account, publishes an account-owned managed `gh` profile, and stores only this secret-free config:
219219

220220
```json5
221221
{

‎ui/src/components/settings-ui.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ export function renderSettingsSecretInput(props: {
342342
value: string;
343343
placeholder?: string;
344344
visible: boolean;
345+
disabled?: boolean;
345346
showLabel: string;
346347
hideLabel: string;
347348
toggleLabel: string;
@@ -358,6 +359,7 @@ export function renderSettingsSecretInput(props: {
358359
spellcheck="false"
359360
.value=${props.value}
360361
placeholder=${props.placeholder ?? ""}
362+
?disabled=${props.disabled ?? false}
361363
@input=${(e: Event) => props.onInput((e.target as HTMLInputElement).value)}
362364
/>
363365
<openclaw-tooltip .content=${props.visible ? props.hideLabel : props.showLabel}>
@@ -366,6 +368,7 @@ export function renderSettingsSecretInput(props: {
366368
class="settings-secret__toggle"
367369
aria-label=${props.toggleLabel}
368370
aria-pressed=${props.visible}
371+
?disabled=${props.disabled ?? false}
369372
@click=${props.onToggle}
370373
>
371374
${props.visible ? icons.eye : icons.eyeOff}

‎ui/src/i18n/.i18n/raw-copy-baseline.json‎

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/src/i18n/locales/en.ts‎

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,29 +1868,43 @@ export const en: TranslationMap = {
18681868
openControlUi: "Open Control UI",
18691869
},
18701870
agentTools: {
1871-
githubTitle: "GitHub CLI Identity",
1871+
githubTitle: "GitHub Identity",
18721872
githubSubtitle:
18731873
"GitHub CLI account and Git author for local agent tools and the Codex harness.",
18741874
githubVerify: "Verify",
18751875
githubVerifying: "Verifying…",
18761876
githubOlderGateway: "This Gateway does not support managed GitHub CLI identities yet.",
1877-
githubEffective: "Effective account",
1877+
githubAccount: "Account",
18781878
githubNoAccount: "No verified account",
1879-
githubAuthor: "Git author",
1880-
githubEvidence: "Evidence",
1881-
githubPermissionsNotVerified: "write permissions are not remotely verified",
1882-
githubScope: "Configure",
1883-
githubSystem: "System identity",
1884-
githubAgentOverride: "Agent override",
1879+
githubAuthor: "Git Author",
1880+
githubAuthorUnset: "Not set",
1881+
githubErrorTitle: "Error",
1882+
githubSourceDetected: "Native credentials detected on this machine",
1883+
githubSourceSystem: "Managed system identity",
1884+
githubSourceAgent: "Managed override for this agent",
1885+
githubStateVerified: "Verified",
1886+
githubStateUnverified: "Not verified",
1887+
githubStateRateLimited: "Rate limited",
1888+
githubStateUnavailable: "No credentials",
1889+
githubStateConfiguredUnavailable: "Configured, but unavailable",
1890+
githubEvidenceApi: "Confirmed via the GitHub API. Write permissions are not checked remotely.",
1891+
githubEvidenceRateLimited: "The GitHub API rate limit blocked verification — try again later.",
1892+
githubEvidenceUnverified: "The stored credentials have not been verified against GitHub yet.",
1893+
githubScope: "Applies To",
1894+
githubScopeSystemDesc: "One identity shared by every agent without an override.",
1895+
githubScopeAgentDesc: "Overrides the system identity for this agent only.",
1896+
githubSystem: "System",
1897+
githubAgentOverride: "This Agent",
18851898
githubToken: "Fine-grained PAT",
1899+
githubTokenDesc: "Stored in the Gateway secret store; used by gh and git for this scope.",
1900+
githubTokenToggle: "Toggle token visibility",
18861901
githubPasteToken: "Paste a fine-grained personal access token first.",
1887-
githubAuthorName: "Author name",
1888-
githubAuthorEmail: "Author email",
1889-
githubConfigure: "Configure / Replace",
1890-
githubUseSystem: "Use system/default",
1891-
githubUseNative: "Use native identity",
1892-
githubCloudNote:
1893-
"Existing repository remote credentials are not overridden. Direct branch and pull request publication will be handled by a separate Gateway broker; it is not part of this identity foundation.",
1902+
githubAuthorName: "Author Name",
1903+
githubAuthorEmail: "Author Email",
1904+
githubConfigure: "Save Identity",
1905+
githubUseSystem: "Remove Override",
1906+
githubUseNative: "Use Native Credentials",
1907+
githubCloudNote: "Credentials already embedded in repository remotes are not overridden.",
18941908
connectedSource: "Connected: {id}",
18951909
connected: "Connected",
18961910
channelSource: "Channel: {id}",

‎ui/src/pages/agents/panels-tools-skills.browser.test.ts‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe("agents tools panel (browser)", () => {
148148
Array.from(container.querySelectorAll(".settings-section__heading")).map((heading) =>
149149
heading.textContent?.trim(),
150150
),
151-
).toEqual(["GitHub CLI Identity", "Tool Access", "Available Right Now", "Tool Catalog"]);
151+
).toEqual(["Tool Access", "Available Right Now", "GitHub Identity", "Tool Catalog"]);
152152
expect(
153153
Array.from(container.querySelectorAll(".settings-row__title")).some(
154154
(title) => title.textContent?.trim() === "Quick Presets",
@@ -183,6 +183,45 @@ describe("agents tools panel (browser)", () => {
183183
expect(container.querySelector(".agent-tool-card[open]")).toBeNull();
184184
});
185185

186+
it("renders the GitHub identity section with settings rows only", async () => {
187+
const container = document.createElement("div");
188+
const params = createBaseParams();
189+
params.githubIdentity.status = {
190+
agentId: "main",
191+
source: "system-detected",
192+
credentialState: "available",
193+
account: { login: "octocat", avatarUrl: "https://example.test/a.png" },
194+
gitAuthor: { name: null, email: null },
195+
evidence: "github-api",
196+
};
197+
render(renderAgentTools(params), container);
198+
await Promise.resolve();
199+
200+
const section = Array.from(container.querySelectorAll(".settings-section")).find((candidate) =>
201+
candidate.querySelector(".settings-section__heading")?.textContent?.includes("GitHub"),
202+
);
203+
expect(section).toBeDefined();
204+
if (!section) {
205+
throw new Error("expected GitHub identity section");
206+
}
207+
// The whole section stays inside the one group surface: no bespoke form
208+
// markup or nested callouts, per ui/docs/design-system/settings-design.md.
209+
expect(section.querySelector(".form-grid")).toBeNull();
210+
expect(section.querySelector(".callout")).toBeNull();
211+
expect(section.querySelector(".settings-group .settings-account__avatar")).not.toBeNull();
212+
expect(section.textContent).toContain("@octocat");
213+
expect(section.querySelector(".settings-status")?.textContent?.trim()).toBe("Verified");
214+
// Raw wire enums never render; friendly labels replace them.
215+
expect(section.textContent).not.toContain("system-detected");
216+
expect(section.textContent).not.toContain("github-api");
217+
const authorRow = Array.from(section.querySelectorAll(".settings-row")).find((row) =>
218+
row.querySelector(".settings-row__title")?.textContent?.includes("Git Author"),
219+
);
220+
expect(authorRow?.querySelector(".settings-row__value")?.textContent?.trim()).toBe("Not set");
221+
expect(section.querySelector(".settings-segmented")).not.toBeNull();
222+
expect(section.querySelector(".settings-secret input")).not.toBeNull();
223+
});
224+
186225
it("shows fallback warning when runtime catalog fails", async () => {
187226
const container = document.createElement("div");
188227
render(

0 commit comments

Comments
 (0)