Commit Graph
3105 Commits
Author SHA1 Message Date
easong-openai 58bed77ba7 Remove tab focus switching (#1694)
Previously pressing tab would switch TUI focus to the history scrollbox - no longer necessary.
2025-07-27 11:04:09 -07:00
Michael Bolin add023895f merge commit for archive created by Sapling 2025-07-26 19:58:32 -07:00
Michael Bolin 073dc04190 chore: update Codex::spawn() to return a struct instead of a tuple 2025-07-26 19:57:58 -07:00
aibrahim-oai 5a0079fea2 Changing method in MCP notifications (#1684)
- Changing the codex/event type
2025-07-26 10:35:49 -07:00
Jeremy Rose c66c99c5b5 fix: crash on resize (#1683)
Without this, resizing the terminal prints "Error: The cursor position
could not be read within a normal duration" and quits the app.
2025-07-25 14:23:38 -07:00
Jeremy Rose 75b4008094 fix: paste with newlines (#1682)
This fixes an issue where pasting multi-line content would break the
composer.
2025-07-25 19:26:40 +00:00
pakrym-oai 7ee87123a6 Optionally run using user profile (#1678) 2025-07-25 11:45:23 -07:00
Michael Bolin 994c9a874d chore: use one write call per item in rollout_writer() (#1679)
Most of the time, we expect the `String` returned by
`serde_json::to_string()` to have extra capacity, so `push('\n')` is
unlikely to allocate, which seems cheaper than an extra `write(2)` call,
on average?
2025-07-25 10:43:36 -07:00
easong-openai 480e82b00d Easily Selectable History (#1672)
This update replaces the previous ratatui history widget with an
append-only log so that the terminal can handle text selection and
scrolling. It also disables streaming responses, which we'll do our best
to bring back in a later PR. It also adds a small summary of token use
after the TUI exits.
2025-07-25 01:56:40 -07:00
Michael Bolin 0e3e98d492 Merge 90c621058a into sapling-pr-archive-bolinfest 2025-07-24 23:03:14 -07:00
Michael Bolin 90c621058a chore: use one write call per item in rollout_writer() 2025-07-24 23:02:59 -07:00
Michael Bolin 941c1e954d Merge a7638d9b31 into sapling-pr-archive-bolinfest 2025-07-24 14:50:01 -07:00
Michael Bolin a7638d9b31 chore: update Codex::spawn() to return a struct instead of a tuple 2025-07-24 14:49:55 -07:00
Pavel Bezglasny 508abbe990 Update render name in tui for approval_policy to match with config values (#1675)
Currently, codex on start shows the value for the approval policy as
name of
[AskForApproval](https://github.com/openai/codex/blob/2437a8d17a0cf972d1a6e7f303d469b6e2f57eae/codex-rs/core/src/protocol.rs#L128)
enum, which differs from
[approval_policy](https://github.com/openai/codex/blob/2437a8d17a0cf972d1a6e7f303d469b6e2f57eae/codex-rs/config.md#approval_policy)
config values.
E.g. "untrusted" becomes "UnlessTrusted", "on-failure" -> "OnFailure",
"never" -> "Never".
This PR changes render names of the approval policy to match with
configuration values.
2025-07-24 14:17:57 -07:00
Michael Bolin a1641743a8 feat: expand the set of commands that can be safely identified as "trusted" (#1668)
This PR updates `is_known_safe_command()` to account for "safe
operators" to expand the set of commands that can be run without
approval. This concept existed in the TypeScript CLI, and we are
[finally!] porting it to the Rust one:


https://github.com/openai/codex/blob/c9e2def49487585cfe6f8bb7b2be442e8c0b5e1b/codex-cli/src/approvals.ts#L531-L541

The idea is that if we have `EXPR1 SAFE_OP EXPR2` and `EXPR1` and
`EXPR2` are considered safe independently, then `EXPR1 SAFE_OP EXPR2`
should be considered safe. Currently, `SAFE_OP` includes `&&`, `||`,
`;`, and `|`.

In the TypeScript implementation, we relied on
https://www.npmjs.com/package/shell-quote to parse the string of Bash,
as it could provide a "lightweight" parse tree, parsing `'beep || boop >
/byte'` as:

```
[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]
```

Though in this PR, we introduce the use of
https://crates.io/crates/tree-sitter-bash for parsing (which
incidentally we were already using in
[`codex-apply-patch`](https://github.com/openai/codex/blob/c9e2def49487585cfe6f8bb7b2be442e8c0b5e1b/codex-rs/apply-patch/Cargo.toml#L18)),
which gives us a richer parse tree. (Incidentally, if you have never
played with tree-sitter, try the
[playground](https://tree-sitter.github.io/tree-sitter/7-playground.html)
and select **Bash** from the dropdown to see how it parses various
expressions.)

As a concrete example, prior to this change, our implementation of
`is_known_safe_command()` could verify things like:

```
["bash", "-lc", "grep -R \"Cargo.toml\" -n"]
```

but not:

```
["bash", "-lc", "grep -R \"Cargo.toml\" -n || true"]
```

With this change, the version with `|| true` is also accepted.

Admittedly, this PR does not expand the safety check to support
subshells, so it would reject, e.g. `bash -lc 'ls || (pwd && echo hi)'`,
but that can be addressed in a subsequent PR.
2025-07-24 14:13:30 -07:00
Michael Bolin 71278f5c43 Merge 540f01f0ba into sapling-pr-archive-bolinfest 2025-07-24 13:00:21 -07:00
Michael Bolin 540f01f0ba feat: expand the set of commands that can be safely identified as "trusted" 2025-07-24 13:00:13 -07:00
Michael Bolin c9e2def494 fix: add true,false,nl to the list of trusted commands (#1676)
`nl` is a line-numbering tool that should be on the _trusted _ list, as
there is nothing concerning on https://gtfobins.github.io/gtfobins/nl/
that would merit exclusion.

`true` and `false` are also safe, though not particularly useful given
how `is_known_safe_command()` works today, but that will change with
https://github.com/openai/codex/pull/1668.
2025-07-24 12:59:36 -07:00
Michael Bolin 01f0f9bad2 merge commit for archive created by Sapling 2025-07-24 12:54:07 -07:00
Michael Bolin 923f8c6af5 fix: add true,false,nl to the list of trusted commands 2025-07-24 12:53:58 -07:00
Michael Bolin b6603b8741 Merge 18e266ebd0 into sapling-pr-archive-bolinfest 2025-07-24 12:47:43 -07:00
Michael Bolin 18e266ebd0 feat: expand the set of commands that can be safely identified as "trusted" 2025-07-24 12:47:37 -07:00
Michael Bolin b5b42409ee merge commit for archive created by Sapling 2025-07-24 12:36:21 -07:00
Michael Bolin 6866e535a1 feat: expand the set of commands that can be safely identified as "trusted" 2025-07-24 12:36:16 -07:00
Michael Bolin c69ac60315 merge commit for archive created by Sapling 2025-07-24 12:27:31 -07:00
Michael Bolin 90db77c8ab feat: expand the set of commands that can be safely identified as "trusted" 2025-07-24 12:27:23 -07:00
Michael Bolin 7af9cedbd7 fix: create separate test_support crates to eliminate #[allow(dead_code)] (#1667)
Because of a quirk of how implementation tests work in Rust, we had a
number of `#[allow(dead_code)]` annotations that were misleading because
the functions _were_ being used, just not by all integration tests in a
`tests/` folder, so when compiling the test that did not use the
function, clippy would complain that it was unused.

This fixes things by create a "test_support" crate under the `tests/`
folder that is imported as a dev dependency for the respective crate.
2025-07-24 12:19:46 -07:00
vishnu-oai 2437a8d17a Record Git metadata to rollout (#1598)
# Summary

- Writing effective evals for codex sessions requires context of the
overall repository state at the moment the session began
- This change adds this metadata (git repository, branch, commit hash)
to the top of the rollout of the session (if available - if not it
doesn't add anything)
- Currently, this is only effective on a clean working tree, as we can't
track uncommitted/untracked changes with the current metadata set.
Ideally in the future we may want to track unclean changes somehow, or
perhaps prompt the user to stash or commit them.

# Testing
- Added unit tests
- `cargo test && cargo clippy --tests && cargo fmt -- --config
imports_granularity=Item`

### Resulting Rollout
<img width="1243" height="127" alt="Screenshot 2025-07-17 at 1 50 00 PM"
src="https://github.com/user-attachments/assets/68108941-f015-45b2-985c-ea315ce05415"
/>
2025-07-24 11:35:28 -07:00
Michael Bolin e58e4f29ab Merge 6d4de7399d into sapling-pr-archive-bolinfest 2025-07-23 22:57:56 -07:00
Michael Bolin 6d4de7399d feat: expand the set of commands that can be safely identified as "trusted" 2025-07-23 22:57:47 -07:00
Michael Bolin 02488aab94 Merge d77c3ffb3f into sapling-pr-archive-bolinfest 2025-07-23 22:27:36 -07:00
Michael Bolin d77c3ffb3f fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:27:33 -07:00
Michael Bolin bf6756f8be merge commit for archive created by Sapling 2025-07-23 22:27:07 -07:00
Michael Bolin ca2e44260d fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:27:02 -07:00
Michael Bolin 0b2f3ccab1 merge commit for archive created by Sapling 2025-07-23 22:26:52 -07:00
Michael Bolin b70c5e768c fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:26:48 -07:00
Michael Bolin d775f7cda6 merge commit for archive created by Sapling 2025-07-23 22:26:17 -07:00
Michael Bolin 1f569c851d fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:26:12 -07:00
Michael Bolin db9590c85c merge commit for archive created by Sapling 2025-07-23 22:25:58 -07:00
Michael Bolin 953e7d5ded fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:25:52 -07:00
Michael Bolin 35a66ff3e3 merge commit for archive created by Sapling 2025-07-23 22:25:39 -07:00
Michael Bolin 0c76d3a8e8 fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:25:33 -07:00
Michael Bolin a03d1f27e4 merge commit for archive created by Sapling 2025-07-23 22:24:24 -07:00
Michael Bolin 821f9f15f8 fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:24:18 -07:00
Michael Bolin 60766b79d6 Merge 924e86536f into sapling-pr-archive-bolinfest 2025-07-23 22:22:02 -07:00
Michael Bolin 924e86536f fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:21:57 -07:00
Michael Bolin 1d6f55a791 Merge 3f00f1a74a into sapling-pr-archive-bolinfest 2025-07-23 22:11:29 -07:00
Michael Bolin 3f00f1a74a fix: create separate test_support crates to eliminate #[allow(dead_code)] 2025-07-23 22:10:06 -07:00
dependabot[bot] d2be0720b5 chore(deps): bump toml from 0.9.1 to 0.9.2 in /codex-rs (#1562)
Bumps [toml](https://github.com/toml-rs/toml) from 0.9.1 to 0.9.2.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/toml-rs/toml/commit/c28f9ac30f1e7f53e8c2fd27ae04bb1f7c7a394b"><code>c28f9ac</code></a>
chore: Release</li>
<li><a
href="https://github.com/toml-rs/toml/commit/f3a229914863475cf5590a5e964b44f04b852eec"><code>f3a2299</code></a>
docs: Update changelog</li>
<li><a
href="https://github.com/toml-rs/toml/commit/69f09d3093df7cbd523b81a7e8731bc64b5727ed"><code>69f09d3</code></a>
fix(lex): Don't loop over ')' for forever (<a
href="https://redirect.github.com/toml-rs/toml/issues/1003">#1003</a>)</li>
<li><a
href="https://github.com/toml-rs/toml/commit/cc68ae4f426d48eb69be9178c28440585c0c32fc"><code>cc68ae4</code></a>
fix(lex): Don't loop over ')' for forever</li>
<li>See full diff in <a
href="https://github.com/toml-rs/toml/compare/toml-v0.9.1...toml-v0.9.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=toml&package-manager=cargo&previous-version=0.9.1&new-version=0.9.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-23 17:22:05 -07:00
dependabot[bot] 173386eeac chore(deps): bump tree-sitter from 0.25.6 to 0.25.8 in /codex-rs (#1561)
Bumps [tree-sitter](https://github.com/tree-sitter/tree-sitter) from
0.25.6 to 0.25.8.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/f2f197b6b27ce75c280c20f131d4f71e906b86f7"><code>f2f197b</code></a>
0.25.8</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/8bb33f7d8cb6504c892eecd253dfce72fd68ea3c"><code>8bb33f7</code></a>
perf: reorder conditional operands</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/6f944de32f54c4a8df1d2ec060119c28e39114dd"><code>6f944de</code></a>
fix(generate): propagate node types error</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/c15938532d06b5abc4ad8bcbde43597eb95b5c20"><code>c159385</code></a>
0.25.7</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/94b55bfcdc62162d3c39467465bad472de50f842"><code>94b55bf</code></a>
perf: reorder expensive conditional operand</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/bcb30f7951b6ffe325996db3b6f7fd949514528b"><code>bcb30f7</code></a>
fix(generate): use topological sort for subtype map</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/3bd8f7df8eea914a7fcca21c1fa20fda276bc82b"><code>3bd8f7d</code></a>
perf: More efficient computation of used symbols</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/d7529c32650b5f5c2d3c238e3eb17c8a3d750785"><code>d7529c3</code></a>
perf: reserve <code>Vec</code> capacities where appropriate</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/bf4217f0ffca4a965afae9f4198d24d721cc731f"><code>bf4217f</code></a>
fix(web): wasm export paths</li>
<li><a
href="https://github.com/tree-sitter/tree-sitter/commit/bb7b339ae24fb66ea382ff1ca2356ae655db3ab9"><code>bb7b339</code></a>
Fix 'extra' field generation for node-types.json</li>
<li>Additional commits viewable in <a
href="https://github.com/tree-sitter/tree-sitter/compare/v0.25.6...v0.25.8">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tree-sitter&package-manager=cargo&previous-version=0.25.6&new-version=0.25.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-23 16:59:05 -07:00