Repository navigation
CONTRACT: feat(ui-server, ui-react, ui-kit): an honest poster and target kind on the GitHub comment approval (#4154) - #4198
Conversation
…get kind on the GitHub comment approval (#4154) The comment card now names who would post and on what, when the host can verify each, and kit-owned neutral states otherwise. - ui-sdk: `tool_approval_request` and `PermissionRequest` gain optional `display: ApprovalDisplay` (`github: { poster, target }`). Clients drop a malformed fact to null, never the card. - ui-server: the comment card resolves the poster with `GET /user` through a single-entry cache keyed by the credential's digest (10 min, failures held 1 min, forgotten when GitHub rejects the credential on a write), and the target kind with `GET /repos/{repo}/issues/{n}`, bound to that repository and number and asked of the turn's data routing first. Both share a 3 s limit; any failure is null and the write continues unchanged. Nothing reaches the input, the answer comparison, the outward_action record or the tool result. - ui-kit: `GitHubComment` preview accepts no author ("The host's GitHub account", never @ghost) and shows its whole draft; `GitHubRef` accepts `kind: null` (`repository #number`, no chip, no link). W4 stories for every combination at 320px and desktop. - ui-react: the store keeps the frame's facts on the card (replaced on re-delivery); W4 maps them onto the kit states, the target link through the contract validator. The posted card's unknown kind uses the kit state too. Contract docs: wire (approval display facts), mcp (GitHub writes, data routing), the index, the hosting guide, the API report and a minor changeset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No uploads on this PR yet This PR changes UI files (
Tips for agentsLabel each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one uploads put after.png --pr 4198 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4198 --app ios --screen "Chat" --state afterNo CLI? With the Uploads MCP, call This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with Workspace admins can turn this comment off in Settings → GitHub · docs |
Independent reviewReviewed head 483cabc against base ec10940. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4198,
"head": "483cabc01a7aaaa895911138589359c49b954324",
"base": "ec109403df8c88a9dc17398e7578ac1f64efcfd9",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-kit/src/github/GitHubComment.tsx:57: W4 now uses this component, but caption={false} removes the previous “Brain's draft · not posted” provenance. The preview identifies the posting account without identifying Brain as the draft's source, contrary to #4154's explicit requirement to preserve draft provenance. Restore a preview-only draft caption in the kit."
}
]
} |
Review of 483cabc: W4 now renders through GitHubComment, whose preview had `caption={false}`, so the card lost "Brain's draft · not posted". The poster names whose account would post; the caption names who wrote it. A preview now carries the same DRAFT_CAPTION W1's draft body uses; posted comments stay uncaptioned. The github-write-comment visual baselines gain the caption line, regenerated in the pinned container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head 483cabc against base ec10940. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4198,
"head": "483cabc01a7aaaa895911138589359c49b954324",
"base": "ec109403df8c88a9dc17398e7578ac1f64efcfd9",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-kit/src/github/GitHubComment.tsx:57: W4 now uses this component, but caption={false} removes the previous “Brain's draft · not posted” provenance. The preview identifies the posting account without identifying Brain as the draft's source, contrary to #4154's explicit requirement to preserve draft provenance. Restore a preview-only draft caption in the kit.",
"disposition": "fixed",
"commit": "8bb0482e1e1f88dd261c00926ee62340fe1558fc"
}
]
} |
Independent reviewReviewed head 44de7ae against base 0babede. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4198,
"head": "44de7aef77d7c3990a826306e991d6ef436355a2",
"base": "0babedee2b94fb8ae06d3fac7c16917903e2f4e3",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
…view-author # Conflicts: # packages/ui-react/src/components/chat/tool-cards/github-cards.tsx
Independent reviewReviewed head 191e4fd against base 51d0f6d. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4198,
"head": "191e4fdfa3f980ff2b701b24c0f81a86e989cb26",
"base": "51d0f6de637509a97bed014eb0a284a196199e80",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
|
Fresh confirmation after an unrelated flake (orchestrator): confirmation run 44195552641 on head |
Closes #4154. Part of #3791.
What changed
A
brain_github_issue_commentapproval card now says who would post the comment and whether it goes on an issue or a pull request, but only when the host verified each fact. Otherwise it shows kit-owned neutral states, following the maintainer's ruling on #4154 (author options 1 + 2, target-kind option A).tool_approval_requestandPermissionRequestgain the optionaldisplay: ApprovalDisplay, shaped{ github?: { poster: { login, is_bot } | null, target: { kind, html_url } | null } }. The client schema turns a malformed fact intonull. It never drops the card.packages/ui-server/src/github/host.ts):GET /userwith the same token the write will use. The result is kept in a single-entry cache keyed by the token's SHA-256 digest:GET /repos/{repo}/issues/{n}. The kind counts only when GitHub's answer names that same repository and number. Thehtml_urlgoes throughgithubDirectUrl.null. Neither fact entersinput, the comparison that detects an edited approval, theoutward_actionrecord, or the tool result.GitHubCommentinpreviewaccepts noauthorand names "The host's GitHub account". It never shows@ghostfor an unknown poster. A preview also shows its whole draft, since the posted-comment 10,000-character cut would hide part of an approved body of up to 65,536 characters.GitHubRefacceptskind: nulland rendersrepository #numberwith no kind, no chip and no link, whateverhtmlUrlsays.displayon the card and replaces it on re-delivery. W4 renders the kit'sGitHubReftarget row above the kit'sGitHubCommentpreview, and maps only the facts the host reported. The poster asks for no avatar, because the avatar route serves only logins a tool result named. The posted-comment card's unknown kind now uses the kit state too, and its behaviour is unchanged.Why this shape
input, not inside it. The approval's exact-content comparison and its record stay byte-for-byte what they were, and nothing new is added to what the model sees.owner/*allow-list the repository name is model text. So it gets the same check a read gets. A refusal only leaves the kind unknown; the write is still unrouted, per the ui-server: apply provider-policy data routing (G2) to the host GitHub tools #4029 ruling. The test that asserted writes never ask routing (GITHUB_WRITE_NEVER_ASKS_ROUTING) becameGITHUB_WRITE_ROUTING_ONLY_FOR_DISPLAY. Its siblings in the same test still prove the write's result, card and request are unchanged under a refusal. They also prove a refused turn sends no target lookup.GitHubRef's inline form. Adding the target's title would put more untrusted GitHub text on the card, which is a separate decision.Proof
bun run check:pr --base origin/main # passed; receipt belowMutation receipts. Each mutation was applied, the named assertion failed, and the source was restored.
Host mutations (packages/ui-server/tests/github-write-tools.test.ts, each restored after):
Client mutations (each restored after):
Real browser. Host Chromium 1243, outside the command sandbox:
storybook(dark) andstorybook-light, with the a11y gate aterror, forGitHubWrite,GitHubThreadandGitHubIdentity: 66/66 passed, covering every new W4 neutral state at 320px and at desktop width;ui-react-layouttests/browser/github-tools.layout.tsx: 1/1 passed.The
github-write-commentvisual subject gains the draft caption (see the review fix below). Its dark and paper baselines were regenerated in the pinned container. Thesubjectsproject then compared clean, 112/112. No other baseline moved.Unit / integration:
github-write-tools(+16 tests for display facts: verified issue/PR, credential rotation, cache and retry windows, rejection forgetting, every lookup failure, deadline),github-tools-host,ws-github(end to end on pi and claude),ws-allowlist-enforcement(first delivery and re-delivery);server-schemas;render/github-tools(every known/unknown combination, link validation, exact body),restored-approval-store;github-neutral-states;tests/api-surface.All pass. In the same run, 49 failures are in ui-sdk worker/sandbox files that need bubblewrap user namespaces, which this host lacks. The same files fail 51 tests on the untouched base.
Provider-history guards.
packages/ui-backend-claude/tests/provider-history.test.tsandpackages/ui-backend-pi/tests/provider-history.test.tscannot start a worker on this host:bwrap: No permissions to create a new namespace,worker_host_unsupported. They fail identically on the untouched base, inside and outside the command sandbox. Both guard files are unchanged, and hosted CI is their proof for this head. The display-leak mutations above (M2, R5, theAPPROVAL_DISPLAY_NEVER_SENT_BACKandGITHUB_APP_DISPLAY_*assertions) are the local evidence that nothing reaches the model.Review fix (record on this PR, head
483cabc01). One finding, fixed in8bb0482e1. W4 had lost the "Brain's draft · not posted" caption when it moved ontoGitHubComment, whose preview setcaption={false}.GitHubCommentpreview now carries the sameDRAFT_CAPTIONthat W1's draft body uses. Posted comments stay uncaptioned.483cabc01,KIT_PREVIEW_DRAFT_PROVENANCE(ui-kitgithub-neutral-states) and the sixW4_DRAFT_PROVENANCEcases (ui-reactrender/github-tools) fail.storybookandstorybook-lightprojects pass 66/66 at 320px and desktop.object-parts.tsx). Every otherGitHubCommentcaller renders posted comments: thread items, earlier-comment pages, line comments.GitHubReviewhas no preview.G2 on the target lookup is now the maintainer's ruling on #4154; it is kept as built.
Refresh: merged
origin/mainat0babedee2(no rebase), cleanly. The typecheck with an 8 GB heap is clean, andcheck:prwas rerun at the merge head; the receipt below replaces the earlier one.Merge with #4147 (squash
ade18f34f). Mergedorigin/mainat51d0f6de6(no rebase) into merge commit191e4fdfa, whose parents are44de7aef7and51d0f6de6.github-cards.tsx. Both imports are kept:ApprovalDisplayfor W4, andGITHUB_DETAIL_PAGE_SIZE/GITHUB_LIMITSfor ui-sdk, ui-server, ui-react: per-review line-comment count, so each review gets its own "Show n line comments" #4147's per-review sections.GitHubComments (nopreview), so they keep no draft caption.GithubCommentCard,GithubCommentPreview).host.ts,github-host-fixture.ts,render/github-tools.test.tsx,integration-contract.md,mcp.mdand API reports have no duplicated or lost blocks. The regenerated API report matches the merge.render/github-tools,github-detailsandrestored-approval-store; ui-kitgithub-neutral-states; ui-sdkgithub-tool-contractandserver-schemas; ui-servergithub-tools-host,github-write-tools,github-details,ws-github,ws-github-detailsandws-allowlist-enforcement; andtests/api-surface;github-tools.layout.tsx(ui-sdk, ui-server, ui-react: per-review line-comment count, so each review gets its own "Show n line comments" #4147's browser test) passes 2/2, and theGitHubWriteandGitHubPullRequeststories pass 96/96 in both themes;check:prpassed, and its receipt below replaces the earlier one.Collisions (
bun scripts/collisions.ts --json --pr <n>): at head191e4fdfa, nopathcollisions. Twotextualcollisions remain:api-report/ui-react.txtwith drafts CONTRACT: feat(ui-react): EVALUATION ONLY bounded recovery / DO NOT MERGE #3056 and CONTRACT: chore(ui-react): EVALUATION ONLY voice-tail diagnostics — DO NOT MERGE #3059;github-cards.tsxoverlap with CONTRACT: feat(ui-sdk, ui-server, ui-react): per-review line-comment count, so each review gets its own "Show n line comments" (#4147) #4196 (the ui-sdk, ui-server, ui-react: per-review line-comment count, so each review gets its own "Show n line comments" #4147 work) is resolved by the merge above.Ten
closure-only overlaps with older drafts.Overlap with #4147 (per-review line-comment count, worked in parallel): both touch
packages/ui-react/src/components/chat/tool-cards/github-cards.tsx. This PR changes only the write section at the end of that file (GithubCommentCard,GithubCommentPreview, the removedTargethelper and the import list), and leaves the pull-request read card alone.{"version":1,"kind":"brain-check-pr-receipt","head":"191e4fdfa3f980ff2b701b24c0f81a86e989cb26","base":"origin/main","mode":"focused","startedAt":"2026-11-17T22:21:26.559Z","finishedAt":"2026-11-17T22:22:46.217Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14738.123044},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":127.02482900000177},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":110.10915699999896},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":21.071403999998438},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":64644.236221}]}Checklist
0.45.0on this PR and ui-react, ui-server: an honest author for the W4 comment preview, so it can use GitHubComment preview #4154..changeset/4154-comment-preview-author.md(minor: ui-sdk, ui-server, ui-kit, ui-react).CONTRACT:commit:docs/integration-contract.md,integration-contract/wire.md#approval-display-facts-additive-0450-4154andintegration-contract/mcp.md(GitHub writes, data routing), plusdocs/hosting/README.mdand the API report.null. The approval, the write and the turn are unaffected.Anything left open
🤖 Generated with Claude Code