Skip to content

ui-kit: the W1 issue approval cuts a long draft body at 20,000 characters without saying so #4197

Closed

Description

@schlessera

Context

Found while working #4154. A not-posted draft in the GitHub kit can show less than it asks the user to approve, and nothing guards the W1 issue approval against the same cut.

  • brain_github_issue_create accepts a body of up to 65,536 characters (GITHUB_LIMITS.writeBodyChars, packages/ui-sdk/src/tool-contracts/github.ts:78; the create schema's body at packages/ui-sdk/src/tool-contracts/github.ts:134).
  • The kit's shared Body hard-cuts at BODY_MAX_CHARS = 20_000 (packages/ui-kit/src/github/object-parts.tsx:12, used at packages/ui-kit/src/github/object-parts.tsx:84), its draft branch included. GitHubPullRequest in preview renders its draft through that branch (packages/ui-kit/src/github/GitHubPullRequest.tsx:286-293), so a draft longer than 20,000 characters is cut, and the note under it says "Truncated · the rest is on GitHub", which is false for a draft that is not on GitHub yet.
  • The W1 issue approval (GitHubIssue with posting: { status: "preview" }, rendered by GithubCreatePreview in packages/ui-react/src/components/chat/tool-cards/github-cards.tsx) does not go through Body on main: its "As shown" pane is an unbounded UntrustedText (packages/ui-kit/src/github/GitHubIssue.tsx:94), so it already renders the whole body. Nothing proves that, so a refactor onto the shared Body would bring the 20,000-character cut back silently.

#4154 fixed the same gap for the W4 comment preview: GitHubComment in preview no longer applies its posted-comment bound.

Scope

Make the kit's draft body render the whole approved body, the same way the W4 preview does: the draft branch of Body (used by GitHubPullRequest preview) applies no bound and no "rest is on GitHub" note. Keep Body's 8-line clamp and its expand control, which names the total length. Guard the W1 GitHubIssue preview's whole-body rendering with a test and a story. Leave the bound on posted and read bodies unchanged.

Out of scope

Changing GITHUB_LIMITS, the tool schemas or the host's write path. Restyling W1 (it keeps its As shown / Exact text switch and gains no clamp). The read path's own body bounds.

Acceptance criteria

  • A W1 preview (GitHubIssue, posting: { status: "preview" }) and a GitHubPullRequest preview whose body is longer than 20,000 characters render all of it, and show no "Truncated" note. A kit unit test proves this, and it fails when the cut is restored.
  • A read or posted issue/PR body keeps its 20,000-character bound and its "Truncated" note, proven by the same test.
  • A W1 story with a long draft passes in both theme projects at 320px and desktop.

Verification

bun run test packages/ui-kit/tests and the kit storybook projects for stories/github/GitHubWrite.stories.tsx (and GitHubIssue.stories.tsx).

Contract impact

None: kit rendering only.


Corrected 2026-11-17 while claiming: the W1 issue preview does not render through Body on main and already shows the whole body; the 20,000-character draft cut lives in Body's draft branch, which GitHubPullRequest preview uses. Scope and criteria now name both, and keep the W1 guard as a test and a story.

Activity

  1. added
    type: fix
    area: ui-kit
    agent-ready
    on Nov 17, 2026
  2. added
    priority: p2
    on Nov 17, 2026
  3. added this to the 0.45.0 milestone on Nov 17, 2026
  4. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-17): in 0.45.0 at priority: p2.

  5. self-assigned this
    on Nov 17, 2026
  6. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-882f77d2. Branch: fix/4197-w1-preview-whole-body.

    path collision with #4198 on packages/ui-kit/stories/github/GitHubWrite.stories.tsx (same gap for W4); will merge origin/main if it lands first

  7. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Readiness correction (2026-11-17), folded into the body: on main the W1 issue preview (GitHubIssue, posting: { status: "preview" }) does not render through the kit's Body. Its "As shown" pane is an unbounded UntrustedText (packages/ui-kit/src/github/GitHubIssue.tsx:94), and rendering a 30,000-character draft shows all of it with no "Truncated" note. The 20,000-character draft cut lives in Body's draft branch, which GitHubPullRequest in preview uses, and its note there says "the rest is on GitHub" for a draft that is not on GitHub yet.

    The fix keeps the issue's intent (a draft is never cut): Body's draft branch renders the whole body like the W4 preview after #4154, and a unit test plus a long-draft W1 story guard the W1 preview against the cut coming back. No new scope beyond the cited Body draft branch.

  8. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Merged in #4199 as 51d0f6de6 through the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-kitpriority: p2type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions