Repository navigation
Accept vendor-prefixed OpenRouter model IDs in Pi workflows - #77562
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! Commit pushed:
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Review completed with one medium-severity correctness issue: namespaced glob matching can select the wrong model version because sorting truncates the model suffix. Please preserve the full suffix when extracting version tokens.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| const entryParts = entry.split("/", 2); | ||
| if (patternParts.length === 1) { | ||
| const patternParts = [pattern.slice(0, pattern.indexOf("/")), pattern.slice(pattern.indexOf("/") + 1)]; | ||
| const entryParts = [entry.slice(0, entry.indexOf("/")), entry.slice(entry.indexOf("/") + 1)]; |
There was a problem hiding this comment.
Namespaced glob matches now reach this resolver, but the latest-match sort still truncates each entry at the second slash, so every openrouter/anthropic/* candidate is scored from anthropic and the catalog order wins instead of selecting the newest model.
💡 Preserve the full model suffix
Use the substring after the first slash (for example entry.slice(entry.indexOf("/") + 1)) rather than split("/", 2)[1] in both comparator operands, and add a regression test with two versioned namespaced candidates. This keeps alias resolution deterministic and preserves the intended newest-version behavior.
There was a problem hiding this comment.
Already fixed in 4d01ccd: version sorting preserves the full suffix, with a 4.9-versus-4.10 namespaced regression. The targeted alias tests pass after merging main.
Comment MemoryPeek at saved memory (review-history)History |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed PR head f7704b4 against Model Alias Format Specification §4.1, §11, and §12 (v1.3.1). The intentional namespaced-model behavior is supported by the implementation and tests. The specification edit needed versioning, change-log, conformance IDs, and sync-note updates; these were applied in model-alias-specification.md as v1.4.0 and queued to the PR branch in commit 838eebd. No implementation or test changes were made by the review. Static review only; tests were not run.
Generated by PR Specification Reviewer for #77562 · copilot · gpt50 · ~6 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again
|
@copilot resolve the merge conflicts on this branch. |
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
🟡 Changes recommended
Existing helper tests fail, and namespaced model IDs still break Pi sub-agent startup and live alias resolution.
3 open issues
What changed in this PR
This PR addresses #77514 by allowing vendor-prefixed OpenRouter model IDs in gh-aw and clarifying the explicit route required for sandboxed Pi workflows.
Changes:
- Allow validated, nonempty namespace segments in exact model IDs.
- Preserve complete model suffixes during matching while keeping wildcards from crossing slashes.
- Add regression coverage and document exact catalog IDs and credential-isolated routing.
| File | Description |
|---|---|
pkg/workflow/pi_engine_config_compilation_test.go |
Tests OpenRouter compilation and explicit route requirements. |
pkg/workflow/model_identifier.go |
Allows slash-separated model namespaces. |
pkg/workflow/model_alias_validation_test.go |
Tests valid and invalid namespaced identifiers. |
docs/src/content/docs/specs/model-alias-specification.md |
Updates the identifier grammar and namespace rules. |
docs/src/content/docs/reference/engines/pi.md |
Clarifies OpenRouter catalog IDs and sandbox routing. |
actions/setup/js/resolve_model_alias.test.cjs |
Tests namespaced matching and wildcard boundaries. |
actions/setup/js/resolve_model_alias.cjs |
Preserves the full model suffix during matching. |
actions/setup/js/pi_models_json.test.cjs |
Tests exact OpenRouter IDs through the OpenAI gateway. |
Review effort: Balanced (dynamic)
| func firstForbiddenCharInModelToken(s string) rune { | ||
| for _, r := range s { | ||
| if !isAlpha(r) && !isDigit(r) && r != '_' && r != '.' && r != '-' { | ||
| if !isAlpha(r) && !isDigit(r) && r != '_' && r != '.' && r != '/' && r != '-' { |
| expect(globMatch("openrouter/anthropic/claude-sonnet-4", "openrouter/anthropic/claude-sonnet-4")).toBe(true); | ||
| expect(globMatch("openrouter/anthropic/claude-sonnet-4", "openrouter/anthropic/claude-opus-4")).toBe(false); | ||
| expect(globMatch("openrouter/*", "openrouter/anthropic/claude-sonnet-4")).toBe(false); | ||
| expect(resolveModelAlias("sonnet", { sonnet: ["openrouter/anthropic/claude-sonnet-4"] }, ["openrouter/anthropic/claude-opus-4", "openrouter/anthropic/claude-sonnet-4"])).toBe("openrouter/anthropic/claude-sonnet-4"); |
| // model-token: model-char segments separated by "."; each segment starts with ALPHA or DIGIT | ||
| reModelToken = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)*$`) | ||
| // model-token: nonempty slash-separated segments; each dot-separated component starts with ALPHA or DIGIT | ||
| reModelToken = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]*([./][A-Za-z0-9][A-Za-z0-9_-]*)*$`) |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /grill-with-docs. Requesting changes because namespaced policy rules fail open.
📋 Key Themes & Highlights
Key Themes
- Fail-open policy rules:
splitModelPolicyRule(pkg/workflow/model_routing.go, unchanged) usesLastIndex, so namespacedmodels.blockedrules are silently ignored once the grammar admits/. - Test gap: the new tests cover parsing and exact matching, not policy enforcement or the wildcard boundary.
Positive Highlights
- ✅
globMatchnow slices on the first/.*maps to[^/]*, soopenrouter/*no longer matches nested namespaces. - ✅ Grammar and error text are updated together with the spec and
pi.md. - ✅ The OpenRouter compile test checks the exact
GH_AW_PI_MODELvalue.
Limits
- Go rejects namespaced glob tokens at parse time, so the
selectLatestGlobMatchsplit in the JS file is not reachable from compiled workflows and was not flagged. - Full Go and vitest suites were not run; targeted probes only.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| // model-token: model-char segments separated by "."; each segment starts with ALPHA or DIGIT | ||
| reModelToken = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)*$`) | ||
| // model-token: nonempty slash-separated segments; each dot-separated component starts with ALPHA or DIGIT | ||
| reModelToken = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]*([./][A-Za-z0-9][A-Za-z0-9_-]*)*$`) |
There was a problem hiding this comment.
[/grill-with-docs] This grammar now admits namespaced model tokens, but the policy path does not follow. splitModelPolicyRule in pkg/workflow/model_routing.go (unchanged here) uses strings.LastIndex, so openrouter/anthropic/claude-opus-4 splits into provider openrouter/anthropic. qualifiedModelPolicyRule then returns ok=false, and a namespaced models.blocked rule is silently ignored. That fails open.
💡 Suggested fix
Split on the first /, as modelRoutingCandidateNamespace already does. The provider is the first segment and the model is the rest. Bare rules (no /) must still apply to every provider.
@copilot please address this.
There was a problem hiding this comment.
Already fixed in 4d01ccd: policy rules split on the first slash, preserving the complete model namespace. Targeted namespaced policy tests pass after merging main.
| assert.Equal(t, "claude-opus-4.5", p.ModelToken) | ||
| } | ||
|
|
||
| func TestParseModelIdentifier_NamespacedModel(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] TestParseModelIdentifier_NamespacedModel only checks parsing. It does not exercise policy matching, so the fail-open above passes CI.
💡 Suggested test
Write these red tests first:
models.blocked: ["openrouter/anthropic/claude-opus-4"]must exclude the candidateopenrouter/anthropic/claude-opus-4.models.allowed: ["openrouter/*"]must not matchopenrouter/anthropic/claude-opus-4, because*does not cross/.
@copilot please address this.
There was a problem hiding this comment.
Covered in 4d01ccd and 6fea037: exact namespaced blocked rules exclude the candidate, and openrouter/* does not authorize nested namespaces. Both regression tests pass.
| expect(matches).toBe("copilot/claude-sonnet-4.6"); | ||
| }); | ||
|
|
||
| it("preserves the full namespaced model token when matching", () => { |
There was a problem hiding this comment.
[/tdd] The new test covers exact namespaced matching but not the wildcard boundary. Since * maps to [^/]*, add a case asserting globMatch("openrouter/*", "openrouter/anthropic/claude") is false, plus a positive openrouter/anthropic/*sonnet* case if not already covered. These lock the rewritten segment logic against regressions.
@copilot please address this.
There was a problem hiding this comment.
Covered in 4d01ccd: openrouter/* rejects nested namespaces, while openrouter/anthropic/*sonnet* matches. The targeted JavaScript suite passes.
…-openrouter-example # Conflicts: # docs/src/content/docs/specs/model-alias-specification.md Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Resolved the conflict and merged |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "b4f1dfc84de934dd328122b302cf57091576101f",
"kind": "requested",
"schema_version": "1",
"state": "fb8a8fb67fba4123532b5951acd24efafc6a350554f72a7b364df778b721dc8b",
"work": [
"07a86ee097ca08ae818f3c3e23bc0edc1fcf36458fb6ccd20d42272de366a10d",
"76845a0049c50dcf66f2707be71f139f2e468a5a6bf0f2a0bf686917737eb9ab",
"8acb61a077717e3a460018aacdfde96fd489f77606cd36169e2328d9079b75bb",
"b45dc3930e33923bd2acc2d7960bd68dca75238b6db3b190a8ca378c14a52495",
"f0ea5c9a97be4fe1ab906cea61b77689a1f4636ad81de2c6ded0e56b27c0ab02"
],
"workflow": "pr-sous-chef"
}
|
…-openrouter-example Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged the latest |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "4d01ccd8a8714b5320976ef24b59211c65b20b46",
"kind": "requested",
"schema_version": "1",
"state": "618878a545056f804a9c65c7de0241199cf88f21dc27f3470a481585c259e8ce",
"work": [
"07a86ee097ca08ae818f3c3e23bc0edc1fcf36458fb6ccd20d42272de366a10d",
"4abda31131600b8ff4d73bd7f3bf534a014465b854fafd42d5113bf9f4d854ee",
"76845a0049c50dcf66f2707be71f139f2e468a5a6bf0f2a0bf686917737eb9ab",
"b45dc3930e33923bd2acc2d7960bd68dca75238b6db3b190a8ca378c14a52495",
"f0ea5c9a97be4fe1ab906cea61b77689a1f4636ad81de2c6ded0e56b27c0ab02"
],
"workflow": "pr-sous-chef"
}
|
…-openrouter-example # Conflicts: # scripts/test-wasm-golden.mjs Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
@copilot resolve the merge conflicts on this branch. |
…-openrouter-example # Conflicts: # actions/setup/js/check_workflow_timestamp_api.test.cjs # scripts/test-wasm-golden.mjs Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged
Resolved both conflicts and merged |
|
🎉 This pull request is included in a new release. Release: |
https://warthogs.atlassian.net/browse/LNDENG-5627 Related PRs: - canonical/landscape-documentation#426 (release-notes-draft workflow that opens the shared PR) - canonical/landscape-internal-docs#350 (shared-secret convention) - canonical/landscape-internal-docs#388 (changelog-bot OpenSpec spec and design doc) Spec: openspec/changes/changelog-bot/ in canonical/landscape-internal-docs (PR #388), with baseline specs under openspec/specs/changelog-bot/ (own-repo-changelog, shared-release-notes, shared-infrastructure). ## Summary Adds a weekly changelog bot, ported from landscape-server. Every Saturday it collects user-facing conventional commits since the last release, prepends a new debian/changelog block, bumps the companion version file, and opens a PR. Adaptations: maintains debian/changelog for the landscape-client package; release-point detection uses git describe with --exclude 'import/*' --exclude 'applied/*' because this repo carries gbp import tags in those namespaces (release tags use a hyphen where the changelog uses a tilde); the tag anchor is kept because this repo pushes beta tags during the cycle, so the time-based window is not needed. Next-version rule: increment ~beta.N within a cycle; after a final or patch release, start the next YY.MM cycle as YY.MM~beta.1. Bumps UPSTREAM_VERSION and PYTHON_VERSION in landscape/__init__.py instead of pyproject.toml/uv.lock, so no protected-files exclusion is needed. PR titles follow this repo's release convention (build: release <version> for jammy). Aligned with the landscape-ui iteration where applicable: create-pull-request allows only debian/changelog and landscape/__init__.py; push-to-pull-request-branch allows only docs release-notes pages. Dedup against the top changelog block handles a release PR merged before its tag is pushed. Flag-only review (never edits existing content): fixes for unreleased regressions and user-facing commits with no (#1234) reference are flagged under a "Changelog entries to review" heading. Breaking changes are detected via BREAKING CHANGE: footers, and conventional prefixes are matched case-insensitively. ## Docs release notes The bot also writes the Landscape Client section of the shared release-notes PR in canonical/landscape-documentation. It only pushes its own section to the existing PR's branch and skips the docs work when none is open. Docs steps never git fetch; the handler applies the section-scoped patch to the branch tip and fails on conflict. ## Secrets - OPENROUTER_API_KEY: pi engine inference (passed as OPENAI_API_KEY with OPENAI_BASE_URL pinned to `https://openrouter.ai/api/v1`). - COPILOT_GITHUB_TOKEN: threat detection only. gh-aw's threat-detection job is hardcoded to the Copilot CLI and pinned to a Copilot-catalog model (`claude-haiku-5.5`); detection cannot run on OpenRouter (github/gh-aw#78414), so this token stays solely to keep that job alive. - LANDSCAPE_CHANGELOG_TOKEN: fine-grained PAT with contents and pull-requests read/write on this repo and canonical/landscape-documentation. Backs the whole safe_outputs job (github/gh-aw#77580 binds it to one credential): the own-repo changelog PR and the release-notes push. Documented in canonical/landscape-internal-docs#350. All three are present in this repo (verified 2026-11-13). Agent egress is confined by the AWF firewall to the default allowlist; all secret values feed gh-aw's output-redaction step. ## Engine and pre-merge testing notes The bot runs on the pi engine with model `openrouter/deepseek/deepseek-v4.1-flash-1017` and `model-provider: openai`, using OPENROUTER_API_KEY. The vendored OpenRouter id requires gh-aw v1.3.0+ (github/gh-aw#77514, fixed by github/gh-aw#77562); the workflow is compiled with gh-aw v1.3.0. The commit range is computed against origin/main, and each commit is classified individually in a per-commit table. The changelog PR branch is created from origin/main, and the bot never opens a second changelog PR while one is still open. A PR that introduces a brand-new gh-aw workflow cannot be exercised via a pull_request trigger before merge: gh-aw's activation job resolves the workflow file from the base branch (main), where it does not exist yet. The temporary synchronize trigger used to attempt that has been removed, along with the empty test commit. The workflow will run on schedule and via workflow_dispatch after merge. Post-merge end-to-end verification passed on landscape-server: the changelog bot ran cleanly on OpenRouter/deepseek in run 43938834931 (https://github.com/canonical/landscape-server/actions/runs/43938834931), opening a correctly scoped release PR. The temporary pull_request: synchronize trigger used during that test has been reverted there; the workflow now runs on schedule and via workflow_dispatch only, matching the configuration in this PR. Review fixes in f7107cf address Perfect5th review items: sha256 checksum verification for the Docker Compose download and actions/setup-node bumped from v4 to v7. ## Latest verification (2026-11-18) Run [44280915893](https://github.com/canonical/landscape-server/actions/runs/44280915893) on landscape-server, on OpenRouter/deepseek with threat detection on the pinned Copilot model. It opened release PR #1890 with exactly the three expected files (standalone/debian/changelog, pyproject.toml, uv.lock) after the previous changelog PR was closed, so the dedup and create paths are both exercised. The documentation push failed in safe_outputs: the shared component checked out the docs repo's default branch, but the release-notes page exists only on the shared draft PR's branch, so the resulting create-file patch could not be applied. That is fixed in canonical/landscape-internal-docs#394 (merged), and this PR now pins the component to that merge commit d627562c, so the docs push uses the shared draft PR's branch. The earlier run cited above (43938834931) predates the shared-component import and the pull-requests: read grant. Stacked on #467 (OpenSpec store reference). The shared OpenSpec skills live in the landscape-home repo, not here.


The documented
openrouter/anthropic/claude-sonnet-4configuration was rejected because MAF prohibited slashes within model tokens. The native OpenRouter credential mapping also obscured the explicit route required for sandboxed execution.Credential-isolation requirements remain unchanged.