Commit Graph
10791 Commits
Author SHA1 Message Date
Michael Bolin ff33e9b67f ci: enable the Windows Bazel workflow path 2026-03-27 01:34:33 -07:00
Michael Bolin 8af74ad958 merge commit for archive created by Sapling 2026-03-27 01:25:44 -07:00
Michael Bolin e69fcac8c0 ci: enable the Windows Bazel workflow path 2026-03-27 01:25:38 -07:00
Michael Bolin 22776c69c5 merge commit for archive created by Sapling 2026-03-27 01:23:00 -07:00
Michael Bolin 5cde018c58 ci: enable the Windows Bazel workflow path 2026-03-27 01:22:54 -07:00
Michael Bolin 80057b5ec6 merge commit for archive created by Sapling 2026-03-27 01:17:42 -07:00
Michael Bolin c15f6c6bc3 ci: enable the Windows Bazel workflow path 2026-03-27 01:17:31 -07:00
Michael Bolin 39f2e48d89 Merge 4234212a5f into sapling-pr-archive-bolinfest 2026-03-27 01:08:59 -07:00
Michael Bolin 4234212a5f ci: enable the Windows Bazel workflow path 2026-03-27 01:08:53 -07:00
Michael Bolin 3dc85cfde7 merge commit for archive created by Sapling 2026-03-27 01:01:04 -07:00
Michael Bolin 1ae9d14612 ci: enable the Windows Bazel workflow path 2026-03-27 01:00:47 -07:00
Michael Bolin cbf1ba188d merge commit for archive created by Sapling 2026-03-27 00:57:20 -07:00
Michael Bolin e012e08ed2 ci: refactor Bazel workflow setup 2026-03-27 00:56:58 -07:00
Michael Bolin 0602685529 Merge 29cb89690d into sapling-pr-archive-bolinfest 2026-03-27 00:39:06 -07:00
Michael Bolin 29cb89690d ci: enable the Windows Bazel workflow path 2026-03-27 00:38:49 -07:00
daniel-oai 47a9e2e084 Add ChatGPT device-code login to app server (#15525)
## Problem

App-server clients could only initiate ChatGPT login through the browser
callback flow, even though the shared login crate already supports
device-code auth. That left VS Code, Codex App, and other app-server
clients without a first-class way to use the existing device-code
backend when browser redirects are brittle or when the client UX wants
to own the login ceremony.

## Mental model

This change adds a second ChatGPT login start path to app-server:
clients can now call `account/login/start` with `type:
"chatgptDeviceCode"`. App-server immediately returns a `loginId` plus
the device-code UX payload (`verificationUrl` and `userCode`), then
completes the login asynchronously in the background using the existing
`codex_login` polling flow. Successful device-code login still resolves
to ordinary `chatgpt` auth, and completion continues to flow through the
existing `account/login/completed` and `account/updated` notifications.

## Non-goals

This does not introduce a new auth mode, a new account shape, or a
device-code eligibility discovery API. It also does not add automatic
fallback to browser login in core; clients remain responsible for
choosing when to request device code and whether to retry with a
different UX if the backend/admin policy rejects it.

## Tradeoffs

We intentionally keep `login_chatgpt_common` as a local validation
helper instead of turning it into a capability probe. Device-code
eligibility is checked by actually calling `request_device_code`, which
means policy-disabled cases surface as an immediate request error rather
than an async completion event. We also keep the active-login state
machine minimal: browser and device-code logins share the same public
cancel contract, but device-code cancellation is implemented with a
local cancel token rather than a larger cross-crate refactor.

## Architecture

The protocol grows a new `chatgptDeviceCode` request/response variant in
app-server v2. On the server side, the new handler reuses the existing
ChatGPT login precondition checks, calls `request_device_code`, returns
the device-code payload, and then spawns a background task that waits on
either cancellation or `complete_device_code_login`. On success, it
reuses the existing auth reload and cloud-requirements refresh path
before emitting `account/login/completed` success and `account/updated`.
On failure or cancellation, it emits only `account/login/completed`
failure. The existing `account/login/cancel { loginId }` contract
remains unchanged and now works for both browser and device-code
attempts.


## Tests

Added protocol serialization coverage for the new request/response
variant, plus app-server tests for device-code success, failure, cancel,
and start-time rejection behavior. Existing browser ChatGPT login
coverage remains in place to show that the callback-based flow is
unchanged.
2026-03-27 00:27:15 -07:00
Michael Bolin cc6a956036 merge commit for archive created by Sapling 2026-03-27 00:23:14 -07:00
Michael Bolin 4be744172f ci: enable the Windows Bazel workflow path 2026-03-27 00:23:00 -07:00
Michael Bolin 084d5bcbce Merge 732227c5e6 into sapling-pr-archive-bolinfest 2026-03-27 00:04:07 -07:00
Michael Bolin 732227c5e6 ci: enable the Windows Bazel workflow path 2026-03-27 00:04:02 -07:00
Michael Bolin 23d4e31c93 merge commit for archive created by Sapling 2026-03-26 23:59:32 -07:00
Michael Bolin f6e90adf7f ci: add Bazel clippy workflow for codex-rs 2026-03-26 23:59:23 -07:00
Michael Bolin 992ee53e2f Merge 980d3224c3 into sapling-pr-archive-bolinfest 2026-03-26 23:57:13 -07:00
Michael Bolin 980d3224c3 ci: enable the Windows Bazel workflow path 2026-03-26 23:57:05 -07:00
Michael Bolin 1603ebb50d merge commit for archive created by Sapling 2026-03-26 23:48:08 -07:00
Michael Bolin 40849a1576 ci: add Bazel clippy workflow for codex-rs 2026-03-26 23:47:58 -07:00
Michael Bolin e2d3994f3b merge commit for archive created by Sapling 2026-03-26 23:35:38 -07:00
Michael Bolin 343fd48311 chore: move pty and windows sandbox to Rust 2024 2026-03-26 23:35:11 -07:00
Michael Bolin 5d82e09dcf ci: add Bazel clippy workflow for codex-rs 2026-03-26 23:35:11 -07:00
Michael Bolin 7b61b05d5a Merge 33e587edc5 into sapling-pr-archive-bolinfest 2026-03-26 23:27:52 -07:00
Michael Bolin 33e587edc5 ci: add Bazel clippy workflow for codex-rs 2026-03-26 23:27:45 -07:00
Celia Chen dd30c8eedd chore: refactor network permissions to use explicit domain and unix socket rule maps (#15120)
## Summary

This PR replaces the legacy network allow/deny list model with explicit
rule maps for domains and unix sockets across managed requirements,
permissions profiles, the network proxy config, and the app server
protocol.

Concretely, it:

- introduces typed domain (`allow` / `deny`) and unix socket permission
(`allow` / `none`) entries instead of separate `allowed_domains`,
`denied_domains`, and `allow_unix_sockets` lists
- updates config loading, managed requirements merging, and exec-policy
overlays to read and upsert rule entries consistently
- exposes the new shape through protocol/schema outputs, debug surfaces,
and app-server config APIs
- rejects the legacy list-based keys and updates docs/tests to reflect
the new config format

## Why

The previous representation split related network policy across multiple
parallel lists, which made merging and overriding rules harder to reason
about. Moving to explicit keyed permission maps gives us a single source
of truth per host/socket entry, makes allow/deny precedence clearer, and
gives protocol consumers access to the full rule state instead of
derived projections only.

## Backward Compatibility

### Backward compatible

- Managed requirements still accept the legacy
`experimental_network.allowed_domains`,
`experimental_network.denied_domains`, and
`experimental_network.allow_unix_sockets` fields. They are normalized
into the new canonical `domains` and `unix_sockets` maps internally.
- App-server v2 still deserializes legacy `allowedDomains`,
`deniedDomains`, and `allowUnixSockets` payloads, so older clients can
continue reading managed network requirements.
- App-server v2 responses still populate `allowedDomains`,
`deniedDomains`, and `allowUnixSockets` as legacy compatibility views
derived from the canonical maps.
- `managed_allowed_domains_only` keeps the same behavior after
normalization. Legacy managed allowlists still participate in the same
enforcement path as canonical `domains` entries.

### Not backward compatible

- Permissions profiles under `[permissions.<profile>.network]` no longer
accept the legacy list-based keys. Those configs must use the canonical
`[domains]` and `[unix_sockets]` tables instead of `allowed_domains`,
`denied_domains`, or `allow_unix_sockets`.
- Managed `experimental_network` config cannot mix canonical and legacy
forms in the same block. For example, `domains` cannot be combined with
`allowed_domains` or `denied_domains`, and `unix_sockets` cannot be
combined with `allow_unix_sockets`.
- The canonical format can express explicit `"none"` entries for unix
sockets, but those entries do not round-trip through the legacy
compatibility fields because the legacy fields only represent allow/deny
lists.
## Testing
`/target/debug/codex sandbox macos --log-denials /bin/zsh -c 'curl
https://www.example.com' ` gives 200 with config
```
[permissions.workspace.network.domains]
"www.example.com" = "allow"
```
and fails when set to deny: `curl: (56) CONNECT tunnel failed, response
403`.

Also tested backward compatibility path by verifying that adding the
following to `/etc/codex/requirements.toml` works:
```
[experimental_network]
allowed_domains = ["www.example.com"]
```
2026-03-27 06:17:59 +00:00
Michael Bolin 3e302cc922 Merge 66dfd10d45 into sapling-pr-archive-bolinfest 2026-03-26 23:10:55 -07:00
Michael Bolin 66dfd10d45 ci: enable the Windows Bazel workflow path 2026-03-26 23:10:45 -07:00
Michael Bolin d4dce27f9f Merge 835436c50f into sapling-pr-archive-bolinfest 2026-03-26 23:00:51 -07:00
Michael Bolin 835436c50f ci: enable the Windows Bazel workflow path 2026-03-26 23:00:33 -07:00
Michael Bolin 919cca1eea Merge c08ee0863a into sapling-pr-archive-bolinfest 2026-03-26 22:54:23 -07:00
Michael Bolin 1dfa6e0a59 chore: move pty and windows sandbox to Rust 2024 2026-03-26 22:54:06 -07:00
Michael Bolin c08ee0863a ci: add Bazel clippy workflow for codex-rs 2026-03-26 22:54:06 -07:00
Michael Bolin 18c664919c Merge 03a23002e8 into sapling-pr-archive-bolinfest 2026-03-26 22:42:07 -07:00
Michael Bolin 03a23002e8 ci: add Bazel clippy workflow for codex-rs 2026-03-26 22:41:51 -07:00
Michael Bolin 1664d0a7e6 chore: move pty and windows sandbox to Rust 2024 2026-03-26 22:41:51 -07:00
Michael Bolin 083ba4c82c Merge 9ae14c4390 into sapling-pr-archive-bolinfest 2026-03-26 22:33:57 -07:00
Michael Bolin 9ae14c4390 ci: enable the Windows Bazel workflow path 2026-03-26 22:33:46 -07:00
Michael Bolin 99b1837479 Merge a6932eb88a into sapling-pr-archive-bolinfest 2026-03-26 22:25:36 -07:00
Michael Bolin a6932eb88a ci: add Bazel clippy workflow for codex-rs 2026-03-26 22:25:24 -07:00
Michael Bolin 987742a6db chore: move pty and windows sandbox to Rust 2024 2026-03-26 22:25:24 -07:00
Michael Bolin 5157b6daa5 merge commit for archive created by Sapling 2026-03-26 22:20:28 -07:00
Michael Bolin 0add39b43d ci: enable the Windows Bazel workflow path 2026-03-26 22:20:10 -07:00
Michael Bolin 9548b9b7f4 Merge 34542eb511 into sapling-pr-archive-bolinfest 2026-03-26 22:19:38 -07:00