Skip to content

Conversation

@rossmanko
Copy link
Contributor

@rossmanko rossmanko commented Feb 10, 2026

Summary by CodeRabbit

  • New Features

    • File attachment counts now tracked and logged in chat context
    • Terminal sessions display with session/PID labels in sidebar
  • Bug Fixes

    • Improved terminal escape sequence handling for cleaner output
  • Refactor

    • Enhanced sandbox selector interactivity in agent mode
    • Updated fallback model selection logic for improved AI feature performance

rossmanko and others added 3 commits February 10, 2026 12:39
- Added optional properties `fileCount` and `fileImageCount` to the `ChatWideEvent` and `ChatContext` interfaces to track the number of file attachments and image files in chats.
- Implemented `countFileAttachments` function to calculate total file attachments and image counts from chat messages.
- Updated `createChatHandler` to include file counts in the chat logger, improving logging detail for chat events.

This update enhances the chat logging capabilities by providing more granular information about file attachments.
- Changed fallback model references in `providers.ts` to use more descriptive names: `fallback-agent-model` and `fallback-ask-model`, ensuring clarity in model usage.
- Updated the `createChatHandler` function in `chat-handler.ts` to dynamically select the appropriate fallback model based on the current mode, enhancing flexibility in model selection.

These changes improve the organization and clarity of AI model references within the application.
Add a sequence-level first pass to stripTerminalEscapes that removes
complete OSC sequences (633/3008) without destroying real output text
on the same line. The line-level regexes remain as a fallback for
unterminated sequences split across PTY chunks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 10, 2026

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

Project Deployment Actions Updated (UTC)
hackerai Ready Ready Preview, Comment Feb 11, 2026 2:42am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

The PR modifies AI provider fallback models, adds file attachment counting throughout the chat logging infrastructure, refines terminal output escape sequence handling, removes read-only restrictions from the sandbox selector component, and updates the sidebar terminal display to show session identifiers instead of icons.

Changes

Cohort / File(s) Summary
AI Model Provider Configuration
lib/ai/providers.ts
Added "fallback-agent-model" and "fallback-ask-model" providers; removed "fallback-model", "summarization-model", and "summarization-model-free" entries and their corresponding cutoff dates.
File Attachment Counting System
lib/api/chat-logger.ts, lib/api/chat-stream-helpers.ts, lib/logger.ts
Added fileCount and fileImageCount optional fields to ChatContext interface; created countFileAttachments utility function to enumerate file attachments and image counts; extended ChatWideEvent and WideEventBuilder to track file and image counts in logging events.
Chat Handler Model Selection
lib/api/chat-handler.ts
Implemented dynamic fallback model selection based on mode ("fallback-agent-model" for agent mode, "fallback-ask-model" otherwise); integrated file counting via countFileAttachments; replaced hard-coded summarization model references with dynamic model selection.
Sandbox Selector Simplification
app/components/ChatInput.tsx, app/components/SandboxSelector.tsx
Removed readOnly prop and related conditional rendering logic from SandboxSelector; eliminated disabled/readOnly gating in ChatInput, making the sandbox selector always interactive regardless of chat status.
Terminal Display Enhancement
app/components/ComputerSidebar.tsx
Updated Terminal header rendering to display session label or PID text instead of always showing Terminal icon when session or PID data is available.
PTY Output Escape Sequence Handling
lib/ai/tools/utils/pty-output.ts
Added sequence-level OSC pattern (OSC_COMPLETE_RE) to strip properly terminated OSC sequences; implemented two-pass stripping approach to handle complete sequences before line-level cleanup in stripTerminalEscapes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Fallback models dance anew,
With agents asking, choosing true,
File counts hop from log to log,
While sandboxes shed their gating fog,
And terminals display their names with pride! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Daily branch 2026 02 10' is vague and generic, using a date format that provides no meaningful information about what changes are included in the pull request. Use a descriptive title that summarizes the main changes, such as 'Update fallback models and add file attachment counting' or 'Refactor model providers and enhance chat context logging'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch daily-branch-2026-02-10

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

…ment

