Skip to content

Commit 4288d55

Browse files
authored
feat: Codex-only runtime, OpenClaw fallback runner, direct Cloudflare publication (#859)
* refactor(runtime): remove the Claude CLI layer; ClawSweeper is Codex-only * feat(publication): publish exact-review results directly from Cloudflare * feat(runner): pluggable agent runner with OpenClaw fallback Run OpenClaw subprocesses through a deny-by-default environment allowlist so workflow credentials and unrelated host secrets are stripped at the process boundary.
1 parent a0cbed1 commit 4288d55

60 files changed

Lines changed: 3494 additions & 1532 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
name: Setup model CLI
2-
description: Cache, install, and authenticate the configured ClawSweeper model runtime.
1+
name: Setup Codex CLI
2+
description: Cache, install, and authenticate the OpenAI Codex CLI.
33
inputs:
4-
model-runtime:
5-
description: Model runtime to install. Supported values are codex and claude.
6-
default: "codex"
74
codex-version:
85
description: Exact Codex CLI npm package version.
96
default: "0.139.0"
107
proxy-version:
118
description: Exact Codex Responses proxy npm package version.
129
default: "0.139.0"
13-
claude-version:
14-
description: Exact Claude Code npm package version.
15-
default: "2.1.220"
16-
claude-provider:
17-
description: Claude upstream provider. Supported values are anthropic, bedrock, vertex, and foundry.
18-
default: "anthropic"
1910
auth-mode:
2011
description: Authentication mode. Use proxy to keep OPENAI_API_KEY out of Codex subprocesses, or login for legacy codex login.
2112
default: "proxy"
@@ -38,15 +29,12 @@ runs:
3829
~/.npm
3930
~/.cache/node/corepack
4031
~/.clawsweeper-repair/codex
41-
~/.clawsweeper-repair/claude
42-
key: ${{ runner.os }}-node24-runtime-${{ inputs['model-runtime'] }}-codex-${{ inputs['codex-version'] }}-proxy-${{ inputs['proxy-version'] }}-claude-${{ inputs['claude-version'] }}-${{ inputs['cache-suffix'] || 'default' }}-v5
32+
key: ${{ runner.os }}-node24-codex-${{ inputs['codex-version'] }}-proxy-${{ inputs['proxy-version'] }}-${{ inputs['cache-suffix'] || 'default' }}-v4
4333
restore-keys: |
44-
${{ runner.os }}-node24-runtime-${{ inputs['model-runtime'] }}-
4534
${{ runner.os }}-node24-codex-${{ inputs['codex-version'] }}-proxy-${{ inputs['proxy-version'] }}-
4635
${{ runner.os }}-node24-codex-
4736
4837
- name: Install Codex CLI
49-
if: ${{ inputs['model-runtime'] == 'codex' }}
5038
shell: bash
5139
run: |
5240
set -euo pipefail
@@ -64,46 +52,7 @@ runs:
6452
fi
6553
codex --version
6654
67-
- name: Install Claude CLI
68-
if: ${{ inputs['model-runtime'] == 'claude' }}
69-
shell: bash
70-
run: |
71-
set -euo pipefail
72-
npm config set prefix "$HOME/.clawsweeper-repair/claude"
73-
npm config set cache "$HOME/.npm"
74-
echo "$HOME/.clawsweeper-repair/claude/bin" >> "$GITHUB_PATH"
75-
export PATH="$HOME/.clawsweeper-repair/claude/bin:$PATH"
76-
77-
env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN -u CLAUDE_CODE_OAUTH_TOKEN \
78-
-u CLAWSWEEPER_INTERNAL_MODEL \
79-
npm install -g "@anthropic-ai/claude-code@${{ inputs['claude-version'] }}" \
80-
--prefer-online --no-audit --no-fund --ignore-scripts
81-
node "$HOME/.clawsweeper-repair/claude/lib/node_modules/@anthropic-ai/claude-code/install.cjs"
82-
claude --version
83-
84-
claude_shim="$(cd "$GITHUB_ACTION_PATH/../../.." && pwd)/dist/claude-codex-shim.js"
85-
test -f "$claude_shim"
86-
echo "CLAWSWEEPER_CLAUDE_SHIM=$claude_shim" >> "$GITHUB_ENV"
87-
cat > "$HOME/.clawsweeper-repair/claude/bin/codex" <<'SH'
88-
#!/usr/bin/env bash
89-
set -euo pipefail
90-
args=()
91-
skip_model_value=0
92-
for arg in "$@"; do
93-
if [[ "$skip_model_value" == "1" ]]; then
94-
skip_model_value=0
95-
elif [[ "$arg" == "--model" || "$arg" == "-m" ]]; then
96-
skip_model_value=1
97-
else
98-
args+=("$arg")
99-
fi
100-
done
101-
exec node "${CLAWSWEEPER_CLAUDE_SHIM:?}" "${args[@]}"
102-
SH
103-
chmod 755 "$HOME/.clawsweeper-repair/claude/bin/codex"
104-
10555
- name: Resolve Codex home
106-
if: ${{ inputs['model-runtime'] == 'codex' }}
10756
shell: bash
10857
run: |
10958
set -euo pipefail
@@ -118,25 +67,7 @@ runs:
11867
export CODEX_HOME="$codex_home"
11968
echo "Using isolated CODEX_HOME=$CODEX_HOME"
12069
121-
- name: Resolve Claude home
122-
if: ${{ inputs['model-runtime'] == 'claude' }}
123-
shell: bash
124-
run: |
125-
set -euo pipefail
126-
if [[ -n "${{ inputs['codex-home'] }}" ]]; then
127-
claude_config_dir="${{ inputs['codex-home'] }}"
128-
else
129-
claude_config_dir="$HOME/.clawsweeper-repair/claude-home/${GITHUB_RUN_ID:-local}-${GITHUB_RUN_ATTEMPT:-1}"
130-
fi
131-
mkdir -p "$claude_config_dir"
132-
chmod 700 "$claude_config_dir"
133-
echo "CLAUDE_CONFIG_DIR=$claude_config_dir" >> "$GITHUB_ENV"
134-
echo "CLAWSWEEPER_MODEL_RUNTIME=claude" >> "$GITHUB_ENV"
135-
echo "CLAWSWEEPER_STEERABLE_CODEX=0" >> "$GITHUB_ENV"
136-
echo "Using isolated CLAUDE_CONFIG_DIR=$claude_config_dir"
137-
13870
- name: Configure internal Codex model
139-
if: ${{ inputs['model-runtime'] == 'codex' }}
14071
shell: bash
14172
run: |
14273
set -euo pipefail
@@ -145,100 +76,9 @@ runs:
14576
model_json="$(node -e 'process.stdout.write(JSON.stringify(process.argv[1]))' "$CLAWSWEEPER_INTERNAL_MODEL")"
14677
printf 'model = %s\n' "$model_json" > "$CODEX_HOME/config.toml"
14778
chmod 600 "$CODEX_HOME/config.toml"
148-
echo "CLAWSWEEPER_MODEL_RUNTIME=codex" >> "$GITHUB_ENV"
149-
150-
- name: Configure internal Claude model and provider
151-
if: ${{ inputs['model-runtime'] == 'claude' }}
152-
shell: bash
153-
env:
154-
CLAUDE_PROVIDER: ${{ inputs['claude-provider'] }}
155-
run: |
156-
set -euo pipefail
157-
export CLAUDE_CONFIG_DIR="${CLAUDE_CONFIG_DIR:?}"
158-
test -n "${CLAWSWEEPER_INTERNAL_MODEL:-}"
159-
credentials_file="$CLAUDE_CONFIG_DIR/provider-env.json"
160-
node <<'NODE'
161-
const fs = require("node:fs");
162-
const path = require("node:path");
163-
const provider = process.env.CLAUDE_PROVIDER;
164-
const supported = new Set(["anthropic", "bedrock", "vertex", "foundry"]);
165-
if (!supported.has(provider)) {
166-
throw new Error(`Unsupported Claude provider: ${provider}`);
167-
}
168-
const keys = [
169-
"ANTHROPIC_API_KEY",
170-
"ANTHROPIC_AUTH_TOKEN",
171-
"ANTHROPIC_BASE_URL",
172-
"ANTHROPIC_CUSTOM_HEADERS",
173-
"ANTHROPIC_FOUNDRY_API_KEY",
174-
"ANTHROPIC_FOUNDRY_BASE_URL",
175-
"ANTHROPIC_FOUNDRY_RESOURCE",
176-
"AWS_ACCESS_KEY_ID",
177-
"AWS_BEARER_TOKEN_BEDROCK",
178-
"AWS_DEFAULT_REGION",
179-
"AWS_PROFILE",
180-
"AWS_REGION",
181-
"AWS_SECRET_ACCESS_KEY",
182-
"AWS_SESSION_TOKEN",
183-
"CLAUDE_CODE_OAUTH_TOKEN",
184-
"GOOGLE_APPLICATION_CREDENTIALS",
185-
"GOOGLE_CLOUD_PROJECT",
186-
"GOOGLE_CLOUD_REGION",
187-
];
188-
const credentials = Object.fromEntries(
189-
keys.flatMap((key) => process.env[key] ? [[key, process.env[key]]] : []),
190-
);
191-
if (process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON) {
192-
const googleCredentialsPath = path.join(process.env.CLAUDE_CONFIG_DIR, "google-credentials.json");
193-
fs.writeFileSync(
194-
googleCredentialsPath,
195-
`${process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON.trim()}\n`,
196-
{ mode: 0o600 },
197-
);
198-
credentials.GOOGLE_APPLICATION_CREDENTIALS = googleCredentialsPath;
199-
}
200-
if (provider === "anthropic" &&
201-
!credentials.ANTHROPIC_API_KEY &&
202-
!credentials.ANTHROPIC_AUTH_TOKEN &&
203-
!credentials.CLAUDE_CODE_OAUTH_TOKEN) {
204-
throw new Error("Claude Anthropic provider requires ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or CLAUDE_CODE_OAUTH_TOKEN.");
205-
}
206-
if (provider === "bedrock" &&
207-
!credentials.AWS_BEARER_TOKEN_BEDROCK &&
208-
!(credentials.AWS_ACCESS_KEY_ID && credentials.AWS_SECRET_ACCESS_KEY) &&
209-
!credentials.AWS_PROFILE) {
210-
throw new Error("Claude Bedrock provider requires a Bedrock bearer token, AWS access keys, or AWS_PROFILE.");
211-
}
212-
if (provider === "vertex" &&
213-
!credentials.GOOGLE_APPLICATION_CREDENTIALS) {
214-
throw new Error("Claude Vertex provider requires Google application credentials.");
215-
}
216-
if (provider === "foundry" &&
217-
!credentials.ANTHROPIC_FOUNDRY_API_KEY) {
218-
throw new Error("Claude Foundry provider requires ANTHROPIC_FOUNDRY_API_KEY.");
219-
}
220-
if (provider === "bedrock") credentials.CLAUDE_CODE_USE_BEDROCK = "1";
221-
if (provider === "vertex") credentials.CLAUDE_CODE_USE_VERTEX = "1";
222-
if (provider === "foundry") credentials.CLAUDE_CODE_USE_FOUNDRY = "1";
223-
const configDir = process.env.CLAUDE_CONFIG_DIR;
224-
fs.writeFileSync(
225-
path.join(configDir, "settings.json"),
226-
`${JSON.stringify({
227-
model: process.env.CLAWSWEEPER_INTERNAL_MODEL,
228-
skipDangerousModePermissionPrompt: true,
229-
}, null, 2)}\n`,
230-
{ mode: 0o600 },
231-
);
232-
fs.writeFileSync(
233-
path.join(configDir, "provider-env.json"),
234-
`${JSON.stringify(credentials)}\n`,
235-
{ mode: 0o600 },
236-
);
237-
NODE
238-
echo "CLAWSWEEPER_CLAUDE_CREDENTIALS_FILE=$credentials_file" >> "$GITHUB_ENV"
23979
24080
- name: Authenticate Codex through Responses proxy
241-
if: ${{ inputs['model-runtime'] == 'codex' && inputs['auth-mode'] == 'proxy' }}
81+
if: ${{ inputs['auth-mode'] == 'proxy' }}
24282
shell: bash
24383
run: |
24484
set -euo pipefail
@@ -273,7 +113,7 @@ runs:
273113
echo "Configured Codex Responses proxy on localhost."
274114
275115
- name: Authenticate Codex with login
276-
if: ${{ inputs['model-runtime'] == 'codex' && inputs['auth-mode'] == 'login' }}
116+
if: ${{ inputs['auth-mode'] == 'login' }}
277117
shell: bash
278118
run: |
279119
set -euo pipefail
@@ -285,15 +125,8 @@ runs:
285125
fi
286126
287127
- name: Reject unknown Codex auth mode
288-
if: ${{ inputs['model-runtime'] == 'codex' && inputs['auth-mode'] != 'proxy' && inputs['auth-mode'] != 'login' }}
128+
if: ${{ inputs['auth-mode'] != 'proxy' && inputs['auth-mode'] != 'login' }}
289129
shell: bash
290130
run: |
291131
echo "Unsupported setup-codex auth-mode: ${{ inputs['auth-mode'] }}" >&2
292132
exit 1
293-
294-
- name: Reject unknown model runtime
295-
if: ${{ inputs['model-runtime'] != 'codex' && inputs['model-runtime'] != 'claude' }}
296-
shell: bash
297-
run: |
298-
echo "Unsupported model runtime: ${{ inputs['model-runtime'] }}" >&2
299-
exit 1
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Setup OpenClaw CLI
2+
description: Install the pinned OpenClaw CLI when ClawSweeper selects the OpenClaw runner.
3+
inputs:
4+
openclaw-version:
5+
description: Exact OpenClaw CLI npm package version.
6+
default: "2026.7.2"
7+
openclaw-source-ref:
8+
description: >-
9+
Optional openclaw/openclaw commit SHA. When set, build the CLI from
10+
source at that ref instead of installing the npm package. Bridges
11+
features that have landed on main but not yet shipped in a release.
12+
default: ""
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Cache OpenClaw CLI and npm downloads
17+
if: ${{ env.CLAWSWEEPER_RUNNER == 'openclaw' }}
18+
uses: actions/cache@v6
19+
with:
20+
path: |
21+
~/.npm
22+
~/.cache/node/corepack
23+
~/.clawsweeper-repair/openclaw
24+
key: ${{ runner.os }}-node24-openclaw-${{ inputs['openclaw-version'] }}-v1
25+
restore-keys: |
26+
${{ runner.os }}-node24-openclaw-
27+
28+
- name: Install OpenClaw CLI
29+
if: ${{ env.CLAWSWEEPER_RUNNER == 'openclaw' && inputs['openclaw-source-ref'] == '' }}
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
npm config set prefix "$HOME/.clawsweeper-repair/openclaw"
34+
npm config set cache "$HOME/.npm"
35+
echo "$HOME/.clawsweeper-repair/openclaw/bin" >> "$GITHUB_PATH"
36+
export PATH="$HOME/.clawsweeper-repair/openclaw/bin:$PATH"
37+
npm install -g "openclaw@${{ inputs['openclaw-version'] }}" \
38+
--prefer-online --no-audit --no-fund
39+
openclaw --version
40+
41+
- name: Cache OpenClaw source build
42+
if: ${{ env.CLAWSWEEPER_RUNNER == 'openclaw' && inputs['openclaw-source-ref'] != '' }}
43+
uses: actions/cache@v6
44+
with:
45+
path: ~/.clawsweeper-repair/openclaw-source
46+
key: ${{ runner.os }}-node24-openclaw-source-${{ inputs['openclaw-source-ref'] }}-v1
47+
48+
- name: Build OpenClaw CLI from source
49+
if: ${{ env.CLAWSWEEPER_RUNNER == 'openclaw' && inputs['openclaw-source-ref'] != '' }}
50+
shell: bash
51+
run: |
52+
set -euo pipefail
53+
source_root="$HOME/.clawsweeper-repair/openclaw-source"
54+
if [ ! -x "$source_root/checkout/dist/index.js" ] || \
55+
[ "$(cat "$source_root/ref" 2>/dev/null)" != "${{ inputs['openclaw-source-ref'] }}" ]; then
56+
rm -rf "$source_root"
57+
mkdir -p "$source_root"
58+
git init -q "$source_root/checkout"
59+
git -C "$source_root/checkout" fetch -q --depth 1 \
60+
https://github.com/openclaw/openclaw.git "${{ inputs['openclaw-source-ref'] }}"
61+
git -C "$source_root/checkout" checkout -q FETCH_HEAD
62+
(cd "$source_root/checkout" && corepack enable && pnpm install --frozen-lockfile && pnpm build)
63+
printf '%s\n' "${{ inputs['openclaw-source-ref'] }}" > "$source_root/ref"
64+
fi
65+
launcher="$source_root/openclaw"
66+
printf '#!/bin/sh\nexec node "%s/checkout/dist/index.js" "$@"\n' "$source_root" > "$launcher"
67+
chmod +x "$launcher"
68+
echo "CLAWSWEEPER_OPENCLAW_BIN=$launcher" >> "$GITHUB_ENV"
69+
"$launcher" --version

‎.github/workflows/assist.yml‎

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ env:
5656
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
5757
CLAWSWEEPER_APP_CLIENT_ID: Iv23liOECG0slfuhz093
5858
CLAWSWEEPER_MODEL: internal
59+
CLAWSWEEPER_RUNNER: ${{ vars.CLAWSWEEPER_RUNNER || 'codex' }}
60+
CLAWSWEEPER_OPENCLAW_MODEL: ${{ secrets.CLAWSWEEPER_OPENCLAW_MODEL }}
61+
CLAWSWEEPER_OPENCLAW_PROVIDERS_JSON: ${{ secrets.CLAWSWEEPER_OPENCLAW_PROVIDERS_JSON }}
62+
CLAWSWEEPER_OPENCLAW_OPENAI_KEY: ${{ vars.CLAWSWEEPER_RUNNER == 'openclaw' && secrets.OPENAI_API_KEY || '' }}
63+
ANTHROPIC_API_KEY: ${{ vars.CLAWSWEEPER_RUNNER == 'openclaw' && secrets.ANTHROPIC_API_KEY || '' }}
64+
GEMINI_API_KEY: ${{ vars.CLAWSWEEPER_RUNNER == 'openclaw' && secrets.GEMINI_API_KEY || '' }}
65+
KIMI_API_KEY: ${{ vars.CLAWSWEEPER_RUNNER == 'openclaw' && secrets.KIMI_API_KEY || '' }}
66+
OPENROUTER_API_KEY: ${{ vars.CLAWSWEEPER_RUNNER == 'openclaw' && secrets.OPENROUTER_API_KEY || '' }}
5967

6068
concurrency:
6169
group: ${{ format('clawsweeper-assist-{0}-{1}-{2}', github.event.client_payload.target_repo || inputs.target_repo || 'openclaw/openclaw', github.event.client_payload.item_number || inputs.item_number || 'unknown', github.event.client_payload.comment_id || inputs.comment_id || 'manual') }}
@@ -205,26 +213,12 @@ jobs:
205213
permission-pull-requests: read
206214

207215
- uses: ./.github/actions/setup-codex
216+
if: ${{ env.CLAWSWEEPER_RUNNER != 'openclaw' }}
208217
env:
209218
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
210-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
211-
ANTHROPIC_AUTH_TOKEN: ${{ secrets.ANTHROPIC_AUTH_TOKEN }}
212-
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
213-
AWS_ACCESS_KEY_ID: ${{ secrets.CLAWSWEEPER_AWS_ACCESS_KEY_ID }}
214-
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLAWSWEEPER_AWS_SECRET_ACCESS_KEY }}
215-
AWS_SESSION_TOKEN: ${{ secrets.CLAWSWEEPER_AWS_SESSION_TOKEN }}
216-
AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.CLAWSWEEPER_AWS_BEARER_TOKEN_BEDROCK }}
217-
AWS_REGION: ${{ vars.CLAWSWEEPER_AWS_REGION }}
218-
GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.CLAWSWEEPER_GOOGLE_APPLICATION_CREDENTIALS_JSON }}
219-
GOOGLE_CLOUD_PROJECT: ${{ vars.CLAWSWEEPER_GOOGLE_CLOUD_PROJECT }}
220-
GOOGLE_CLOUD_REGION: ${{ vars.CLAWSWEEPER_GOOGLE_CLOUD_REGION }}
221-
ANTHROPIC_FOUNDRY_API_KEY: ${{ secrets.CLAWSWEEPER_ANTHROPIC_FOUNDRY_API_KEY }}
222-
ANTHROPIC_FOUNDRY_BASE_URL: ${{ vars.CLAWSWEEPER_ANTHROPIC_FOUNDRY_BASE_URL }}
223-
ANTHROPIC_FOUNDRY_RESOURCE: ${{ vars.CLAWSWEEPER_ANTHROPIC_FOUNDRY_RESOURCE }}
224-
CLAWSWEEPER_INTERNAL_MODEL: ${{ vars.CLAWSWEEPER_MODEL_RUNTIME == 'claude' && secrets.CLAWSWEEPER_CLAUDE_MODEL || secrets.CLAWSWEEPER_MODEL }}
225-
with:
226-
model-runtime: ${{ vars.CLAWSWEEPER_MODEL_RUNTIME || 'codex' }}
227-
claude-provider: ${{ vars.CLAWSWEEPER_CLAUDE_PROVIDER || 'anthropic' }}
219+
CLAWSWEEPER_INTERNAL_MODEL: ${{ secrets.CLAWSWEEPER_MODEL }}
220+
221+
- uses: ./.github/actions/setup-openclaw
228222

229223
- name: Generate bounded assist artifact
230224
id: generate

0 commit comments

Comments
 (0)