Commit Graph

468 Commits

Author SHA1 Message Date
Rai (Michael Pokorny)
09d975e93b add check_task_frontmatter.py and document frontmatter lint in task-template 2025-06-24 14:28:42 -07:00
Rai (Michael Pokorny)
b0f14f1f55 task-template: document valid status enum in frontmatter 2025-06-24 14:24:58 -07:00
Rai (Michael Pokorny)
2f0109faeb tasks: use dash-based branch names to avoid agentydragon ref conflict 2025-06-24 14:06:20 -07:00
Rai (Michael Pokorny)
a86790c553 docs: update Worktree helper usage to include --tmux and multi-ID support 2025-06-24 14:04:02 -07:00
Rai (Michael Pokorny)
cb0051f274 tasks: use tmux windows (tabs) instead of splits for multi-task mode 2025-06-24 14:00:07 -07:00
Rai (Michael Pokorny)
58975e5db1 create-task-worktree.sh: update usage to accept slug or two-digit ID for multiple tasks 2025-06-24 13:55:19 -07:00
Rai (Michael Pokorny)
ad5e28d96a create-task-worktree.sh: allow multiple task IDs when --tmux, correct usage check 2025-06-24 13:52:40 -07:00
Rai (Michael Pokorny)
83ce407baf agentydragon: add Project Manager prompt and launch-project-manager.sh 2025-06-24 13:51:45 -07:00
Rai (Michael Pokorny)
c370c0cca6 tasks: add review-unmerged-task-branches.sh wrapper to launch Codex agent 2025-06-24 13:49:10 -07:00
Rai (Michael Pokorny)
aa0a4bfba4 update create-task-worktree.sh: add --tmux mode and numeric two-digit ID support 2025-06-24 13:48:27 -07:00
Rai (Michael Pokorny)
12dced2d53 tasks: allow numeric ID only resolving to full slug 2025-06-24 13:41:53 -07:00
Rai (Michael Pokorny)
3fe8b3c5a9 agentydragon(tasks): add Task 16 to require double Ctrl+C for exit confirmation 2025-06-24 13:40:08 -07:00
Rai (Michael Pokorny)
84a4e64bf1 tasks: branch new worktrees off agentydragon instead of master 2025-06-24 13:39:21 -07:00
Rai (Michael Pokorny)
5c62d7d42c agentydragon(tasks): add Task 15 for embedded Neovim prompt editor 2025-06-24 13:38:32 -07:00
Rai (Michael Pokorny)
1df8e3c308 tasks(15): adjust scope to script scaffolding and whitelist tmpdir 2025-06-24 13:36:34 -07:00
Rai (Michael Pokorny)
2e3e115128 agentydragon(tasks): consolidate external script predicates as Python predicates (never expire) 2025-06-24 13:28:28 -07:00
Rai (Michael Pokorny)
3762c71818 agentydragon(tasks): update auto-approve predicates to 3-state vote semantics (deny/allow/no-opinion) 2025-06-24 13:27:03 -07:00
Rai (Michael Pokorny)
4eedb33a1f tasks: add --agent mode to create-task-worktree.sh to spawn codex agent in task workspace 2025-06-24 13:24:10 -07:00
Rai (Michael Pokorny)
a527582e32 codex-rs: enable config tests, expose find_codex_home, add auto‑mount repo sandbox logic 2025-06-24 13:21:01 -07:00
Rai (Michael Pokorny)
1c2722335d agentydragon(tasks): add TUI status‑bar indicators to Task 10 for network/mounts/permissions 2025-06-24 13:17:51 -07:00
Rai (Michael Pokorny)
62dda0b041 cli(config): implement 'codex config' subcommand and document it 2025-06-24 13:14:51 -07:00
Rai (Michael Pokorny)
771017c5be agents: point to agentydragon/README.md and define add-task conventions 2025-06-24 13:06:26 -07:00
Rai (Michael Pokorny)
872e89f8e8 gitignore: ignore oaipkg/ artifacts 2025-06-24 13:04:06 -07:00
Rai (Michael Pokorny)
a36ab4797c docs(agentydragon): add worktree helper script and branch convention to README 2025-06-24 12:58:46 -07:00
Rai (Michael Pokorny)
481a76458f docs: centralize task list removal and update AGENTS.md guidance 2025-06-24 12:56:42 -07:00
Rai (Michael Pokorny)
db8e6f3255 docs(agentydragon): add Task 13 for interactive input during execution 2025-06-24 12:55:29 -07:00
Rai (Michael Pokorny)
489d2db021 docs(agentydragon): add Task 12 for runtime internet toggle 2025-06-24 12:52:57 -07:00
Rai (Michael Pokorny)
52c7328242 docs(agentydragon): add Task 11 for custom approval predicates 2025-06-24 12:50:43 -07:00
Rai (Michael Pokorny)
a6050c920b docs: add Cargo installation instructions for codex-rs 2025-06-24 12:35:44 -07:00
Rai (Michael Pokorny)
8d13b6a652 docs: instruct agents to update agentydragon/README.md instead of AGENTS.md 2025-06-24 12:32:35 -07:00
Rai (Michael Pokorny)
f84ed7d584 docs: instruct agents to update AGENTS.md with their work summaries 2025-06-24 12:31:38 -07:00
Rai (Michael Pokorny)
32c9c0d23b docs(agentydragon): add README summarizing changes on agentydragon branch 2025-06-24 12:29:42 -07:00
Rai (Michael Pokorny)
f2e27c46d6 wip 2025-06-21 06:40:33 -07:00
Rai (Michael Pokorny)
719eb2a0f0 wip 2025-06-21 06:39:27 -07:00
Rai (Michael Pokorny)
65e5d926ab tui session load 2025-06-21 06:38:29 -07:00
Rai (Michael Pokorny)
bb19ef1434 botom pane height, restore cmd 2025-06-21 03:49:22 -07:00
Rai (Michael Pokorny)
c37d82e3d5 tasks 2025-06-21 03:47:32 -07:00
Rai (Michael Pokorny)
e585e6c8cd docs: clarify 'exact command' wording in approval prompts and config 2025-06-21 03:01:47 -07:00
Michael Bolin
b73426c1c4 docs: update codex-rs/README.md to list new features in the Rust CLI (#1267)
Let users know about what the Rust CLI supports that the TypeScript CLI
doesn't!
2025-06-06 18:32:10 -07:00
Reilly Wood
345a38502d codex-rs: Rename /clear to /new, make it start an entirely new chat (#1264)
I noticed that `/clear` wasn't fully clearing chat history; it would
clear the chat history widgets _in the UI_, but the LLM still had access
to information from previous messages.

This PR renames `/clear` to `/new` for clarity as per Michael's
suggestion, resetting `app_state` to a fresh `ChatWidget`.
2025-06-06 16:29:37 -07:00
Michael Bolin
029f39b9da feat: port maybeRedeemCredits() from get-api-key.tsx to login_with_chatgpt.py (#1221)
This builds on https://github.com/openai/codex/pull/1212 and ports the
`maybeRedeemCredits()` function from `get-api-key.ts` to
`login_with_chatgpt.py`:


a80240cfdc/codex-cli/src/utils/get-api-key.tsx (L84-L89)
codex-rs-5fc3c3023d9f179fb416b2722d1434bac278e916-1-rust-v0.0.2506060849
2025-06-05 23:34:10 -07:00
Michael Bolin
a80240cfdc chore: ensure next Node.js release includes musl binaries for arm64 Linux (#1232)
Target a workflow with more recent binary artifacts.
2025-06-05 23:14:10 -07:00
Michael Bolin
2d5246050a fix: use aarch64-unknown-linux-musl instead of aarch64-unknown-linux-gnu (#1228)
Now that we have published a GitHub Release that contains arm64 musl
artifacts for Linux, update the following scripts to take advantage of
them:

- `dotslash-config.json` now uses musl artifacts for the `linux-aarch64`
target
- `install_native_deps.sh` for the TypeScript CLI now includes
`codex-linux-sandbox-aarch64-unknown-linux-musl` instead of
`codex-linux-sandbox-aarch64-unknown-linux-gnu` for sandboxing
- `codex-cli/bin/codex.js` now checks for `aarch64-unknown-linux-musl`
artifacts instead of `aarch64-unknown-linux-gnu` ones
codex-rs-ac6e1b2661320a631d80aa51bdfa8f1635e0c8fa-1-rust-v0.0.2506052246
2025-06-05 22:45:45 -07:00
Michael Bolin
77b017f67d fix: truncate auth.json file before rewriting it (#1231)
This was missed in https://github.com/openai/codex/pull/1212. Caught by
@rizwankce in
https://github.com/openai/codex/discussions/1174#discussioncomment-13377475.
codex-rs-121686615fd634e35f3e415896f36908cf8632f9-1-rust-v0.0.2506052203
2025-06-05 22:11:02 -07:00
Michael Bolin
c02d25fbad fix: include codex-linux-sandbox-aarch64-unknown-linux-musl in the set of release artifacts (#1230)
This was missed in https://github.com/openai/codex/pull/1225. Once we
create a new GitHub Release with this change, we can use the URL from
the workflow that triggered the release in
https://github.com/openai/codex/pull/1228.
2025-06-05 22:03:07 -07:00
Michael Bolin
9db53b33aa fix: support arm64 build for Linux (#1225)
Users were running into issues with glibc mismatches on arm64 linux. In
the past, we did not provide a musl build for arm64 Linux because we had
trouble getting the openssl dependency to build correctly. Though today
I just tried the same trick in `Cargo.toml` that we were doing for
`x86_64-unknown-linux-musl` (using `openssl-sys` with `features =
["vendored"]`), so I'm not sure what problem we had in the past the
builds "just worked" today!

Though one tweak that did have to be made is that the integration tests
for Seccomp/Landlock empirically require longer timeouts on arm64 linux,
or at least on the `ubuntu-24.04-arm` GitHub Runner. As such, we change
the timeouts for arm64 in `codex-rs/linux-sandbox/tests/landlock.rs`.

Though in solving this problem, I decided I needed a turnkey solution
for testing the Linux build(s) from my Mac laptop, so this PR introduces
`.devcontainer/Dockerfile` and `.devcontainer/devcontainer.json` to
facilitate this. Detailed instructions are in `.devcontainer/README.md`.

We will update `dotslash-config.json` and other release-related scripts
in a follow-up PR.
codex-rs-84eae7b1bc4e3b5420f2d6127b7c17e7a979a5b0-1-rust-v0.0.2506052135
2025-06-05 20:29:46 -07:00
Michael Bolin
515b6331bd feat: add support for login with ChatGPT (#1212)
This does not implement the full Login with ChatGPT experience, but it
should unblock people.

**What works**

* The `codex` multitool now has a `login` subcommand, so you can run
`codex login`, which should write `CODEX_HOME/auth.json` if you complete
the flow successfully. The TUI will now read the `OPENAI_API_KEY` from
`auth.json`.
* The TUI should refresh the token if it has expired and the necessary
information is in `auth.json`.
* There is a `LoginScreen` in the TUI that tells you to run `codex
login` if both (1) your model provider expects to use `OPENAI_API_KEY`
as its env var, and (2) `OPENAI_API_KEY` is not set.

**What does not work**

* The `LoginScreen` does not support the login flow from within the TUI.
Instead, it tells you to quit, run `codex login`, and then run `codex`
again.
* `codex exec` does read from `auth.json` yet, nor does it direct the
user to go through the login flow if `OPENAI_API_KEY` is not be found.
* The `maybeRedeemCredits()` function from `get-api-key.tsx` has not
been ported from TypeScript to `login_with_chatgpt.py` yet:


a67a67f325/codex-cli/src/utils/get-api-key.tsx (L84-L89)

**Implementation**

Currently, the OAuth flow requires running a local webserver on
`127.0.0.1:1455`. It seemed wasteful to incur the additional binary cost
of a webserver dependency in the Rust CLI just to support login, so
instead we implement this logic in Python, as Python has a `http.server`
module as part of its standard library. Specifically, we bundle the
contents of a single Python file as a string in the Rust CLI and then
use it to spawn a subprocess as `python3 -c
{{SOURCE_FOR_PYTHON_SERVER}}`.

As such, the most significant files in this PR are:

```
codex-rs/login/src/login_with_chatgpt.py
codex-rs/login/src/lib.rs
```

Now that the CLI may load `OPENAI_API_KEY` from the environment _or_
`CODEX_HOME/auth.json`, we need a new abstraction for reading/writing
this variable, so we introduce:

```
codex-rs/core/src/openai_api_key.rs
```

Note that `std::env::set_var()` is [rightfully] `unsafe` in Rust 2024,
so we use a LazyLock<RwLock<Option<String>>> to store `OPENAI_API_KEY`
so it is read in a thread-safe manner.

Ultimately, it should be possible to go through the entire login flow
from the TUI. This PR introduces a placeholder `LoginScreen` UI for that
right now, though the new `codex login` subcommand introduced in this PR
should be a viable workaround until the UI is ready.

**Testing**

Because the login flow is currently implemented in a standalone Python
file, you can test it without building any Rust code as follows:

```
rm -rf /tmp/codex_home && mkdir /tmp/codex_home
CODEX_HOME=/tmp/codex_home python3 codex-rs/login/src/login_with_chatgpt.py
```

For reference:

* the original TypeScript implementation was introduced in
https://github.com/openai/codex/pull/963
* support for redeeming credits was later added in
https://github.com/openai/codex/pull/974
2025-06-04 08:44:17 -07:00
Reilly Wood
a67a67f325 codex-rs: make tool calls prettier (#1211)
This PR overhauls how active tool calls and completed tool calls are
displayed:

1. More use of colour to indicate success/failure and distinguish
between components like tool name+arguments
2. Previously, the entire `CallToolResult` was serialized to JSON and
pretty-printed. Now, we extract each individual `CallToolResultContent`
and print those
1. The previous solution was wasting space by unnecessarily showing
details of the `CallToolResult` struct to users, without formatting the
actual tool call results nicely
2. We're now able to show users more information from tool results in
less space, with nicer formatting when tools return JSON results

### Before:

<img width="1251" alt="Screenshot 2025-06-03 at 11 24 26"
src="https://github.com/user-attachments/assets/5a58f222-219c-4c53-ace7-d887194e30cf"
/>

### After:

<img width="1265" alt="image"
src="https://github.com/user-attachments/assets/99fe54d0-9ebe-406a-855b-7aa529b91274"
/>

## Future Work

1. Integrate image tool result handling better. We should be able to
display images even if they're not the first `CallToolResultContent`
2. Users should have some way to view the full version of truncated tool
results
3. It would be nice to add some left padding for tool results, make it
more clear that they are results. This is doable, just a little fiddly
due to the way `first_visible_line` scrolling works
4. There's almost certainly a better way to format JSON than "all on 1
line with spaces to make Ratatui wrapping work". But I think that works
OK for now.
2025-06-03 14:29:26 -07:00
Michael Bolin
c6fcec55fe fix: always send full instructions when using the Responses API (#1207)
This fixes a longstanding error in the Rust CLI where `codex.rs`
contained an errant `is_first_turn` check that would exclude the user
instructions for subsequent "turns" of a conversation when using the
responses API (i.e., when `previous_response_id` existed).

While here, renames `Prompt.instructions` to `Prompt.user_instructions`
since we now have quite a few levels of instructions floating around.
Also removed an unnecessary use of `clone()` in
`Prompt.get_full_instructions()`.
codex-rs-45519e12f39777b65c05ed498503ddcb60beb289-1-rust-v0.0.2506030956
2025-06-03 09:40:19 -07:00
Michael Bolin
6fcc528a43 fix: provide tolerance for apply_patch tool (#993)
As explained in detail in the doc comment for `ParseMode::Lenient`, we
have observed that GPT-4.1 does not always generate a valid invocation
of `apply_patch`. Fortunately, the error is predictable, so we introduce
some new logic to the `codex-apply-patch` crate to recover from this
error.

Because we would like to avoid this becoming a de facto standard (as it
would be incompatible if `apply_patch` were provided as an actual
executable, unless we also introduced the lenient behavior in the
executable, as well), we require passing `ParseMode::Lenient` to
`parse_patch_text()` to make it clear that the caller is opting into
supporting this special case.

Note the analogous change to the TypeScript CLI was
https://github.com/openai/codex/pull/930. In addition to changing the
accepted input to `apply_patch`, it also introduced additional
instructions for the model, which we include in this PR.

Note that `apply-patch` does not depend on either `regex` or
`regex-lite`, so some of the checks are slightly more verbose to avoid
introducing this dependency.

That said, this PR does not leverage the existing
`extract_heredoc_body_from_apply_patch_command()`, which depends on
`tree-sitter` and `tree-sitter-bash`:


5a5aa89914/codex-rs/apply-patch/src/lib.rs (L191-L246)

though perhaps it should.
2025-06-03 09:06:38 -07:00