Commit Graph

48 Commits

  • fix(agent-loop): notify type (#608)
    ## Description
    
    The `as AppConfig` type assertion in the constructor may introduce
    potential type safety risks. Removing the assertion and making `notify`
    an optional parameter could enhance type robustness and prevent
    unexpected runtime errors.
    
    close: #605
  • feat: add support for custom provider configuration in the user config (#537)
    ### What
    
    - Add support for loading and merging custom provider configurations
    from a local `providers.json` file.
    - Allow users to override or extend default providers with their own
    settings.
    
    ### Why
    
    This change enables users to flexibly customize and extend provider
    endpoints and API keys without modifying the codebase, making the CLI
    more adaptable for various LLM backends and enterprise use cases.
    
    ### How
    
    - Introduced `loadProvidersFromFile` and `getMergedProviders` in config
    logic.
    - Added/updated related tests in [tests/config.test.tsx]
    
    
    ### Checklist
    
    - [x] Lint passes for changed files
    - [x] Tests pass for all files
    - [x] Documentation/comments updated as needed
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • fix: inconsistent usage of base URL and API key (#507)
    A recent commit introduced the ability to use third-party model
    providers. (Really appreciate it!)
    
    However, the usage is inconsistent: some pieces of code use the custom
    providers, whereas others still have the old behavior. Additionally,
    `OPENAI_BASE_URL` is now being disregarded when it shouldn't be.
    
    This PR normalizes the usage to `getApiKey` and `getBaseUrl`, and
    enables the use of `OPENAI_BASE_URL` if present.
    
    ---------
    
    Co-authored-by: Gabriel Bianconi <GabrielBianconi@users.noreply.github.com>
  • feat: add support for ZDR orgs (#481)
    - Add `store: boolean` to `AgentLoop` to enable client-side storage of
    response items
    - Add `--disable-response-storage` arg + `disableResponseStorage` config
  • fix: /clear now clears terminal screen and resets context left indicator (#425)
    ## What does this PR do?
    * Implements the full `/clear` command in **codex‑cli**:
      * Resets chat history **and** wipes the terminal screen.
      * Shows a single system message: `Context cleared`.
    * Adds comprehensive unit tests for the new behaviour.
    
    ## Why is it needed?
    * Fixes user‑reported bugs:  
      * **#395**  
      * **#405**
    
    ## How is it implemented?
    * **Code** – Adds `process.stdout.write('\x1b[3J\x1b[H\x1b[2J')` in
    `terminal.tsx`. Removed reference to `prev` in `
            setItems((prev) => [
              ...prev,
    ` in `terminal-chat-new-input.tsx` & `terminal-chat-input.tsx`.
    
    ## CI / QA
    All commands pass locally:
    ```bash
    pnpm test      # green
    pnpm run lint  # green
    pnpm run typecheck  # zero TS errors
    ```
    
    ## Results
    
    
    
    https://github.com/user-attachments/assets/11dcf05c-e054-495a-8ecb-ac6ef21a9da4
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • chore: improve storage/ implementation; use log(...) consistently (#473)
    This PR tidies up primitives under storage/.
    
    **Noop changes:**
    
    * Promote logger implementation to top-level utility outside of agent/
    * Use logger within storage primitives
    * Cleanup doc strings and comments
    
    **Functional changes:**
    
    * Increase command history size to 10_000
    * Remove unnecessary debounce implementation and ensure a session ID is
    created only once per agent loop
    
    ---------
    
    Signed-off-by: Thibault Sottiaux <tibo@openai.com>
  • fix: auto-open model-selector when model is not found (#448)
    Change the check from checking if the model has been deprecated to check
    if the model_not_found
    
    
    https://github.com/user-attachments/assets/ad0f7daf-5eb4-4e4b-89e5-04240044c64f
  • feat: tab completions for file paths (#279)
    Made a PR as was requested in the #113
  • refactor(history-overlay): split into modular functions & add tests (fixes #402) (#403)
    ## What
    This PR targets #402 and refactors the `history-overlay.tsx`component to
    reduce cognitive complexity by splitting the `buildLists` function into
    smaller, focused helper functions. It also adds comprehensive test
    coverage to ensure the functionality remains intact.
    
    ## Why
    The original `buildLists` function had high cognitive complexity due to
    multiple nested conditionals, complex string manipulation, and mixed
    responsibilities. This refactor makes the code more maintainable and
    easier to understand while preserving all existing functionality.
    
    ## How
    - Split `buildLists` into focused helper functions
    - Added comprehensive test coverage for all functionality
    - Maintained existing behavior and keyboard interactions
    - Improved code organization and readability
    
    ## Testing
    All tests pass, including:
    - Command mode functionality
    - File mode functionality
    - Keyboard interactions
    - Error handling
  • fix: allow proper exit from new Switch approval mode dialog (#453)
    As described in
    https://github.com/openai/codex/issues/392#issuecomment-2817090022
    introduced by #400
    
    The testing I'd done worked correctly because I was using the (s)
    shortcut, but selecting the same option using arrow‑key → Enter on
    “Switch approval mode” was preventing the user from subsequently exiting
    the Switch approval mode dialog, requiring a ^C to quit codex entirely.
    With this fix, both entry methods work correctly in my testing.
    
    Per codex:
    
    Issue
    
    - When you navigated down (↓) to “Switch approval mode (s)” in the Shell
    Command review dialog and pressed Enter, the ApprovalModeOverlay would
    open—but because the underlying `TerminalChatCommandReview` component
    stayed mounted (albeit disabled), its own Ink input handlers immediately
    re‑captured the same key events and re‑opened the overlay as soon as you
    hit Esc or Enter again. In practice this made it impossible to exit the
    submenu.
    
    Root cause
    
    - We only disabled the SelectInput via `isDisabled`, but never fully
    unmounted the review UI when an overlay was shown, so its `useInput` and
    `<Select>` hooks were still active and “stealing” keys.
    
    Fix
    
    - In `terminal-chat.tsx` we now only render `<TerminalChatInput>` (and
    by extension `TerminalChatCommandReview`) when `overlayMode === "none"`.
    That unmounts all of its key handlers whenever any overlay (history,
    model, approval, help, diff) is open, so no input leaks through.
    
    Files changed
    
    - **src/components/chat/terminal-chat.tsx**: Wrapped the entire
    `<TerminalChatInput>` block in `overlayMode === "none" && agent`
    
    With that in place, arrow‑key → Enter on “Switch approval mode”
    correctly opens the overlay, and then you can use Enter/Esc inside the
    overlay without getting stuck or immediately re‑opening it.
  • feat: support multiple providers via Responses-Completion transformation (#247)
    https://github.com/user-attachments/assets/9ecb51be-fa65-4e99-8512-abb898dda569
    
    Implemented it as a transformation between Responses API and Completion
    API so that it supports existing providers that implement the Completion
    API and minimizes the changes needed to the codex repo.
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
    Co-authored-by: Fouad Matin <169186268+fouad-openai@users.noreply.github.com>
    Co-authored-by: Fouad Matin <fouad@openai.com>
  • fix: remove unnecessary isLoggingEnabled() checks (#420)
    It appears that use of `isLoggingEnabled()` was erroneously copypasta'd
    in many places. This PR updates its docstring to clarify that should
    only be used to avoid constructing a potentially expensive docstring.
    With this change, the only function that merits/uses this check is
    `execCommand()`.
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/openai/codex/pull/420).
    * #423
    * __->__ #420
    * #419
  • feat: allow multi-line input (#438)
    ## Description
    This PR implements multi-line input support for Codex when it asks for
    user feedback (Issue #344). Users can now use Shift+Enter to add new
    lines in their responses, making it easier to provide formatted code
    snippets, lists, or other structured content.
    
    ## Changes
    - Replace the single-line TextInput component with the
    MultilineTextEditor component in terminal-chat-input.tsx
    - Add support for Shift+Enter to create new lines
    - Update key handling logic to properly handle history navigation in a
    multi-line context
    - Add reference to the editor to access cursor position information
    - Update help text to inform users about the Shift+Enter functionality
    - Add tests for the new functionality
    
    ## Testing
    - Added new test file (terminal-chat-input-multiline.test.tsx) to test
    the multi-line input functionality
    - All existing tests continue to pass
    - Manually tested the feature to ensure it works as expected
    
    ## Fixes
    Closes #344
    
    ## Screenshots
    N/A
    
    ## Additional Notes
    This implementation maintains backward compatibility while adding the
    requested multi-line input functionality. The UI remains clean and
    intuitive, with a simple hint about using Shift+Enter for new lines.
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • use spawn instead of exec to avoid injection vulnerability (#416)
    https://github.com/openai/codex/pull/160 introduced a call to `exec()`
    that takes a format string as an argument, but it is not clear that the
    expansions within the format string are escaped safely. As written, it
    is possible a carefully crafted command (e.g., if `cwd` were `"; && rm
    -rf` or something...) could run arbitrary code.
    
    Moving to `spawn()` makes this a bit better, as now at least `spawn()`
    itself won't run an arbitrary process, though I suppose `osascript`
    itself still could if the value passed to `-e` were abused. I'm not
    clear on the escaping rules for AppleScript to ensure that `safePreview`
    and `cwd` are injected safely.
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/openai/codex/pull/416).
    * #423
    * #420
    * #419
    * __->__ #416
  • feat: /diff command to view git diff (#426)
    Adds `/diff` command to view git diff
  • re-enable Prettier check for codex-cli in CI (#417)
    This check was lost in https://github.com/openai/codex/pull/287. Both
    the root folder and `codex-cli/` have their own `pnpm format` commands
    that check the formatting of different things.
    
    Also ran `pnpm format:fix` to fix the formatting violations that got in
    while this was disabled in CI.
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/openai/codex/pull/417).
    * #420
    * #419
    * #416
    * __->__ #417
  • feat: add /command autocomplete (#317)
    Add interactive slash‑command autocomplete & navigation in chat input
    
        Description
    This PR enhances the chat input component by adding first‑class support
    for slash commands (/help, /clear, /compact, etc.)
        with:
    
    * **Live filtering:** As soon as the user types leading `/`, a list of
    matching commands is shown below the prompt.
    * **Arrow‑key navigation:** Up/Down arrows cycle through suggestions.
    * **Enter to autocomplete:** Pressing Enter on a partial command will
    fill it (without submitting) so you can add
        arguments or simply press Enter again to execute.
    * **Type‑safe registry:** A new `slash‑commands.ts` file declares all
    supported commands in one place, along with
        TypeScript types to prevent drift.
    * **Validation:** Only registered commands will ever autocomplete or be
    suggested; unknown single‑word slash inputs still
        show an “Invalid command” system message.
            * **Automated tests:**
                * Unit tests for the command registry and prefix filtering
    
                * Existing tests continue passing with no regressions
    
        Motivation
    Slash commands provide a quick, discoverable way to control the agent
    (clearing history, compacting context, opening overlays,
    etc.). Before, users had to memorize the exact command or rely on the
    generic /help list—autocomplete makes them far more
        accessible and reduces typos.
    
        Changes
    
    * `src/utils/slash‑commands.ts` – defines `SlashCommand` and exports a
    flat list of supported commands + descriptions
            * `terminal‑chat‑input.tsx`
                * Import and type the command registry
    
    * Render filtered suggestions under the prompt when input starts with
    `/`
    
    * Hook into `useInput` to handle Up/Down and Enter for selection & fill
    
    * Flag to swallow the first Enter (autocomplete) and only submit on the
    next
    * Updated tests in `tests/slash‑commands.test.ts` to cover registry
    contents and filtering logic
            * Removed old JS version and fixed stray `@ts‑expect‑error`
    
        How to test locally
    
            1. Type `/` in the prompt—you should see matching commands.
    2. Use arrows to move the highlight, press Enter to fill, then Enter
    again to execute.
    3. Run the full test suite (`npm test`) to verify no regressions.
    
        Notes
    
    * Future work could include fuzzy matching, paging long lists, or more
    visual styling.
    * This change is purely additive and does not affect non‑slash inputs or
    existing slash handlers.
    
    ---------
    
    Co-authored-by: Fouad Matin <169186268+fouad-openai@users.noreply.github.com>
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • feat: allow switching approval modes when prompted to approve an edit/command (#400)
    Implements https://github.com/openai/codex/issues/392
    
    When the user is in suggest or auto-edit mode and gets an approval
    request, they now have an option in the `Shell Command` dialog to:
    `Switch approval mode (v)`
    
    That option brings up the standard `Switch approval mode` dialog,
    allowing the user to switch into the desired mode, then drops them back
    to the `Shell Command` dialog's `Allow command?` prompt, allowing them
    to approve the current command and let the agent continue doing the rest
    of what it was doing without interruption.
    ```
    ╭────────────────────────────────────────────────────────
    │Shell Command
    │                          
    │$ apply_patch << 'PATCH'    
    │*** Begin Patch                      
    │*** Update File: foo.txt          
    │@@ -1 +1 @@                         
    │-foo                                          
    │+bar                                         
    │*** End Patch                         
    │PATCH                                    
    │                                                
    │                                                
    │Allow command?                   
    │                                                
    │    Yes (y)                                
    │    Explain this command (x) 
    │    Edit or give feedback (e)  
    │    Switch approval mode (v)
    │    No, and keep going (n)    
    │    No, and stop for now (esc)
    ╰────────────────────────────────────────────────────────╭────────────────────────────────────────────────────────
    │ Switch approval mode      
    │ Current mode: suggest  
    │                                          
    │                                          
    │                                          
    │ ❯ suggest                        
    │   auto-edit                       
    │   full-auto                        
    │ type to search · enter to confirm · esc to cancel 
    ╰────────────────────────────────────────────────────────
    ```
  • feat: add flex mode option for cost savings (#372)
    Adding in an option to turn on flex processing mode to reduce costs when
    running the agent.
    
    Bumped the openai typescript version to add the new feature.
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • fix: /bug report command, thinking indicator (#381)
    - Fix `/bug` report command
    - Fix thinking indicator
  • feat: add /bug report command (#312)
    Add `/bug` command for chat session
  • Fix handling of Shift+Enter in e.g. Ghostty (#338)
    Fix: Shift + Enter no longer prints “[27;2;13~” in the single‑line
    input. Validated as working and necessary in Ghostty on Linux.
    
    ## Key points
    - src/components/vendor/ink-text-input.tsx
    - Added early handler that recognises the two modifyOtherKeys
    escape‑sequences
        - [13;<mod>u  (mode 2 / CSI‑u)
        - [27;<mod>;13~ (mode 1 / legacy CSI‑~)
    - If Ctrl is held (hasCtrl flag) → call onSubmit() (same as plain
    Enter).
    - Otherwise → insert a real newline at the caret (same as Option+Enter).
      - Prevents the raw sequence from being inserted into the buffer.
    
    - src/components/chat/multiline-editor.tsx
    - Replaced non‑breaking spaces with normal spaces to satisfy eslint
    no‑irregular‑whitespace rule (no behaviour change).
    
    All unit tests (114) and ESLint now pass:
    npm test ✔️
    npm run lint ✔️
  • fix: update context left display logic in TerminalChatInput component (#307)
    Added persistent context length with colour coding.
  • fix: handle invalid commands (#304)
    ### What is added?
    
    I extend the if-else blocks with an additional condition where the
    commands validity is checked. This only applies for entered inputs that
    start with '/' and are a single word. This isn't necessarily restrictive
    from the previous behavior of the program. When an invalid command is
    detected, an error message is printed with a direction to retrieve
    command list.
    
    ### Why is it added?
    
    There are three main reasons for this change 
    
    **1. Model Hallucination**: When invalid commands are passed as prompts
    to models, models hallucinate behavior. Since there was a fall through
    in invalid commands, the models took these as prompts and hallucinated
    that they completed the prompted task. An example of this behavior is
    below. In the case of this example, the model though they had access to
    `/clearhistory` tool where in reality that isn't the case.
    A before and after effect of this tool is below:
    
    ![img](https://github.com/user-attachments/assets/3166f151-d5d0-46d6-9ba7-c7e64ff35e4a)
    
    ![img2](https://github.com/user-attachments/assets/69934306-af68-423d-a5f0-9d922be01d27)
    
    
    **2. Saves Users Credits and Time**: Since false commands and invalid
    commands aren't processed by the model, the user doesn't spend money on
    stuff that could have been mitigated much easily. The time argument is
    especially applicable for reasoning models.
    
    **3. Saves GPU Time**: GPU time is valuable, and it is not necessary to
    spend it on unnecessary/invalid requests.
    
    ### Code Explanation
    
    If no command is matched, we check if the inputValue start with `/`
    which indicated the input is a command (I will address the case where it
    is isn't below). If the inputValue start with `/` we enter the else if
    statement. I used a nested if statement for readability and further
    extendability in the future.
    
    There are alternative ways to check besides regex, but regex is a short
    code and looks clean.
    
    **Check Conditions**: The reason why I only check single word(command)
    case is that to allow prompts where the user might decide to start with
    `/` and aren't commands. The nested if statements also come in handy
    where in the future other contributors might want to extend this
    checking.
    
    The code passes type, lint and test checks.
  • feat: add /compact (#289)
    Added the ability to compact. Not sure if I should switch the model over
    to gpt-4.1 for longer context or if keeping the current model is fine.
    Also I'm not sure if setting the compacted to system is best practice,
    would love feedback 😄
    
    Mentioned in this issue: https://github.com/openai/codex/issues/230
  • fix: duplicated message on model change (#276)
    Problem:
    Pressing "Enter" could trigger the selection logic twice—once from the
    text box and once from the list of options—causing the model to switch
    twice.
    
    Fix:
    Now, the text box only handles "Enter" if there are no options in the
    list. If options are present, only the list handles "Enter." This
    prevents the selection from happening twice.
    
    before:
    
    
    https://github.com/user-attachments/assets/ae02f864-2f33-42c0-bd99-dee2d0d107ad
    
    after:
    
    
    https://github.com/user-attachments/assets/b656ed19-32a2-4218-917b-9af630a4fb2f
  • feat: update position of cursor when navigating input history with arrow keys to the end of the text (#255)
    Updated the position of the cursor on the user input box to be at the
    end of the text when the user uses the arrow keys to navigate through
    the input history in order to better match the behavior of a terminal.
  • feat: add notifications for MacOS using Applescript (#160)
    yolo'ed it with codex. Let me know if this looks good to you.
    
    https://github.com/openai/codex/issues/148
    
    tested with:
    ```
    npm run build:dev
    ```
    
    <img width="377" alt="Screenshot 2025-04-16 at 18 12 01"
    src="https://github.com/user-attachments/assets/79aa799b-b0b9-479d-84f1-bfb83d34bfb9"
    />
  • feat: enhance image path detection in input processing (#189)
    I wanted to be able to drag and drop images while in the chat. Here it
    is.
    
    I have read the CLA Document and I hereby sign the CLA
  • add support for -w,--writable-root to add more writable roots for sandbox (#263)
    This adds support for a new flag, `-w,--writable-root`, that can be
    specified multiple times to _amend_ the list of folders that should be
    configured as "writable roots" by the sandbox used in `full-auto` mode.
    Values that are passed as relative paths will be resolved to absolute
    paths.
    
    Incidentally, this required updating a number of the `agent*.test.ts`
    files: it feels like some of the setup logic across those tests could be
    consolidated.
    
    In my testing, it seems that this might be slightly out of distribution
    for the model, as I had to explicitly tell it to run `apply_patch` and
    that it had the permissions to write those files (initially, it just
    showed me a diff and told me to apply it myself). Nevertheless, I think
    this is a good starting point.
  • feat: shell command explanation option (#173)
    # Shell Command Explanation Option
    
    ## Description
    This PR adds an option to explain shell commands when the user is
    prompted to approve them (Fixes #110). When reviewing a shell command,
    users can now select "Explain this command" to get a detailed
    explanation of what the command does before deciding whether to approve
    or reject it.
    
    ## Changes
    - Added a new "EXPLAIN" option to the `ReviewDecision` enum
    - Updated the command review UI to include an "Explain this command (x)"
    option
    - Implemented the logic to send the command to the LLM for explanation
    using the same model as the agent
    - Added a display for the explanation in the command review UI
    - Updated all relevant components to pass the explanation through the
    component tree
    
    ## Benefits
    - Improves user understanding of shell commands before approving them
    - Reduces the risk of approving potentially harmful commands
    - Enhances the educational aspect of the tool, helping users learn about
    shell commands
    - Maintains the same workflow with minimal UI changes
    
    ## Testing
    - Manually tested the explanation feature with various shell commands
    - Verified that the explanation is displayed correctly in the UI
    - Confirmed that the user can still approve or reject the command after
    viewing the explanation
    
    ## Screenshots
    
    ![improved_shell_explanation_demo](https://github.com/user-attachments/assets/05923481-29db-4eba-9cc6-5e92301d2be0)
    
    
    ## Additional Notes
    The explanation is generated using the same model as the agent, ensuring
    consistency in the quality and style of explanations.
    
    ---------
    
    Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
  • feat: add command history persistence (#152)
    This PR adds a command history persistence feature to Codex CLI that:
    
    1. **Stores command history**: Commands are saved to
    `~/.codex/history.json` and persist between CLI sessions.
    2. **Navigates history**: Users can use the up/down arrow keys to
    navigate through command history, similar to a traditional shell.
    3. **Filters sensitive data**: Built-in regex patterns prevent commands
    containing API keys, passwords, or tokens from being saved.
    4. **Configurable**: Added configuration options for history size,
    enabling/disabling history, and custom regex patterns for sensitive
    content.
    5. **New command**: Added `/clearhistory` command to clear command
    history.
    
      ## Code Changes
    
    - Added `src/utils/storage/command-history.ts` with functions for
    history management
      - Extended config system to support history settings
      - Updated terminal input components to use persistent history
      - Added help text for the new `/clearhistory` command
      - Added CLAUDE.md file for guidance when working with the codebase
    
      ## Testing
    
      - All tests are passing
    - Core functionality works with both input components (standard and
    multiline)
    - History navigation behaves correctly at line boundaries with the
    multiline editor
  • bugfix: remove redundant thinking updates and put a thinking timer above the prompt instead (#216)
    I had Codex read #182 and draft a PR to fix it. This is its suggested
    approach. I've tested it and it works. It removes the purple `thinking
    for 386s` type lines entirely, and replaces them with a single yellow
    `thinking for #s` line:
    ```
    thinking for 31s
    ╭────────────────────────────────────────╮
    │(  ●   )  Thinking..      
    ╰────────────────────────────────────────╯
    ```
    prompt. I've been using it that way via `npm run dev`, and prefer it.
    
    ## What
    
    Empty "reasoning" updates were showing up as blank lines in the terminal
    chat history. We now short-circuit and return `null` whenever
    `message.summary` is empty, so those no-ops are suppressed.
    
    ## How
    
    - In `TerminalChatResponseReasoning`, return early if `message.summary`
    is falsy or empty.
    - In `TerminalMessageHistory`, drop any reasoning items whose
    `summary.length === 0`.
    - Swapped out the loose `any` cast for a safer `unknown`-based cast.
    - Rolled back the temporary Vitest script hacks that were causing stack
    overflows.
    
    ## Why
    
    Cluttering the chat with empty lines was confusing; this change ensures
    only real reasoning text is rendered.
    Reference: openai/codex#182
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • fix: typos in prompts and comments (#195)
    Used Codex and https://github.com/crate-ci/typos to identify + fix typos
    
    Signed-off-by: Jatan Loya <jatanloya@gmail.com>
  • fix: allow continuing after interrupting assistant (#178)
    ## Description
    This PR fixes the issue where the CLI can't continue after interrupting
    the assistant with ESC ESC (Fixes #114). The problem was caused by
    duplicate code in the `cancel()` method and improper state reset after
    cancellation.
    
    ## Changes
    - Fixed duplicate code in the `cancel()` method of the `AgentLoop` class
    - Added proper reset of the `currentStream` property in the `cancel()`
    method
    - Created a new `AbortController` after aborting the current one to
    ensure future tool calls work
    - Added a system message to indicate the interruption to the user
    - Added a comprehensive test to verify the fix
    
    ## Benefits
    - Users can now continue using the CLI after interrupting the assistant
    - Improved user experience by providing feedback when interruption
    occurs
    - Better state management in the agent loop
    
    ## Testing
    - Added a dedicated test that verifies the agent can process new input
    after cancellation
    - Manually tested the fix by interrupting the assistant and confirming
    that new input is processed correctly
    
    ---------
    
    Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
  • fix: correct typos in thinking texts (transcendent & parroting) (#108)
    Ran codex on its own source code to find mistakes & commit, even though
    they are commented out.
  • Removes computeAutoApproval() and tightens up canAutoApprove() as the source of truth (#126)
    Previously, `parseToolCall()` was using `computeAutoApproval()`, which
    was a somewhat parallel implementation of `canAutoApprove()` in order to
    get `SafeCommandReason` metadata for presenting information to the user.
    The only function that was using `SafeCommandReason` was
    `useMessageGrouping()`, but it turns out that function was unused, so
    this PR removes `computeAutoApproval()` and all code related to it.
    
    More importantly, I believe this fixes
    https://github.com/openai/codex/issues/87 because
    `computeAutoApproval()` was calling `parse()` from `shell-quote` without
    wrapping it in a try-catch. This PR updates `canAutoApprove()` to use a
    tighter try-catch block that is specific to `parse()` and returns an
    appropriate `SafetyAssessment` in the event of an error, based on the
    `ApprovalPolicy`.
    
    Signed-off-by: Michael Bolin <mbolin@openai.com>
  • Initial commit
    Signed-off-by: Ilan Bigio <ilan@openai.com>