Commit Graph

1438 Commits

Author SHA1 Message Date
Michael Bolin
e26bdaf006 merge commit for archive created by Sapling 2025-04-30 16:23:41 -07:00
Michael Bolin
07a6659814 feat: use Landlock for sandboxing on Linux 2025-04-30 16:23:35 -07:00
moppywhip
bc4e6db749 feat: @mention files in codex (#701)
Solves #700

## State of the World Before

Prior to this PR, when users wanted to share file contents with Codex,
they had two options:
- Manually copy and paste file contents into the chat
- Wait for the assistant to use the shell tool to view the file

The second approach required the assistant to:
1. Recognize the need to view a file
2. Execute a shell tool call
3. Wait for the tool call to complete
4. Process the file contents

This consumed extra tokens and reduced user control over which files
were shared with the model.

## State of the World After

With this PR, users can now:
- Reference files directly in their chat input using the `@path` syntax
- Have file contents automatically expanded into XML blocks before being
sent to the LLM

For example, users can type `@src/utils/config.js` in their message, and
the file contents will be included in context. Within the terminal chat
history, these file blocks will be collapsed back to `@path` format in
the UI for clean presentation.

Tag File suggestions:
<img width="857" alt="file-suggestions"
src="https://github.com/user-attachments/assets/397669dc-ad83-492d-b5f0-164fab2ff4ba"
/>

Tagging files in action:
<img width="858" alt="tagging-files"
src="https://github.com/user-attachments/assets/0de9d559-7b7f-4916-aeff-87ae9b16550a"
/>

Demo video of file tagging:
[![Demo video of file
tagging](https://img.youtube.com/vi/vL4LqtBnqt8/0.jpg)](https://www.youtube.com/watch?v=vL4LqtBnqt8)

## Implementation Details

This PR consists of 2 main components:

1. **File Tag Utilities**:
- New `file-tag-utils.ts` utility module that handles both expansion and
collapsing of file tags
- `expandFileTags()` identifies `@path` tokens and replaces them with
XML blocks containing file contents
- `collapseXmlBlocks()` reverses the process, converting XML blocks back
to `@path` format for UI display
- Tokens are only expanded if they point to valid files (directories are
ignored)
   - Expansion happens just before sending input to the model

2. **Terminal Chat Integration**:
- Leveraged the existing file system completion system for tabbing to
support the `@path` syntax
   - Added `updateFsSuggestions` helper to manage filesystem suggestions
- Added `replaceFileSystemSuggestion` to replace input with filesystem
suggestions
- Applied `collapseXmlBlocks` in the chat response rendering so that
tagged files are shown as simple `@path` tags

The PR also includes test coverage for both the UI and the file tag
utilities.

## Next Steps

Some ideas I'd like to implement if this feature gets merged:

- Line selection: `@path[50:80]` to grab specific sections of files
- Method selection: `@path#methodName` to grab just one function/class
- Visual improvements: highlight file tags in the UI to make them more
noticeable
2025-04-30 16:19:55 -07:00
Kevin Alwell
bd82101859 fix: insufficient quota message (#758)
This pull request includes a change to improve the error message
displayed when there is insufficient quota in the `AgentLoop` class. The
updated message provides more detailed information and a link for
managing or purchasing credits.

Error message improvement:

*
[`codex-cli/src/utils/agent/agent-loop.ts`](diffhunk://#diff-b15957eac2720c3f1f55aa32f172cdd0ac6969caf4e7be87983df747a9f97083L1140-R1140):
Updated the error message in the `AgentLoop` class to include the
specific error message (if available) and a link to manage or purchase
credits.


Fixes #751
2025-04-30 16:00:50 -07:00
Michael Bolin
c45d43fefc merge commit for archive created by Sapling 2025-04-30 14:58:58 -07:00
Michael Bolin
4ea2219e90 chore: make build process a single script to run 2025-04-30 14:58:50 -07:00
Michael Bolin
24bad86ae6 feat: use Landlock for sandboxing on Linux 2025-04-30 14:58:50 -07:00
Michael Bolin
1074abb2bf merge commit for archive created by Sapling 2025-04-30 14:57:16 -07:00
Michael Bolin
2812bde15a feat: use Landlock for sandboxing on Linux 2025-04-30 14:57:09 -07:00
Michael Bolin
1ac157950f merge commit for archive created by Sapling 2025-04-30 14:31:06 -07:00
Michael Bolin
0e53e1bd54 chore: make build process a single script to run 2025-04-30 14:30:56 -07:00
Michael Bolin
9ae9a682fa feat: use Landlock for sandboxing on Linux 2025-04-30 14:30:56 -07:00
Michael Bolin
4a7aee7713 merge commit for archive created by Sapling 2025-04-30 14:24:37 -07:00
Michael Bolin
364b53900f feat: use Landlock for sandboxing on Linux 2025-04-30 14:24:27 -07:00
Michael Bolin
dd1f839f52 chore: make build process a single script to run 2025-04-30 14:08:38 -07:00
Michael Bolin
033d379eca fix: remove unused _writableRoots arg to exec() function (#762)
I suspect this was done originally so that `execForSandbox()` had a
consistent signature for both the `SandboxType.NONE` and
`SandboxType.MACOS_SEATBELT` cases, but that is not really necessary and
turns out to make the upcoming Landlock support a bit more complicated
to implement, so I had Codex remove it and clean up the call sites.
2025-04-30 14:08:27 -07:00
Michael Bolin
6923cd5065 Merge 8312121a1f into sapling-pr-archive-bolinfest 2025-04-30 14:05:12 -07:00
Michael Bolin
8312121a1f fix: remove unused _writableRoots arg to exec() function 2025-04-30 14:04:59 -07:00
Michael Bolin
e6fe8d6fa1 chore: mark Rust releases as "prerelease" (#761)
Apparently the URLs for draft releases cannot be downloaded using
unauthenticated `curl`, which means the DotSlash file only works for
users who are authenticated with `gh`. According to chat, prereleases
_can_ be fetched with unauthenticated `curl`, so let's try that.
codex-rs-e40bc9911433bd3f942ef4604626fab5638a7a72-1-rust-v0.0.2504301327
2025-04-30 13:25:53 -07:00
Michael Bolin
3de041fe2a Merge f361844ce5 into sapling-pr-archive-bolinfest 2025-04-30 13:21:29 -07:00
Michael Bolin
f361844ce5 chore: mark Rust releases as "prerelease" 2025-04-30 13:21:22 -07:00
Michael Bolin
b571249867 chore: script to create a Rust release (#759)
For now, keep things simple such that we never update the `version` in
the `Cargo.toml` for the workspace root on the `main` branch. Instead,
create a new branch for a release, push one commit that updates the
`version`, and then tag that branch to kick off a release.

To test, I ran this script and created this release job:

https://github.com/openai/codex/actions/runs/14762580641
codex-rs-72a4c38e41bc64f5a7c8c73d52f45784cb6b7137-1-rust-v0.0.2504301219
2025-04-30 12:39:03 -07:00
Michael Bolin
02c180f6c3 merge commit for archive created by Sapling 2025-04-30 12:16:11 -07:00
Michael Bolin
4ae8f2ba46 chore: script to create a Rust release 2025-04-30 12:16:04 -07:00
Michael Bolin
cc74a71a69 Merge 8dff8943ee into sapling-pr-archive-bolinfest 2025-04-30 12:10:54 -07:00
Michael Bolin
8dff8943ee chore: script to create a Rust release 2025-04-30 12:10:46 -07:00
Michael Bolin
24278347b7 fix: remove codex-repl from GitHub workflows (#760)
I missed this when doing https://github.com/openai/codex/pull/754.
2025-04-30 12:10:24 -07:00
Michael Bolin
95ef46c6f8 Merge 549341afaf into sapling-pr-archive-bolinfest 2025-04-30 12:09:47 -07:00
Michael Bolin
549341afaf fix: remove codex-repl from GitHub workflows 2025-04-30 12:09:40 -07:00
Michael Bolin
7f18fd3f56 Merge 4e7f007e68 into sapling-pr-archive-bolinfest 2025-04-30 12:08:21 -07:00
Michael Bolin
4e7f007e68 chore: script to create a Rust release 2025-04-30 12:08:11 -07:00
Michael Bolin
8f7a54501c chore: Rust release, set prerelease:false and version=0.0.2504301132 (#755)
The generated DotSlash file has URLs that refer to
`https://github.com/openai/codex/releases/`, so let's set
`prerelease:false` (but keep `draft:true` for now) so those URLs should
work.

Also updated `version` in Cargo workspace so I will kick off a build
once this lands.
rust-v0.0.2504301132
2025-04-30 11:53:03 -07:00
Michael Bolin
30c8095d6f merge commit for archive created by Sapling 2025-04-30 11:50:25 -07:00
Michael Bolin
789ecab603 chore: make build process a single script to run 2025-04-30 11:50:18 -07:00
Michael Bolin
d95603f2de Merge 8eb5e174db into sapling-pr-archive-bolinfest 2025-04-30 11:48:13 -07:00
Michael Bolin
8eb5e174db chore: make build process a single script to run 2025-04-30 11:48:03 -07:00
Michael Bolin
eb9d8b3514 Merge 5f5871714e into sapling-pr-archive-bolinfest 2025-04-30 11:37:35 -07:00
Michael Bolin
5f5871714e chore: Rust release, set prerelease:false and version=0.0.2504301132 2025-04-30 11:37:27 -07:00
Michael Bolin
2f1d96e77d fix: remove errant eslint-disable so pnpm run lint passes again (#756)
My bad: introduced in https://github.com/openai/codex/pull/753.
2025-04-30 11:37:11 -07:00
Michael Bolin
51e669f01e Merge b6f4935f0c into sapling-pr-archive-bolinfest 2025-04-30 11:36:48 -07:00
Michael Bolin
b6f4935f0c fix: remove errant eslint-disable so pnpm run lint passes again 2025-04-30 11:36:41 -07:00
Michael Bolin
09ccbabd82 Merge 4bd790bbac into sapling-pr-archive-bolinfest 2025-04-30 11:33:12 -07:00
Michael Bolin
4bd790bbac chore: Rust release, set prerelease:false and version=0.0.2504301132 2025-04-30 11:33:04 -07:00
Michael Bolin
84aaefa102 fix: read version from package.json instead of modifying session.ts (#753)
I am working to simplify the build process. As a first step, update
`session.ts` so it reads the `version` from `package.json` at runtime so
we no longer have to modify it during the build process. I want to get
to a place where the build looks like:

```
cd codex-cli
pnpm i
pnpm build
RELEASE_DIR=$(mktemp -d)
cp -r bin "$RELEASE_DIR/bin"
cp -r dist "$RELEASE_DIR/dist"
cp -r src "$RELEASE_DIR/src" # important if we want sourcemaps to continue to work
cp ../README.md "$RELEASE_DIR"
VERSION=$(printf '0.1.%d' $(date +%y%m%d%H%M))
jq --arg version "$VERSION" '.version = $version' package.json > "$RELEASE_DIR/package.json"
```

Then the contents of `$RELEASE_DIR` should be good to `npm publish`, no?
2025-04-30 11:03:10 -07:00
Michael Bolin
c432d9ef81 chore: remove the REPL crate/subcommand (#754)
@oai-ragona and I discussed it, and we feel the REPL crate has served
its purpose, so we're going to delete the code and future archaeologists
can find it in Git history.
2025-04-30 10:15:50 -07:00
Michael Bolin
fcb51acb41 Merge 5141716dbb into sapling-pr-archive-bolinfest 2025-04-30 10:07:13 -07:00
Michael Bolin
5141716dbb chore: remove the REPL crate/subcommand 2025-04-30 10:07:06 -07:00
Michael Bolin
4746ee900f fix: remove expected dot after v in rust-v tag name (#742)
I think this extra dot was not intentional, but I'm not sure. Certainly
this comment suggests it should not be there:


85999d7277/.github/workflows/rust-release.yml (L4)
2025-04-30 10:05:47 -07:00
Michael Bolin
0995b604ad Merge f25597b510 into sapling-pr-archive-bolinfest 2025-04-30 09:21:33 -07:00
Michael Bolin
f25597b510 fix: read version from package.json instead of modifying session.ts 2025-04-30 09:21:25 -07:00