Skip to content

feat: add prompt_sandbox streaming progress UI#1548

Merged
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4352-chat-toolcomponent-prompt_sandbox
Feb 26, 2026
Merged

feat: add prompt_sandbox streaming progress UI#1548
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4352-chat-toolcomponent-prompt_sandbox

Conversation

@sweetmantech
Copy link
Collaborator

@sweetmantech sweetmantech commented Feb 26, 2026

Summary

  • Add PromptSandboxStreamProgress component that renders real-time sandbox output as it streams
  • Add sandboxStreamTypes.ts with shared types and isSandboxStreamProgress type guard
  • Register prompt_sandbox in both getToolCallComponent (booting skeleton) and getToolResultComponent (streaming progress)

Changes

File Action
lib/sandboxes/sandboxStreamTypes.ts New — types + type guard
components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx New — progress component
components/VercelChat/ToolComponents.tsx Modified — add prompt_sandbox cases

UI States

  • booting: Spinner + "Starting sandbox..."
  • streaming: Terminal-style card with scrollable output, auto-scrolls to bottom
  • complete: Green check (or red X for non-zero exit), full output + stderr if any
  • error: Red error card with stderr

Depends on

Test plan

  • Type-checks clean (no new TS errors)
  • Manual: send chat message triggering prompt_sandbox, verify spinner → streaming output → complete
  • Verify fallback to GenericSuccess for non-streaming results

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for a new sandbox tool with real-time execution progress tracking
    • Added visual indicators for sandbox execution states: starting, running, complete, and error
    • Added display of sandbox output and error messages with auto-scrolling during execution
    • Included exit code and final result display after sandbox completion

Add PromptSandboxStreamProgress component that renders real-time sandbox
output as it streams from the API generator tool. Shows booting spinner,
terminal-style streaming output, and complete/error states.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@vercel
Copy link
Contributor

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Feb 26, 2026 7:49pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ba4603d and 8442ddc.

📒 Files selected for processing (5)
  • components/TasksPage/Run/RunLogsList.tsx
  • components/VercelChat/ToolComponents.tsx
  • components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx
  • hooks/useAutoScroll.ts
  • lib/sandboxes/sandboxStreamTypes.ts
📝 Walkthrough

Walkthrough

Added support for the 'prompt_sandbox' tool with streaming progress visualization. Introduced SandboxStreamProgress type and type guard for validation. Created PromptSandboxStreamProgress component to render sandbox execution states including booting, streaming, completion, and error conditions.

Changes

Cohort / File(s) Summary
UI Tool Integration
components/VercelChat/ToolComponents.tsx
Added conditional branches to handle "prompt_sandbox" tool in tool call and result rendering paths, distinguishing between streaming progress states and final success responses.
Sandbox Progress Component
components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx
New React component rendering sandbox execution progress UI with distinct states (booting, streaming, complete, error), including auto-scrolling output display and status indicators.
Type Definitions
lib/sandboxes/sandboxStreamTypes.ts
Introduced SandboxStreamStatus union type, SandboxStreamProgress interface with required and optional fields, and isSandboxStreamProgress type guard for runtime validation.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • PR #1532 — Adds rendering branches for run_sandbox_command and get_task_run_status tools in ToolComponents.tsx, extending the sandbox tool integration pattern.

Poem

🏜️ The sandbox awakes from its booting dream,
Progress flows like a digital stream,
Spinning, streaming, till the task is done,
With error checks—or victory won! ✨

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Solid & Clean Code ✅ Passed Pull request demonstrates solid SOLID principles adherence and clean code practices with focused component responsibilities and robust type safety, though minor DRY violations exist in repeated Tailwind className strings.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-4352-chat-toolcomponent-prompt_sandbox

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx (1)

29-46: Consider adding aria-live for accessibility on streaming output.

The streaming output updates in real-time, but screen reader users won't be notified of these changes. Adding an aria-live region would improve accessibility for users relying on assistive technology.

♿ Proposed accessibility enhancement
   if (progress.status === "streaming") {
     return (
-      <div className="space-y-2">
+      <div className="space-y-2" aria-live="polite" aria-atomic="false">
         <div className="flex items-center gap-2 text-sm text-muted-foreground">
           <Loader className="h-3 w-3 animate-spin" />
           <span>Running in sandbox...</span>
         </div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx` around
lines 29 - 46, The streaming output block (when progress.status === "streaming")
isn't announced to screen readers; update the output container (e.g., the <pre>
referenced by preRef or its wrapper div inside PromptSandboxStreamProgress) to
be an ARIA live region by adding attributes such as aria-live="polite" (or
"assertive" if immediate), aria-atomic="true", and an appropriate role like
role="status" so assistive technology will announce incremental updates to
progress.output; ensure these attributes are applied to the element that
receives dynamic text updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx`:
- Around line 29-46: The streaming output block (when progress.status ===
"streaming") isn't announced to screen readers; update the output container
(e.g., the <pre> referenced by preRef or its wrapper div inside
PromptSandboxStreamProgress) to be an ARIA live region by adding attributes such
as aria-live="polite" (or "assertive" if immediate), aria-atomic="true", and an
appropriate role like role="status" so assistive technology will announce
incremental updates to progress.output; ensure these attributes are applied to
the element that receives dynamic text updates.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9aedb9 and ba4603d.

📒 Files selected for processing (3)
  • components/VercelChat/ToolComponents.tsx
  • components/VercelChat/tools/sandbox/PromptSandboxStreamProgress.tsx
  • lib/sandboxes/sandboxStreamTypes.ts

sweetmantech and others added 3 commits February 26, 2026 14:40
Remove isSandboxStreamProgress guard and GenericSuccess fallback — the
matched tool always renders the streaming progress component.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
DRY: both PromptSandboxStreamProgress and RunLogsList used the same
auto-scroll-to-bottom pattern. Extracted to shared hooks/useAutoScroll.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@sweetmantech sweetmantech merged commit 6bcd755 into test Feb 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant