Commit Graph
927 Commits
Author SHA1 Message Date
James Peter 5d50fff3c1 Fix Windows PowerShell version replacement
- Fix PowerShell variable substitution in Windows builds
- Use proper escaping for PowerShell string replacement
- Ensures version is correctly set in Cargo.toml on Windows
2025-08-14 19:53:59 +10:00
James Peter 7c3c15df1c Merge branch 'main' of https://github.com/just-every/coder into main 2025-08-14 19:51:11 +10:00
James Peter 537f50b2d0 Fix version embedding in release builds
- Add determine-version job to calculate version before building
- Set version in Cargo.toml before building binaries
- Use pre-determined version for npm publishing
- This ensures binaries report correct version instead of 0.0.0
- Fixes upgrade check always appearing due to version mismatch
2025-08-14 19:50:53 +10:00
GitHub Action 6c7595d3d9 chore(release): 0.1.10 [skip ci] 2025-08-14 09:32:01 +00:00
James Peter 2953a7f60a Fix Windows build and trailing whitespace
- Fix type mismatch in Chrome path vector on Windows
- Remove trailing whitespace in codex.rs and chatwidget.rs
- Ensure all paths in chrome_paths vector are String type
2025-08-14 19:14:35 +10:00
James Peter 8a081c1648 Fix formatting and build issues
- Applied cargo fmt to fix code formatting
- Fixed trailing whitespace issues
- Updated colors to use theme system
- Fixed merge-related syntax errors
- Recreated build-fast.sh for monorepo structure
2025-08-14 19:05:19 +10:00
James Peter ea1195eb0e Merge upstream/main - favor our version for conflicts
- Merged latest changes from openai/codex upstream
- Kept our deletion of status_indicator_widget.rs
- Incorporated upstream improvements to:
  - MCP server wire format and message processing
  - Client enhancements for streaming and error handling
  - Test improvements and new test fixtures
  - GitHub CI workflow updates
  - Various bug fixes and performance improvements
2025-08-14 18:44:12 +10:00
James PeterandClaude 276a4d4ae9 Fix virtual cursor JavaScript - add missing defs and filter elements
The virtual cursor wasn't displaying because the SVG filter elements (defs and filt) were not being created, causing the JavaScript to fail silently. Added the missing element creation and proper filter attributes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-14 18:40:10 +10:00
James PeterandClaude 718fa67790 Fix slash command argument parsing and add browser enhancements
Major changes:
- Fixed slash command handlers receiving full command text instead of just arguments
  - Added command_args extraction in app.rs to properly parse arguments
  - Now /browser and /chrome commands receive only their arguments, not the full command

Browser improvements:
- Added Chrome browser integration with external Chrome DevTools
- Implemented virtual cursor visualization with smooth animation
- Added screenshot deduplication using perceptual hashing (pHash + dHash)
- Enhanced browser manager with Chrome connection support
- Added chrome_selection_view for browser mode selection UI

Image comparison:
- Implemented efficient image comparison using perceptual hashing
- Screenshots are now deduplicated to reduce token usage
- System shows "[Screenshot unchanged]" when identical screenshots detected

Code cleanup:
- Fixed unused variable warnings in browser/src/page.rs
- Marked unused image comparison function with underscore prefix
- All builds now compile without warnings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-14 18:30:08 +10:00
Michael BolinandGitHub f968a1327a feat: add support for an InterruptConversation request (#2287)
This adds `ClientRequest::InterruptConversation`, which effectively maps
directly to `Op::Interrupt`.

---

* __->__  #2287
* #2286
* #2285
2025-08-13 23:12:03 -07:00
Michael BolinandGitHub 539f4b290e fix: add support for exec and apply_patch approvals in the new wire format (#2286)
Now when `CodexMessageProcessor` receives either a
`EventMsg::ApplyPatchApprovalRequest` or a
`EventMsg::ExecApprovalRequest`, it sends the appropriate request from
the server to the client. When it gets a response, it forwards it on to
the `CodexConversation`.

Note this takes a lot of code from:


https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/conversation_loop.rs

https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/exec_approval.rs

https://github.com/openai/codex/blob/main/codex-rs/mcp-server/src/patch_approval.rs

I am copy/pasting for now because I am trying to consolidate around the
new `wire_format.rs`, so I plan to delete these other files soon.

Now that we have requests going both from client-to-server and
server-to-client, I renamed `CodexRequest` to `ClientRequest`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2286).
* #2287
* __->__ #2286
* #2285
2025-08-13 23:00:50 -07:00
Michael BolinandGitHub 085f166707 fix: make all fields of Session private (#2285)
As `Session` needs a bit of work, it will make things easier to move
around if we can start by reducing the extent of its public API. This
makes all the fields private, though adds three `pub(crate)` getters.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2285).
* #2287
* #2286
* __->__ #2285
2025-08-13 22:53:54 -07:00
Kazuhiro SeraandGitHub 6d0eb9128e Use enhancement tag for feature requests (#2282) 2025-08-14 12:08:35 +09:00
e8ffecd632 Clarify PR/Contribution guidelines and issue templates (#2281)
Co-authored-by: Dylan <[email protected]>
2025-08-13 21:56:29 -04:00
f1be7978cf Parse reasoning text content (#2277)
Sometimes COT is returns as text content instead of `ReasoningText`. We
should parse it but not serialize back on requests.

---------

Co-authored-by: Ahmed Ibrahim <[email protected]>
2025-08-13 18:39:58 -07:00
Michael BolinandGitHub a62510e0ae fix: verify notifications are sent with the conversationId set (#2278)
This updates `CodexMessageProcessor` so that each notification it sends
for a `EventMsg` from a `CodexConversation` such that:

- The `params` always has an appropriate `conversationId` field.
- The `method` is now includes the name of the `EventMsg` type rather
than using `codex/event` as the `method` type for all notifications. (We
currently prefix the method name with `codex/event/`, but I think that
should go away once we formalize the notification schema in
`wire_format.rs`.)

As part of this, we update `test_codex_jsonrpc_conversation_flow()` to
verify that the `task_finished` notification has made it through the
system instead of sleeping for 5s and "hoping" the server finished
processing the task. Note we have seen some flakiness in some of our
other, similar integration tests, and I expect adding a similar check
would help in those cases, as well.
2025-08-13 17:54:12 -07:00
Michael BolinandGitHub e7bad650ff feat: support traditional JSON-RPC request/response in MCP server (#2264)
This introduces a new set of request types that our `codex mcp`
supports. Note that these do not conform to MCP tool calls so that
instead of having to send something like this:

```json
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "id": 42,
  "params": {
    "name": "newConversation",
    "arguments": {
      "model": "gpt-5",
      "approvalPolicy": "on-request"
    }
  }
}
```

we can send something like this:


```json
{
  "jsonrpc": "2.0",
  "method": "newConversation",
  "id": 42,
  "params": {
    "model": "gpt-5",
    "approvalPolicy": "on-request"
  }
}
```

Admittedly, this new format is not a valid MCP tool call, but we are OK
with that right now. (That is, not everything we might want to request
of `codex mcp` is something that is appropriate for an autonomous agent
to do.)

To start, this introduces four request types:

- `newConversation`
- `sendUserMessage`
- `addConversationListener`
- `removeConversationListener`

The new `mcp-server/tests/codex_message_processor_flow.rs` shows how
these can be used.

The types are defined on the `CodexRequest` enum, so we introduce a new
`CodexMessageProcessor` that is responsible for dealing with requests
from this enum. The top-level `MessageProcessor` has been updated so
that when `process_request()` is called, it first checks whether the
request conforms to `CodexRequest` and dispatches it to
`CodexMessageProcessor` if so.

Note that I also decided to use `camelCase` for the on-the-wire format,
as that seems to be the convention for MCP.

For the moment, the new protocol is defined in `wire_format.rs` within
the `mcp-server` crate, but in a subsequent PR, I will probably move it
to its own crate to ensure the protocol has minimal dependencies and
that we can codegen a schema from it.



---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2264).
* #2278
* __->__ #2264
2025-08-13 17:36:29 -07:00
pakrym-oaiandGitHub de2c6a2ce7 Enable reasoning for codex-prefixed models (#2275)
## Summary
- enable reasoning for any model slug starting with `codex-`
- provide default model info for `codex-*` slugs
- test that codex models are detected and support reasoning

## Testing
- `just fmt`
- `just fix` *(fails: E0658 `let` expressions in this position are
unstable)*
- `cargo test --all-features` *(fails: E0658 `let` expressions in this
position are unstable)*

------
https://chatgpt.com/codex/tasks/task_i_689d13f8705483208a6ed21c076868e1
2025-08-13 17:02:50 -07:00
Michael BolinandGitHub 3a0656df63 fix: skip cargo test for release builds on ordinary CI because it is slow, particularly with --all-features set (#2276)
I put this PR together because I noticed I have to wait quite a bit
longer on my PRs since we added
https://github.com/openai/codex/pull/2242 to catch more build issues.

I think we should think about reigning in our use of create features,
but this should be good enough to speed things up for now.
2025-08-13 16:27:20 -07:00
Jeremy RoseandGitHub bb9ce3cb78 tui: standardize tree prefix glyphs to └ (#2274)
Replace mixed `⎿` and `L` prefixes with `└` in TUI rendering.

<img width="454" height="659" alt="Screenshot 2025-08-13 at 4 02 03 PM"
src="https://github.com/user-attachments/assets/61c9c7da-830b-4040-bb79-a91be90870ca"
/>
2025-08-13 19:14:03 -04:00
James Peter ae47b2f794 Fix build warnings
- Fixed unused variable warnings (ring_h, cwd, command)
- Fixed unused field warning (_server)
- Handled unused AppEvent variants properly
- Added #[allow(dead_code)] for utility modules that may be used later
- All warnings resolved while maintaining functionality
2025-08-14 09:04:56 +10:00
James Peter 9bafe869f2 Merge branch 'main' of https://github.com/just-every/coder into main 2025-08-14 08:56:55 +10:00
aibrahim-oaiandGitHub cbf972007a use modifier dim instead of gray and .dim (#2273)
gray color doesn't work very well with white terminals. `.dim` doesn't
have an effect for some reason.

after:
<img width="1080" height="149" alt="image"
src="https://github.com/user-attachments/assets/26c0f8bb-550d-4d71-bd06-11b3189bc1d7"
/>

Before
<img width="1077" height="186" alt="image"
src="https://github.com/user-attachments/assets/b1fba0c7-bc4d-4da1-9754-6c0a105e8cd1"
/>
2025-08-13 22:50:50 +00:00
pakrym-oaiandGitHub 41eb59a07d Wait for requested delay in rate limit errors (#2266)
Fixes: https://github.com/openai/codex/issues/2131

Response doesn't have the delay in a separate field (yet) so parse the
message.
2025-08-13 15:43:54 -07:00
James Peter ab2b794d2e Merge upstream changes from openai/codex
Successfully merged all upstream changes while preserving our custom functionality:
- Kept our browser integration and screenshot features
- Preserved agent tracking and multi-agent support
- Maintained our live ring widget and custom UI components
- Integrated upstream's streaming improvements and new conversation manager
- Combined both versions' protocol updates and event handling

All conflicts resolved with preference for our functionality where there were genuine differences.
2025-08-14 08:16:36 +10:00
Michael BolinandGitHub 37fc4185ef fix: update OutgoingMessageSender::send_response() to take Serialize (#2263)
This makes `send_response()` easier to work with.
2025-08-13 14:29:13 -07:00
aibrahim-oaiandGitHub d4533a0bb3 TUI: change the diff preview to have color fg not bg (#2270)
<img width="328" height="95" alt="image"
src="https://github.com/user-attachments/assets/70e1e6c2-a88f-4058-8763-85c3a02eedb4"
/>
2025-08-13 14:21:24 -07:00
GitHub Action 4d34c10ace chore(release): 0.1.9 [skip ci] 2025-08-13 21:12:39 +00:00
James PeterandClaude 34f7a50648 fix: remove unused append_assistant_text method
Removes the unused append_assistant_text method from ConversationHistory
to eliminate the dead_code warning during compilation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-14 06:53:33 +10:00
James PeterandClaude 92793b3ca9 feat: add debug logging system and improve TUI conversation history
- Add comprehensive debug logging for request/response tracking with unique IDs
- Implement SSE event logging for better streaming response debugging
- Add deduplication logic for function calls in conversation history
- Introduce CustomToolCall events for browser and agent operations
- Enhance TUI with tool call display in history cells
- Add item_id tracking for correlating deltas with output items
- Improve conversation history management with assistant text tracking

This improves debugging capabilities and provides better visibility into
the streaming response flow and tool execution in the TUI.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-14 06:53:33 +10:00
DylanandGitHub 99a242ef41 [codex-cli] Add ripgrep as a dependency for node environment (#2237)
## Summary
Ripgrep is our preferred tool for file search. When users install via
`brew install codex`, it's automatically installed as a dependency. We
want to ensure that users running via an npm install also have this
tool! Microsoft has already solved this problem for VS Code - let's not
reinvent the wheel.

This approach of appending to the PATH directly might be a bit
heavy-handed, but feels reasonably robust to a variety of environment
concerns. Open to thoughts on better approaches here!

## Testing
- [x] confirmed this import approach works with `node -e "const { rgPath
} = require('@vscode/ripgrep'); require('child_process').spawn(rgPath,
['--version'], { stdio: 'inherit' })"`
- [x] Ran codex.js locally with `rg` uninstalled, asked it to run `which
rg`. Output below:

```
⚡ Ran command which rg; echo $?
  ⎿ /Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg
    0

codex
Re-running to confirm the path and exit code.

- Path: `/Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg`
- Exit code: `0`
```
2025-08-13 13:49:27 -07:00
Michael BolinandGitHub 08ed618f72 chore: introduce ConversationManager as a clearinghouse for all conversations (#2240)
This PR does two things because after I got deep into the first one I
started pulling on the thread to the second:

- Makes `ConversationManager` the place where all in-memory
conversations are created and stored. Previously, `MessageProcessor` in
the `codex-mcp-server` crate was doing this via its `session_map`, but
this is something that should be done in `codex-core`.
- It unwinds the `ctrl_c: tokio::sync::Notify` that was threaded
throughout our code. I think this made sense at one time, but now that
we handle Ctrl-C within the TUI and have a proper `Op::Interrupt` event,
I don't think this was quite right, so I removed it. For `codex exec`
and `codex proto`, we now use `tokio::signal::ctrl_c()` directly, but we
no longer make `Notify` a field of `Codex` or `CodexConversation`.

Changes of note:

- Adds the files `conversation_manager.rs` and `codex_conversation.rs`
to `codex-core`.
- `Codex` and `CodexSpawnOk` are no longer exported from `codex-core`:
other crates must use `CodexConversation` instead (which is created via
`ConversationManager`).
- `core/src/codex_wrapper.rs` has been deleted in favor of
`ConversationManager`.
- `ConversationManager::new_conversation()` returns `NewConversation`,
which is in line with the `new_conversation` tool we want to add to the
MCP server. Note `NewConversation` includes `SessionConfiguredEvent`, so
we eliminate checks in cases like `codex-rs/core/tests/client.rs` to
verify `SessionConfiguredEvent` is the first event because that is now
internal to `ConversationManager`.
- Quite a bit of code was deleted from
`codex-rs/mcp-server/src/message_processor.rs` since it no longer has to
manage multiple conversations itself: it goes through
`ConversationManager` instead.
- `core/tests/live_agent.rs` has been deleted because I had to update a
bunch of tests and all the tests in here were ignored, and I don't think
anyone ever ran them, so this was just technical debt, at this point.
- Removed `notify_on_sigint()` from `util.rs` (and in a follow-up, I
hope to refactor the blandly-named `util.rs` into more descriptive
files).
- In general, I started replacing local variables named `codex` as
`conversation`, where appropriate, though admittedly I didn't do it
through all the integration tests because that would have added a lot of
noise to this PR.




---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2240).
* #2264
* #2263
* __->__ #2240
2025-08-13 13:38:18 -07:00
aeandGitHub 30ee24521b fix: remove behavioral prompting from update_plan tool def (#2261)
- Moved some of the content to the main prompt.
2025-08-13 19:05:13 +00:00
easong-openaiandGitHub cb312dfdb4 Update header from Working once batched commands are done (#2249)
Update commands from Working to Complete or Failed after they're done

before:
<img width="725" height="332" alt="image"
src="https://github.com/user-attachments/assets/fb93d21f-5c4a-42bc-a154-14f4fe99d5f9"
/>

after:
<img width="464" height="65" alt="image"
src="https://github.com/user-attachments/assets/15ec7c3b-355f-473e-9a8e-eab359ec5f0d"
/>
2025-08-13 11:10:48 -07:00
amjithandGitHub 0159bc7bdb feat(tui): add ctrl-b and ctrl-f shortcuts (#2260)
## Summary
- support Ctrl-b and Ctrl-f to move the cursor left and right in the
chat composer text area
- test Ctrl-b/Ctrl-f cursor movements

## Testing
- `just fmt`
- `just fix` *(fails: `let` expressions in this position are unstable)*
- `cargo test --all-features` *(fails: `let` expressions in this
position are unstable)*

------
https://chatgpt.com/codex/tasks/task_i_689cbd1d7968832e876fff169891e486
2025-08-13 10:37:39 -07:00
pakrym-oaiandGitHub e6dc5a6df5 fix: display canonical command name in help (#2246)
## Summary
- ensure CLI help uses `codex` as program name regardless of binary
filename

## Testing
- `just fmt`
- `just fix` *(fails: `let` expressions in this position are unstable)*
- `cargo test --all-features` *(fails: `let` expressions in this
position are unstable)*

------
https://chatgpt.com/codex/tasks/task_i_689bd5a731188320814dcbbc546ce22a
2025-08-13 09:39:11 -07:00
GitHub Action dc73e51158 chore(release): 0.1.8 [skip ci] 2025-08-13 11:39:54 +00:00
James PeterandClaude 6e87ac3fdf fix: resolve compilation errors in codex.rs
- Change if let Some() to if let Ok() for capture_browser_screenshot calls
- Remove orphaned else block after match statement at line 3300
- Fix type mismatches expecting Result instead of Option

These changes fix the build errors that were causing the GitHub Actions
release workflow to fail.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:23:24 +10:00
James PeterandClaude 7099f78209 feat: improve JavaScript execution harness in browser
- Replace basic harness with comprehensive error handling and normalization
- Add proper console capture for log, warn, error, and debug
- Implement smart value normalization for complex objects and DOM elements
- Add metadata tracking (URL changes, execution time)
- Include sourceURL for better debugging
- Capture window errors and unhandled promise rejections
- Use eval() within AsyncFunction for proper scope handling

This improved harness provides much better debugging capabilities and
handles edge cases like circular references, DOM elements, and BigInt values.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James PeterandClaude 929fab8d63 feat: add debug logging system and improve TUI conversation history
- Add comprehensive debug logging system with file output
- Implement ScrollView component for better scrolling behavior
- Enhance conversation history with proper text wrapping
- Add browser debugging capabilities
- Improve ephemeral context handling
- Fix message duplication issues
- Add test scripts for debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James PeterandClaude 58fd385efe fix: prevent assistant message duplication
- Improved duplicate detection in AgentMessage event handler
- Check against both last_assistant_message and answer_buffer to prevent duplicates
- Added safeguard in add_to_history to skip duplicate StyledText cells
- Properly cache messages after finalization to prevent re-processing
- Fixes issue where assistant messages were being sent to LLM twice

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James PeterandClaude db0705cf9d fix: resolve all compilation warnings
- Add #[allow(dead_code)] for intentionally unused fields and functions
- Fix unused method warning in chatwidget.rs
- Clean build with no warnings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James PeterandClaude 98b26df421 fix: improve height calculation for wrapped text in history cells
- Use Paragraph line_count for StyledText to properly calculate wrapped height
- Ensures proper vertical spacing for content that wraps across lines
- Fixes display layout issues with long text content

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James PeterandClaude dc31517bc6 fix: add proper text wrapping to conversation history
- Added .wrap(Wrap { trim: false }) to BackgroundEvent, StyledText, and DimmedReasoning cells
- Now content flows naturally during streaming but wraps properly in history
- Text uses full terminal width and wraps at word boundaries
- Fixes issue where long lines would extend beyond terminal width

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
James Peter 5f4dcef224 fix: remove artificial text wrapping at 80 chars during streaming
- Completely removed DEFAULT_WRAP_COLS constant
- RowBuilder now uses usize::MAX to disable wrapping during streaming
- Text flows naturally and is only wrapped when displayed based on terminal width
- Fixed issue where AI responses were being hard-wrapped at 80 characters
- Fixed styling of thinking content during streaming (uses StyledText)
- Prevented duplicate content in reasoning sections
2025-08-13 21:08:18 +10:00
James PeterandClaude 1946916040 fix: correct /chrome command parsing in handle_browser_command
The function was expecting '/browser' to be in the command text and
looking at parts[1], but /chrome passes just 'chrome' or 'chrome [port]',
so we need to look at parts[0] instead.

- Changed index from parts[1] to parts[0] for first argument
- Fixed port parsing to use parts[1] instead of parts[2]
- Updated condition from parts.len() > 1 to \!parts.is_empty()

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
2025-08-13 21:08:18 +10:00
easong-openaiandGitHub c991c6ef85 Fix frontend test (#2247)
UI fixtures are brittle! Who knew.
2025-08-13 01:12:31 +00:00
easong-openaiandGitHub 6340acd885 Re-add markdown streaming (#2029)
Wait for newlines, then render markdown on a line by line basis. Word wrap it for the current terminal size and then spit it out line by line into the UI. Also adds tests and fixes some UI regressions.
2025-08-12 17:37:28 -07:00
pakrym-oaiandGitHub 97a27ffc77 Fix build break and build release (#2242)
Build release profile for one configuration.
2025-08-12 15:56:45 -07:00
pakrym-oaiandGitHub 12cf0dd868 Better implementation of interrupt on Esc (#2111)
Use existing abstractions
2025-08-12 15:43:07 -07:00