Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions containers/agent/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,26 @@ GRADLE_EOF
fi
}

warn_codex_auto_model() {
if [ -z "${OPENAI_BASE_URL:-}" ]; then
return
fi

local CODEX_MODEL="${GH_AW_MODEL_AGENT_CODEX:-}"
if [ -z "${CODEX_MODEL}" ]; then
return
fi

local ENGINE_NAME="${GH_AW_AWF_ENGINE_NAME:-${GH_AW_ENGINE_ID:-}}"
case "${ENGINE_NAME}:${CODEX_MODEL}" in
[Cc][Oo][Dd][Ee][Xx]:[Aa][Uu][Tt][Oo])
echo "[entrypoint][WARN] Codex model 'auto' is not supported with AWF api-proxy/API-key routing."
echo "[entrypoint][WARN] Codex resolves 'auto' through ChatGPT-authenticated remote model metadata; API-key auth cannot access that catalog."
echo "[entrypoint][WARN] Set an explicit Codex model in workflow frontmatter (for example, model: gpt-5-codex) before running under AWF."
;;
esac
}

log_environment_details() {
# Print proxy environment
echo "[entrypoint] Proxy configuration:"
Expand Down Expand Up @@ -1673,6 +1693,7 @@ wait_for_iptables
check_service_health
configure_claude_api_key
configure_jvm_proxy
warn_codex_auto_model
log_environment_details
determine_capabilities_to_drop
log_execution_context "$@"
Expand Down
8 changes: 7 additions & 1 deletion docs/api-proxy-sidecar.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ export OPENAI_API_KEY="sk-..."

sudo awf \
--allow-domains api.openai.com \
-- npx @openai/codex -p "write a hello world function"
-- npx @openai/codex --model gpt-5.3-codex -p "write a hello world function"
```

The agent container automatically uses `http://172.30.0.30:10000` as the OpenAI base URL.

When Codex runs through the AWF API proxy, use an explicit model such as
`gpt-5.3-codex`. Codex's `auto` model alias depends on ChatGPT-authenticated
remote model/plugin metadata resolution; API-key based proxy routing cannot use
that catalog even when `chatgpt.com` is allowed, so `auto` can fail with
`The requested model is not supported`.

### Claude Code example

```bash
Expand Down
16 changes: 16 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@
```
4. Review [GitHub Enterprise Configuration](enterprise-configuration.md) for the expected endpoint derivation and allowlist behavior.

### Codex `auto` Model Fails Under AWF

**Problem:** A Codex run inside AWF fails with messages such as:
- `Unknown model auto is used`
- `The requested model is not supported`
- `chatgpt authentication required for remote plugin catalog; api key auth is not supported`

**Cause:** Codex's `auto` model alias relies on ChatGPT-authenticated remote
model/plugin metadata. AWF's API proxy uses API-key credential injection, so the
ChatGPT catalog lookup cannot be used even if `chatgpt.com` is on the network
allowlist.

**Solution:** Set an explicit Codex model instead of `auto`, for example
`model: gpt-5.3-codex` in workflow frontmatter or `codex exec --model
gpt-5.3-codex ...` for direct CLI usage.

## Permission Issues

### iptables Permission Denied
Expand Down
55 changes: 55 additions & 0 deletions tests/entrypoint-phase-functions.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ required_functions=(
check_service_health
configure_claude_api_key
configure_jvm_proxy
warn_codex_auto_model
log_environment_details
determine_capabilities_to_drop
log_execution_context
Expand Down Expand Up @@ -75,6 +76,7 @@ required_calls=(
'check_service_health'
'configure_claude_api_key'
'configure_jvm_proxy'
'warn_codex_auto_model'
'log_environment_details'
'determine_capabilities_to_drop'
'log_execution_context "$@"'
Expand Down Expand Up @@ -263,6 +265,59 @@ else
fail "configure_jvm_proxy() aborts when .m2/.gradle exist on a read-only home"
fi

run_warn_codex_auto_model_fixture() {
local output
output="$(
env \
AWF_API_PROXY_IP="172.30.0.30" \
OPENAI_BASE_URL="http://172.30.0.30:10000" \
GH_AW_AWF_ENGINE_NAME="codex" \
GH_AW_MODEL_AGENT_CODEX="auto" \
bash -c '
. "$1"
warn_codex_auto_model
' _ "${ENTRYPOINT}" 2>&1
)"
case "${output}" in
*"Codex model 'auto' is not supported with AWF api-proxy/API-key routing."*\
*"Set an explicit Codex model in workflow frontmatter"*)
;;
*)
return 1
;;
esac

output="$(
env \
AWF_API_PROXY_IP="172.30.0.30" \
GH_AW_AWF_ENGINE_NAME="codex" \
GH_AW_MODEL_AGENT_CODEX="gpt-5-codex" \
bash -c '
. "$1"
warn_codex_auto_model
' _ "${ENTRYPOINT}" 2>&1
)"
[ -z "${output}" ]

output="$(
env \
AWF_API_PROXY_IP="172.30.0.30" \
GH_AW_AWF_ENGINE_NAME="codex" \
GH_AW_MODEL_AGENT_CODEX="auto" \
bash -c '
. "$1"
warn_codex_auto_model
' _ "${ENTRYPOINT}" 2>&1
)"
[ -z "${output}" ]
}

if run_warn_codex_auto_model_fixture; then
pass "warn_codex_auto_model() warns only for codex model auto under api-proxy"
else
fail "warn_codex_auto_model() did not warn correctly for codex model auto under api-proxy"
fi

echo ""
echo "Results: ${PASS} passed, ${FAIL} failed"

Expand Down
Loading