Repository navigation
fix(native-chat): render approvals from the harness presentation, not serialized tool input - #21087
Conversation
… serialized tool input The approval card built its title from the tool name and rendered JSON.stringify(input) into an element with no height bound. Any large payload - a file write's contents, a proposed plan - pushed the action buttons past the viewport with no way to scroll to them, leaving the prompt unanswerable without zooming the pane out. Thread the agent SDK's own presentation fields through the prompt registry into the journal item: title, displayName, description, decisionReason, blockedPath and matchedAskRule. The SDK documents its title as the prompt text to use instead of reconstructing one, and warns that the decision reason may carry terminal escapes, so those are stripped before rendering. The card now also shows why a request was raised rather than only what it was. Bound the detail in a scrollable region that is reachable by keyboard, and cap it main-side with the existing shared tool-detail limit rather than the far looser journal payload bound. Focus moves to the card when a prompt appears and Escape resolves it, which previously did nothing because the composer owning that handler is unmounted while a prompt is pending. Mobile rendered the same unbounded detail and is fixed alongside.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds optional approval presentation metadata to shared types and journal schemas. Claude permission handling sanitizes and stores this metadata, while approval journal items format and truncate tool details. Desktop and mobile approval views render the metadata with bounded scrolling and focus behavior. Tests cover propagation, sanitization, rendering, fallback titles, denial responses, and focus restoration. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The approval presentation changes are ready to merge based on the current evidence. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 24 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description is detailed and covers the change, rationale, visual proof, testing, review, compatibility notes, and checklist. However, the required Linked Issue section does not provide an issue link and explicitly states that no separate issue exists.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one keyboard-coverage gap and one de-duplication suggestion.
Reviewed changes
- Harness presentation threaded end to end —
claudePermissionPresentationsanitizestitle,displayName,description,decisionReason,blockedPath, andmatchedAskRulefrom the SDK'scanUseTooloptions and carries them through the prompt registry into the journal body. - Generic detail bounded —
claudeApprovalItempretty-prints tool input under the sharedMAX_TOOL_DETAIL_LENGTHcap instead ofJSON.stringifyplus the journal payload bound, and the card renders it in a fixed-height, keyboard-focusable scroller. - Journal schema widened — optional
displayName/description/decisionReason/blockedPath/matchedAskRuleadded to the approval type, zod schema, canonical test body, and main-side prompt-body bounds. - Keyboard handling — the approval card takes focus on appearance and resolves Escape itself, plus a reveal-focus re-arm so the composer reclaims focus once the prompt settles.
- Mobile parity — the same fields render on mobile, with the generic detail moved into a bounded
ScrollView.
ℹ️ Question prompts still trap Escape
The approval card now takes focus on appearance and cancels on Escape, but the question card has neither, and the structured session unmounts the composer for any pending prompt (prompt ? null : <NativeChatComposer>). So while a question is on screen a keyboard-only user still cannot dismiss it with Escape, even though its close button calls the same cancelPrompt the approval card now shortcuts.
Technical details
# Escape dismissal is approval-only
## Affected sites
- `src/renderer/src/components/native-chat/NativeChatQuestionCard.tsx` — no card-level focus or Escape handler (only per-option Enter/Space at ~line 200)
- `src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx:317` — composer is unmounted whenever any prompt is pending, so the composer's Escape handler cannot cover the card
## Required outcome
- Escape over an on-screen question card dismisses it exactly as the approval card does, or an explicit decision that question prompts are intentionally not Escape-dismissable.
## Suggested approach (optional)
- Reuse the same card-level `role`/`tabIndex`/`onKeyDown` shape the approval card adopted, or lift the Escape handling into the prompt region that owns both cards.
## Open questions for the human
- Is the asymmetry intentional (a question requires a choice; an approval can be abandoned), or is question-card Escape just out of scope for this PR?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Kept approval actions reachable — the card now shrinks within its flex column (
min-h-0 shrink/overflow-hidden) instead ofshrink-0, all provider context moved into onemax-h-72keyboard-focusable scroller, the title is clamped to two lines, and the action row is pinnedshrink-0. Applied to both the renderer and mobile. - Trimmed unused scaffolding — removed the
body?: ReactNodeslot and theapproval.plan.*i18n keys that shipped unused in the first commit. - De-duplicated the ask-rule type —
ChatApproval.matchedAskRulenow imports the sharedAgentJournalApprovalMatchedAskRule, resolving the prior review's inline nitpick. - Added layout coverage — renderer and mobile tests assert oversized context stays inside one bounded scroller while the actions remain outside it; the structured-session integration test now expects the pretty-printed detail.
ℹ️ PR description now describes a removed design slot
The PR body still documents "an optional body slot so a future tool-specific renderer can replace the generic detail" and a follow-up plan renderer "layered on the body slot above." Commit 2 removed the body prop, so both statements are now inaccurate.
Technical details
# Stale design note in the PR description
## Affected sites
- PR #21087 body — "Design note" and "Follow-up, deliberately not in this PR" sections reference the removed slot
- `src/renderer/src/components/native-chat/NativeChatApprovalCard.tsx` — `body?: ReactNode` is no longer in the props type
## Required outcome
- The PR description reflects the current component surface, or the plan-renderer follow-up names a different seam.
</details>
<!--
Pullfrog review metadata. These findings were written against 0d3dc6ca78;
if commits have landed on brennanb2025/approval-card-broad-fix since, treat every specific bug, file, or
line callout as POTENTIALLY STALE and re-diff before acting on it.
- Mode: IncrementalReview (delta against prior pullfrog review)
- Files reviewed: 25
- Commits reviewed: 2
- Base: main (85d1ffc)
- Head: brennanb2025/approval-card-broad-fix (0d3dc6ca78)
- Reviewed commits:
- 0d3dc6ca78 — fix(native-chat): keep approval actions reachable
- 7f597fdeb8 — fix(native-chat): render approvals from the harness presentation, not serialized tool input
- Prior pullfrog review: 7f597fd (https://github.com/stablyai/orca/pull/21087#pullrequestreview-5228040854)
-->
<!-- PULLFROG_DIVIDER_DO_NOT_REMOVE_PLZ -->
<sup><a href="https://pullfrog.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pullfrog.com/logos/frog-white-full-18px.png"><img src="https://pullfrog.com/logos/frog-green-full-18px.png" width="9px" height="9px" style="vertical-align: middle; " alt="Pullfrog"></picture></a> | [View workflow run](https://github.com/stablyai/orca/actions/runs/35157187402/job/104999323967) | Using `DeepSeek Flash` (free via [Pullfrog for OSS](https://pullfrog.com/for-oss)) | [𝕏](https://x.com/pullfrogai)</sup>
Electron validation (hidden renderer, CDP)PASS on the live native-chat approval card at Normal pane: the live Bash approval renders title, description, reason, and JSON detail in one scroll region, with Allow / Allow for this session / Deny / Stop remaining visible below that region. Constrained 1280×240 pane: the context region scrolls while the action buttons stay on screen and do not move with the scroller. The pending approval was left unanswered so mobile can inspect the same journal item. |
Final review status: READYReviewed and pushed through The review resolved the meaningful issues it found:
Architecture, compatibility, and performance are clean. The change adds no polling, retry loop, cache, timer, listener fanout, subprocess, or second settlement path. Optional journal fields preserve mixed-version clients, and provider strings are control-stripped, byte-bounded, and rendered as text. Validation:
The remaining evidence gap is limited to no physical Android, Windows UI, or SSH UI run. This change has no platform-specific execution behavior; mobile tests, Windows packaging, and wire compatibility cover the affected contracts. |
Visual proof: oversized
|
… serialized tool input (stablyai#21087) * fix(native-chat): render approvals from the harness presentation, not serialized tool input The approval card built its title from the tool name and rendered JSON.stringify(input) into an element with no height bound. Any large payload - a file write's contents, a proposed plan - pushed the action buttons past the viewport with no way to scroll to them, leaving the prompt unanswerable without zooming the pane out. Thread the agent SDK's own presentation fields through the prompt registry into the journal item: title, displayName, description, decisionReason, blockedPath and matchedAskRule. The SDK documents its title as the prompt text to use instead of reconstructing one, and warns that the decision reason may carry terminal escapes, so those are stripped before rendering. The card now also shows why a request was raised rather than only what it was. Bound the detail in a scrollable region that is reachable by keyboard, and cap it main-side with the existing shared tool-detail limit rather than the far looser journal payload bound. Focus moves to the card when a prompt appears and Escape resolves it, which previously did nothing because the composer owning that handler is unmounted while a prompt is pending. Mobile rendered the same unbounded detail and is fixed alongside. * fix(native-chat): keep approval actions reachable




ELI5
Long approval requests could push every choice below the bottom of native chat, leaving no way to answer. The approval now uses the provider's own title and context, keeps that context in a scrollable area, and leaves the choices visible on desktop and mobile.
What Changed
The Claude permission callback now normalizes and sanitizes its presentation once, stores it on the existing durable approval journal item, and lets desktop and mobile render that same data. Responses still travel through the existing pending-prompt registry using the provider's opaque option ID.
Both clients keep the title and action buttons outside one bounded context scroller. The scroller contains the description, decision reason, blocked path, matched ask rule, and formatted tool detail, so any provider-controlled field can grow without moving the actions out of reach. Desktop focus moves to a new approval and Escape remains safe during IME composition.
The follow-up review removed unused future renderer scaffolding and reused the shared matched-rule type. It also made the intended readable JSON formatting part of the integration contract.
Why
Before this change, the renderer rebuilt approval text from the tool name and serialized input. A large write payload could fill the pane and hide every action. Keeping presentation ownership at the provider callback preserves the exact request the provider intended, while the existing journal remains the single durable delivery path for local, remote, desktop, and mobile clients. Reconstructing text in each client or adding another cache would create state that can disagree with the pending request.
Linked Issue
No separate issue; the approval overflow and missing provider context are tracked in this PR.
Visual Proof
Before: no screenshot was retained before the fix. The regression tests reproduce the prior failure with oversized provider fields and assert that they cannot move the actions out of reach.
After, live desktop approval at the normal pane size:
After, the same live approval in a 1280×240 pane, with the context scrolled and actions still fixed on screen:
After, the same live approval delivered through the paired iOS client:
Testing
I manually tested these changes locally
Automated tests added/updated
135 focused main, shared, renderer, and mobile tests pass across the two review loops.
pnpm tcand the mobile TypeScript check pass.pnpm run verify:localization-runtime-catalogpasses.pnpm run check:code-quality:changedpasses with zero new findings.GitHub CI passes static analysis, typecheck, all eight test shards, mobile verification, cross-version wire compatibility, macOS packaging, and Windows packaging.
Electron on macOS: a real Claude Bash approval remained fully actionable at 1728×999 and 1280×240. At the constrained size, the context scrolled from 0 to 60 px while the action row stayed at the same position; Escape during composition did not dismiss the request.
iPhone 17 Pro simulator on iOS 26.5: the paired mobile client received the same live journal item, rendered all provider context, and kept Allow, Allow for this session, Deny, and Stop above the composer. Deny settled the request through the real action path.
AI Disclosure
Review
The final independent review found the provider callback → session registry → durable journal → desktop/mobile rendering ownership correct and the pushed head clean. No new polling, listener, cache, persistent obligation, subprocess churn, or repeated serialization was added. Provider text is bounded before publication, stripped of terminal control sequences, and rendered as text.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No platform-specific shell, path, shortcut, process, or Git behavior changed. Optional journal fields preserve mixed-version clients; folder workspaces and SSH continue to use the execution host's existing session and journal path.
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)