Skip to content

fix(github-copilot): treat whitespace-only enterprise scope as invalid - #160171

Merged
steipete merged 1 commit into
mainfrom
fix/r97-forward-11
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/r97-forward-11

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

GitHub Copilot credentials with a whitespace-only enterpriseUrl cannot be formatted (the OAuth formatter rejects them), but routing-scope normalization trimmed the value and returned the public scope. OAuth ownership, copy and adoption checks therefore treated an unformattable whitespace-only credential as the same tenant as a public one.

This correction was made on the abandoned release/2026.9.7 branch (3d0390e, on top of #139131) and never reached main; this forward-ports it before that branch is deleted.

Summary

  • normalizeGithubCopilotOAuthScope keeps absent/empty metadata as public scope but returns no scope for whitespace-only metadata, matching the formatter.
  • Regression cases in extensions/github-copilot/oauth.test.ts and src/agents/auth-profiles/oauth.copilot-ownership.test.ts.

Evidence

  • Both whitespace regressions failed on unchanged main (expected true to be false); 59 tests passed across four files after the fix.
  • pnpm check:changed: guards and core test typechecks passed locally before the host-load time budget stopped it during extension typechecking; remaining lanes are on this PR's CI.
  • Autoreview (branch mode): scoped-clean.

Forward-port the normalization correction from 3d0390e. Preserve absent and empty public metadata while refusing whitespace-only scope for copy, adoption, and ownership.

WIP: reproduced two failing regression cases before the fix; 59 focused tests pass afterward. check:changed remains incomplete at the work-order time budget; branch autoreview and publication remain pending.

Co-authored-by: Patrick Erichsen <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 1:47 AM ET / 05:47 UTC.

ClawSweeper review

What this changes

The branch rejects whitespace-only Copilot tenant metadata in credential-sharing scope checks and adds formatter, copy, adoption, and ownership regression cases.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still misclassifies whitespace-only Copilot tenant metadata as public for credential sharing. The merged tenant-custody work does not cover this edge case, so this PR remains useful.

Priority: P2
Reviewed head: a1158eef65e28c37cae42141f4e2f189dd4453bf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a coherent, source-backed repair with focused regression coverage and no identified code defect; test-cost reporting remains.
Proof confidence 🌊 off-meta tidepool Not applicable: The provider normalizer feeds the production copy, adoption, and persisted-owner gates; the PR adds whitespace-specific gate cases and reports focused red/green tests. The supplied MEMBER authorship makes ordinary contributor setup proof inapplicable. No serialized credential shape or writer changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The provider normalizer feeds the production copy, adoption, and persisted-owner gates; the PR adds whitespace-specific gate cases and reports focused red/green tests. The supplied MEMBER authorship makes ordinary contributor setup proof inapplicable. No serialized credential shape or writer changes.
Evidence reviewed 8 items Current-main defect: At the pinned main revision, trimming whitespace-only metadata takes the public-scope branch.
Formatter contract: The existing formatter rejects a nonempty whitespace-only enterprise value, establishing the mismatch with scope normalization.
Credential-sharing boundary: Core identity comparison calls the provider-owned normalizer and rejects undefined scope before accepting a copy or adoption.
Findings None None.
Security None None.

How this fits together

The GitHub Copilot plugin interprets tenant metadata stored with OAuth credentials. Agent authentication uses that scope to decide whether credentials may be copied, adopted, or treated as shared.

flowchart LR
A[Stored Copilot credential] --> B[Provider scope normalization]
B --> C{Supported tenant scope?}
C -- Yes --> D[Credential identity checks]
D --> E[Copy, adopt, or share]
C -- No --> F[Keep credential separate]
Loading

Before merge

  • Resolve merge risk (P1) - The PR body omits the required one-worker wall time for each materially changed test file; CI seconds should be added when available.
  • Complete next step (P2) - Add one-worker wall times for both changed test files to the PR body, and CI seconds when available.
Agent review details

Security

None.

PR surface

Source +4, Tests +53. Total +57 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 2 59 6 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 65 8 +57

Review metrics

Metric Value Why it matters
Production and test growth production +4 net, tests +53 net Production growth is confined to the scope guard; the test growth covers the affected credential decisions.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep tenant interpretation with the Copilot plugin so malformed stored metadata cannot borrow a public credential, while absent and empty metadata retain public behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep tenant interpretation with the Copilot plugin so malformed stored metadata cannot borrow a public credential, while absent and empty metadata retain public behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, from current-main source: whitespace-only metadata normalizes to public even though credential formatting rejects it. The PR reports failing baseline regressions; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. Changing the provider-owned normalizer is the narrowest repair for the shared copy, adoption, and ownership gates.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1ca6a5d0a801.

Labels

Label changes:

  • add P2: This is a bounded malformed-credential sharing defect with no demonstrated active outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The provider normalizer feeds the production copy, adoption, and persisted-owner gates; the PR adds whitespace-specific gate cases and reports focused red/green tests. The supplied MEMBER authorship makes ordinary contributor setup proof inapplicable. No serialized credential shape or writer changes.

Label justifications:

  • P2: This is a bounded malformed-credential sharing defect with no demonstrated active outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The provider normalizer feeds the production copy, adoption, and persisted-owner gates; the PR adds whitespace-specific gate cases and reports focused red/green tests. The supplied MEMBER authorship makes ordinary contributor setup proof inapplicable. No serialized credential shape or writer changes.

Evidence

What I checked:

Likely related people:

  • VasuBansal7576: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Test cost (ClawSweeper P1/P2 item): --maxWorkers=1 wall: extensions/github-copilot/oauth.test.ts 11 tests, 10 s (Vitest 2.2 s); src/agents/auth-profiles/oauth.copilot-ownership.test.ts 6 tests, 5 s (Vitest 1.7 s).

@steipete
steipete merged commit 1f54850 into main Sep 28, 2026
114 of 115 checks passed
@steipete
steipete deleted the fix/r97-forward-11 branch September 28, 2026 06:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
Whitespace-only Copilot enterpriseUrl metadata cannot be formatted, so routing-scope normalization now treats it as invalid instead of public; ownership, copy and adoption no longer match it to a public-scope credential.

Forward-port of release/2026.9.7 3d0390e (normalization correction on openclaw#139131).

Co-authored-by: Patrick Erichsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: github-copilot P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant