Skip to content

Move issue-scope to GPT-5.6 Luna via OpenRouter - #337

Merged
theletterf merged 11 commits into
mainfrom
feat/scope-openrouter-luna
Sep 10, 2026
Merged

theletterf merged 11 commits into
mainfrom
feat/scope-openrouter-luna

Conversation

@theletterf

@theletterf theletterf commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves issue-scope off the Copilot engine onto openai/gpt-5.6-luna served through OpenRouter, using the same direct-OpenRouter pattern the triage workflows adopted today.

Before After
Engine copilot codex with OPENAI_BASE_URL: https://openrouter.ai/api/v1
Model claude-sonnet-5 openai/gpt-5.6-luna (1.05M ctx; $0.20/M in, $1.20/M out)
API key Copilot ${{ secrets.OPENROUTER_API_KEY }}
Threat detection copilot, model + env inherited copilot, model: sonnet, OPENAI_BASE_URL blanked
APM skills target claude codex
tools.bash ["date"] false (explicit)
network.allowed — + openrouter.ai, + ab.chatgpt.com

Why each non-obvious choice

  • Detection pinned to copilot and to a Copilot model. gh-aw has one top-level model:; any engine instance without its own engine.model inherits it. With the string form engine: copilot, the detection job inherited openai/gpt-5.6-luna (COPILOT_MODEL in the job env), Copilot couldn't serve it, and detection failed open — caught in the sandbox. The object form with model: sonnet gives detection its own model; engine.model overriding the top-level model per instance is gh-aw #54366, present in v0.88.7. sonnet is the alias from gh-aw's runtime model map (copilot/*sonnet*), so it survives a sonnet-5 → sonnet-6 rollover. Every scope caller already grants copilot-requests: write.

    That was necessary but not sufficient: the detection job also inherits engine.env, so OPENAI_BASE_URL pointed at OpenRouter inside a sandbox configured for copilot. The AWF entrypoint's pre-flight saw an OpenAI base URL, tested connectivity, failed ([health-check][ERROR] Cannot connect to OpenAI API proxy), and killed the container before threat-detect started — no run start line at all. Blanking it on the detection engine (env: { OPENAI_BASE_URL: "" }) overrides the inherited value so the pre-flight is skipped.

  • APM target: codex. The apm CLI's valid harness targets are claude, codex, copilot, cursor, gemini, opencode, windsurf; codex compiles the skill bundles into the layout Codex reads. (An earlier revision used all, which the CLI rejects — caught in the sandbox, where the apm job failed before the agent ran.)

  • Bash disabled explicitly, not widened. gh-aw refuses to compile bash: ["date"] for codex because per-command allowlists are silently ignored at runtime for this engine. The alternative was bash: ["*"]; that's a full shell for one command whose output — today's date — the prompt fetched and never referenced anywhere. Deleting the step and setting bash: false is the least-privilege fix — leaving tools.bash unset would have left shell access at the engine default, which the compiler flags when min-integrity: none is set.

Caller impact

None. All four scope callers (docs-content ×2, docs-content-internal, sandbox) use secrets: inherit, and the workflow reads OPENROUTER_API_KEY by the name those repos already define. copilot-requests: write must stay granted — it now serves detection rather than the main engine.

Also fixed here: the elastic-docs MCP server was delivering zero tools

Surfaced by the sandbox logs (tools/list still returned 0 tools for 'elastic-docs' after 5 retries). The mcp-servers.elastic-docs.allowed list and the scoper prompt used SemanticSearch, GetDocumentByUrl, FindRelatedDocs, FindInconsistencies; the server at www.elastic.co/docs/_mcp/ actually exposes search_docs, get_document_by_url, find_related_docs, find_docs_inconsistencies (plus check_docs_coherence, analyze_document_structure). No name matched, so the filter removed every tool. Pre-existing and engine-independent — the copilot baseline run shows the same zero-tool result — meaning scope has been producing docs-impact assessments without access to the docs corpus. Renamed all seven references. Not a firewall issue: www.elastic.co was already allowed and no denial was logged. Drive-by: docs-agent-experimental.md had the identical four wrong names in its allowlist — fixed in the same way. The seven docs sweeps and docs-review use allowed: ['*'] and were never affected.

MCP fix verified on #118 (run 34479263895)

Zero "0 tools" retries. mcp-logs/tools.json lists all four elastic-docs tools; rpc-messages.jsonl shows the scoper calling search_docs ×3 and get_document_by_url ×3 (plus github get_file_contents ×14, issue_read ×7, search_code ×7). Result: 🟠 partial with hours applied — effort was estimated; the 🟠 is the scoper reporting "Ownership: Unavailable; no CODEOWNERS" (a sandbox artifact) and medium confidence with no linked PR. 24.1 AIC. No firewall denials after allowing ab.chatgpt.com.

OpenRouter attribution — known gap on the codex path

Triage (claude engine) sends OpenRouter's documented attribution headers via ANTHROPIC_CUSTOM_HEADERS: HTTP-Referer: https://github.com/<caller repo> (the app identifier) and X-OpenRouter-Title: <caller repo>/<caller workflow> (display name), plus a custom X-Session-ID: <repo>/<workflow>/<run_id>. Scope on codex sends none: gh-aw writes Codex a [model_providers.openai-proxy] config pointing at the AWF sidecar (http://172.30.0.30:10000, wire_api = "responses") with no http_headers hook, and the sidecar forwards to openrouter.ai without adding attribution. Per OpenRouter, without HTTP-Referer no app page is created. In the OpenRouter dashboard, scope traffic is identifiable by model only — openai/gpt-5.6-luna is used by nothing else — under the shared OPENROUTER_API_KEY. Adding attribution needs a gh-aw feature (codex http_headers passthrough or sidecar header injection); tracked as a follow-up.

Follow-up worth considering

Scope still uses three sub-agents (quality-checker, scoper, sizer). Today's triage work showed that on a mid-tier model the parent→sub-agent hand-off can rewrite the return contract and drop fields. Luna is a mid-tier model. Not changed here — out of scope and scope's contract has been stable on sonnet-5 — but if quality drifts, collapsing the sub-agents is the first thing to try.

Test plan (sandbox, elastic/docs-actions-sandbox)

  • gh aw compile clean; lock file carries the model slug and base URL verbatim, threat-detect --engine copilot, APM target: codex, bash: false, zero compile warnings
  • /scope on a well-formed issue (Reduce docs-review suggestion noise #117) → 🟠 partial assessment posted; footer codex · gpt56, meta engine: codex, model: openai/gpt-5.6-luna; api-proxy log shows 17/17 requests to openai/gpt-5.6-luna via openrouter.ai
  • /scope on a vague issue (Bump the github-actions group across 8 directories with 8 updates #112) → 🔴 quality gate, human-needed, scoper/sizer skipped (7.39 AIC)
  • Detection produces detection_result.json — verified on Reduce docs-review suggestion noise #117 (run 34480489074): [threat-detect] run start: engine=copilot model=sonnet, alias resolved to claude-sonnet-5 via the Copilot CLI, verdict {"prompt_injection":false,"secret_leak":false,"malicious_patch":false}. Model-pin-only runs had still failed open on the pre-flight; the blanked OPENAI_BASE_URL was the missing piece
  • Zero requests to api.openai.com — not added to network.allowed. The only denials were ab.chatgpt.com ×2 (Codex CLI startup); now allowed to remove the denial noise
  • Agent log shows the APM skills being invoked — finding: zero invocations under target: codex, and zero in the pre-switch copilot baseline too. The skills have never been used by this workflow; the APM import is dead weight. Not a regression — follow-up: either fix discovery or drop the import and the apm job

🤖 Generated with Claude Code

Related to #399

Switches the engine from copilot to codex with OPENAI_BASE_URL pointed at
OpenRouter and the model set to openai/gpt-5.6-luna, following the same
direct-OpenRouter pattern the triage workflows already use.

Threat detection is pinned to copilot so it keeps working: detection does
not inherit the engine's base-URL override, and callers already grant
copilot-requests: write. The APM skills target becomes `all` because
apm-action has no codex target. The bash tool is removed rather than
widened to `["*"]` — codex cannot honour a per-command allowlist, and the
only command, `date`, fetched a value the prompt never used.

Callers need no changes: all of them use `secrets: inherit`, and the
workflow reads OPENROUTER_API_KEY by the org's existing name.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf
theletterf requested a review from a team as a code owner September 10, 2026 11:59
theletterf and others added 2 commits September 10, 2026 14:01
Dropping tools.bash entirely left shell access at the engine default,
and with min-integrity: none the compiler warns that community-authored
issues could reach a shell. The agent has no shell needs — its only
command was a date lookup the prompt never used — so bash: false states
the intent and clears the warning.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The apm CLI rejects `all` ("Unknown target 'all'") and lists codex among
its valid harness targets, so the sandbox run died in the apm job before
the agent started. The README I relied on was stale; action.yml and the
CLI agree that codex is supported.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — no blocking issues found.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

theletterf and others added 6 commits September 10, 2026 14:35
`threat-detection: engine: copilot` pinned the engine but the detection
job still inherited the workflow's top-level model, so it asked the
Copilot CLI for openai/gpt-5.6-luna, which Copilot does not serve. The
engine failed and detection fell open on every run — the sandbox log
shows COPILOT_MODEL set to the Luna slug in the detection step.

The object form with an explicit model restores the combination the
pre-switch baseline actually ran and verified: copilot + claude-sonnet-5,
which produced a real detection_result.json.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Use gh-aw's `sonnet` alias for the copilot detection engine instead of a
pinned `claude-sonnet-5`. The alias resolves to whatever sonnet Copilot
serves, so the pin survives a sonnet-5 → sonnet-6 rollover without a
recompile.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The mcp-servers allowlist and the scoper prompt named SemanticSearch,
GetDocumentByUrl, FindRelatedDocs, and FindInconsistencies. The server at
www.elastic.co/docs/_mcp/ exposes search_docs, get_document_by_url,
find_related_docs, and find_docs_inconsistencies. No name matched, so the
allowlist filtered every tool out and each run logged "tools/list returned
0 tools for 'elastic-docs'" — under copilot and codex alike. Scope has been
assessing docs impact without access to the docs corpus.

Pre-existing; surfaced while testing the engine switch.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Codex CLI contacts ab.chatgpt.com at startup; the firewall denied it twice
per run. Allowing it removes the denial noise.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…names

Same defect as issue-scope: the allowlist named SemanticSearch,
GetDocumentByUrl, FindRelatedDocs, and FindInconsistencies, none of which
the server exposes, so it filtered every tool out. The sweeps and
docs-review use `allowed: ['*']` and were never affected.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The detection job inherits the main engine's env, so OPENAI_BASE_URL
pointed at OpenRouter inside a sandbox configured for copilot. The AWF
entrypoint saw an OpenAI base URL, ran its codex-style connectivity
pre-flight, could not reach it, and killed the container before
threat-detect started — every run since the engine switch. Pinning the
model was necessary but not sufficient.

Setting OPENAI_BASE_URL to an empty string on the detection engine
overrides the inherited value so the pre-flight is skipped.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf theletterf self-assigned this Sep 10, 2026
@theletterf theletterf added the enhancement New feature or request label Sep 10, 2026
theletterf and others added 2 commits September 10, 2026 15:08
… names, quality gate

Model section now describes the codex engine on openai/gpt-5.6-luna with
detection on Copilot sonnet and the OPENROUTER_API_KEY requirement. The
MCP tool names match what the server exposes. Adds the quality-gate
outcome and human-needed label that PR #335 introduced but the README
never documented.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Takes #336 (empty project-instructions-path handling). The scope lock
file conflicted; regenerated it with gh aw compile from the merged source
rather than resolving by hand.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf
theletterf merged commit 8f286cd into main Sep 10, 2026
7 checks passed
@theletterf
theletterf deleted the feat/scope-openrouter-luna branch September 10, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant