Skip to content

Terminal in procode issues fixed#1420

Merged
neelneelneel merged 19 commits intodevfrom
1389_procode_terminal
Jul 18, 2025
Merged

Terminal in procode issues fixed#1420
neelneelneel merged 19 commits intodevfrom
1389_procode_terminal

Conversation

@KirthikaKumar-K
Copy link
Copy Markdown
Contributor

@KirthikaKumar-K KirthikaKumar-K commented Jul 2, 2025

Description

Fix for terminal in pro code apps breaks with empty line

Issue

  • Go to a pro code app
  • Open the terminal at the bottom of the screen
  • Leave the line blank
  • Click enter
  • See error ### Expected Result

How to Test

  • Go to a pro code app
  • Open the terminal at the bottom of the screen
  • Leave the line blank
  • Click enter
  • Now it would not throw an error instead it would just move to the new line

Attachments

Fix:
Terminal in Procode

While working on this ticket, I identified another bug where the app breaks if the RUN button is clicked with an empty Terminal.
I’ve addressed and fixed that issue as well.
Fix:

  • Disabled the button if the terminal is empty
    Image

Image

@KirthikaKumar-K KirthikaKumar-K requested a review from johbaxter July 2, 2025 15:20
@KirthikaKumar-K KirthikaKumar-K requested a review from a team as a code owner July 2, 2025 15:20
@KirthikaKumar-K KirthikaKumar-K linked an issue Jul 2, 2025 that may be closed by this pull request
4 tasks
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 2, 2025

@CodiumAI-Agent /describe

@QodoAI-Agent
Copy link
Copy Markdown

Title

Terminal in procode issues fixed


User description

Description

Changes Made

How to Test

  1. Steps to reproduce/test the behavior
  2. Expected outcomes

Notes


PR Type

Bug fix, Enhancement


Description

  • Prevent executing empty terminal commands

  • Print new prompt instead of running

  • Disable Run button on empty input


Changes walkthrough 📝

Relevant files
Error handling
Terminal.tsx
Add empty command handling in Terminal                                     

libs/ui/src/components/Terminal/Terminal.tsx

  • Added empty command check before execution
  • Wrote new prompt for empty inputs
  • +7/-4     
    Enhancement
    TerminalPanel.tsx
    Disable Run button on empty input                                               

    packages/client/src/components/workspace/panels/TerminalPanel.tsx

    • Disabled Run button when input empty
    +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jul 2, 2025

    @CodiumAI-Agent /review

    @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jul 2, 2025

    @CodiumAI-Agent /improve

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Prompt Formatting

    The newline and carriage return sequence in terminalInstance.write(\\n\r${PROMPT}`)uses\n\r, which is reversed from the typical \r\n`. This may cause incorrect prompt placement on some terminals. Verify and adjust to the expected line ending sequence.

    if (updatedBuffer.command.trim() === "") {
        // If command is empty, just print a new prompt and move to next line
        terminalInstance.write(`\n\r${PROMPT}`);
    Error Handling

    The await onRun() call when handling non-empty commands is not wrapped in a try/catch block. If onRun throws an error, it could leave the terminal in an inconsistent state. Consider adding error handling around this call.

        // run the command
        await onRun();
    }

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix newline ordering

    Use the correct carriage return + newline sequence instead of \n\r to ensure the
    prompt appears on a new line. This aligns with terminal control sequence standards.

    libs/ui/src/components/Terminal/Terminal.tsx [208]

    -terminalInstance.write(`\n\r${PROMPT}`);
    +terminalInstance.write(`\r\n${PROMPT}`);
    Suggestion importance[1-10]: 6

    __

    Why: Changing \n\r to \r\n aligns with standard terminal newline sequences and prevents potential display issues.

    Low
    Prevent undefined command errors

    Guard against command being null or undefined before calling trim() to prevent
    runtime errors. Optional chaining ensures safe evaluation.

    packages/client/src/components/workspace/panels/TerminalPanel.tsx [242]

    -disabled={command.trim() === ''}
    +disabled={!command?.trim()}
    Suggestion importance[1-10]: 4

    __

    Why: Adding optional chaining guards against command being null or undefined, but this is a minor defensive improvement.

    Low

    This was referenced Jul 9, 2025
    @KirthikaKumar-K KirthikaKumar-K linked an issue Jul 9, 2025 that may be closed by this pull request
    @neelneelneel neelneelneel merged commit cca2666 into dev Jul 18, 2025
    3 checks passed
    @neelneelneel neelneelneel deleted the 1389_procode_terminal branch July 18, 2025 16:40
    @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /update_changelog

    @QodoAI-Agent
    Copy link
    Copy Markdown

    Changelog updates: 🔄

    2025-07-18 *

    Fixed

    • Ignore empty terminal commands and disable Run action on blank input.
    • Prevent unwanted navigation on Open App buttons and add null handling in environment loading.

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    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.

    Console Errors Terminal in pro code apps breaks with empty line

    3 participants