Commit Graph

2207 Commits

Author SHA1 Message Date
Michael Bolin
8ef8f1e844 Merge 0633a09184 into sapling-pr-archive-bolinfest 2025-07-27 20:05:36 -07:00
Michael Bolin
0633a09184 fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 20:05:19 -07:00
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](2437a8d17a/codex-rs/core/src/protocol.rs (L128))
enum, which differs from
[approval_policy](2437a8d17a/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:


c9e2def494/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`](c9e2def494/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