- Implemented the 'view' action in the shell tool to allow users to capture and view the full scrollback of a shell session via tmux.
- Updated the `createLocalHandlers` function to handle the new 'view' action.
- Enhanced the `LocalPtySessionManager` to support lazy session creation and management, ensuring sessions can be accessed even if they are not currently tracked.
- Improved output handling by stripping unnecessary sentinel noise from captured session content.

These changes enhance the functionality of the shell tool, providing users with better access to session history and improving overall session management.
Copy link

@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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/ai/tools/utils/local-pty-session-manager.ts (1)

591-640: ⚠️ Potential issue | 🟠 Major

Handle tmux failures in sendToSession to avoid false “success”.

tmuxRun returns an exit code, but the current code always returns { success: true }. With the new lazy session registration, a missing tmux session will now silently report success and drop input. Check exitCode and propagate an error.

🛠️ Suggested fix (check exitCode)
-      await this.tmuxRun(sandbox, `tmux send-keys -t ${sn} ${input}`, {
-        displayName,
-      });
-      return { success: true };
+      const result = await this.tmuxRun(sandbox, `tmux send-keys -t ${sn} ${input}`, {
+        displayName,
+      });
+      if (result.exitCode !== 0) {
+        return { success: false, error: result.stderr || result.stdout || "tmux send-keys failed" };
+      }
+      return { success: true };
@@
-    await this.tmuxRun(
+    const result = await this.tmuxRun(
       sandbox,
       `printf '%s' '${base64Input}' | base64 -d | tmux load-buffer -b hai_input - && ` +
         `tmux paste-buffer -t ${sn} -b hai_input -d` +
         (needsEnter ? ` && tmux send-keys -t ${sn} Enter` : ""),
       { displayName },
     );
+    if (result.exitCode !== 0) {
+      return { success: false, error: result.stderr || result.stdout || "tmux paste-buffer failed" };
+    }
 
     return { success: true };
🤖 Fix all issues with AI agents
In `@lib/ai/tools/utils/pty-output.ts`:
- Around line 11-23: The regex literal OSC_COMPLETE_RE contains raw control
characters and triggers Biome's noControlCharactersInRegex lint rule; either
replace the literal with a string-based RegExp (e.g. new
RegExp("\\x1b\\][^\\x07\\x1b\\x9c]*(?:\\x07|\\x1b\\\\|\\x9c)", "g")) or add a
localized lint suppression comment (with a short justification) immediately
above the OSC_COMPLETE_RE declaration to silence the rule; update the
OSC_COMPLETE_RE definition accordingly and ensure the rest of the file still
uses OSC_COMPLETE_RE unchanged.

Remove readOnly and disabled restrictions from SandboxSelector so users
can change their execution environment mid-chat, not just on new chats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated the ComputerSidebar component to conditionally display session information or a terminal icon based on the presence of session or PID data. This improves user feedback by providing context about the current terminal state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/components/ChatInput.tsx`:
- Around line 397-403: The SandboxSelector is currently editable during
streaming (see chatMode, SandboxSelector, sandboxPreference,
setSandboxPreference) which can confuse users if the active run doesn't switch
live; modify the component to either disable the selector while a run is
streaming (e.g., check an isStreaming/isRunActive flag) or keep it enabled but
show a clear “applies to next run” label/tooltip and prevent
setSandboxPreference from affecting the active run state until the current
stream finishes. Update the click/onChange handling in the ChatInput where
SandboxSelector is used to guard changes based on the streaming flag and ensure
any UI label or disabled state is rendered when streaming.

Copy link

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/components/ComputerSidebar.tsx`:
- Around line 236-246: The header can render a blank when sidebarContent.session
is an empty string because the condition uses (sidebarContent.session ||
sidebarContent.pid) but the displayed value uses the nullish coalescing operator
(sidebarContent.session ?? `PID ${sidebarContent.pid}`); change the rendered
value to use the same truthy fallback logic (e.g., render sidebarContent.session
|| `PID ${sidebarContent.pid}`) so an empty string falls back to the PID; locate
this in the isTerminal branch that currently renders either the truncated div or
the Terminal icon.

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