Skip to content

refactor(github-copilot): narrow runtime facade - #120544

Merged
steipete merged 2 commits into
mainfrom
worktree-agent-a01547d00e306998d
Aug 8, 2026
Merged

steipete merged 2 commits into
mainfrom
worktree-agent-a01547d00e306998d

Conversation

@steipete

@steipete steipete commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves an internal maintenance problem where the GitHub Copilot plugin's lazy runtime facade exposed eight symbols that no production consumer loads through that boundary. The broad barrel also made unrelated auth, login, model, and stream ownership look coupled, while tests mocked and asserted a login command that the plugin entrypoint never imported from the runtime facade.

Why This Change Was Made

The runtime facade now directly exports only the four symbols loaded by index.ts and dynamic-models.ts: the default API base URL, runtime auth resolver, starter-model resolver, and usage fetcher. The eight unused re-exports and their static imports are removed, along with five stale login-command mock/assertion lines. The deprecated login facade remains owned by api.ts; removing that separate compatibility surface was explicitly rejected as out of scope.

This is an AI-assisted change from authorized repair sweep task #8.

User Impact

No user-visible behavior changes. The plugin keeps the same auth, discovery, usage, and stream behavior with a smaller, more accurate lazy runtime boundary.

Production LOC: +4/-25, net -21. Test LOC: +0/-5, net -5.

Evidence

  • Full-tree consumer/export scan confirmed production destructures only the four retained runtime symbols; removed symbols continue through their direct owner modules.
  • Private package and SDK-facade inspection confirmed the legacy login command loads api.js, not register.runtime.js.
  • Open-PR overlap check found no PR touching register.runtime.ts; three PRs touching index.test.ts modify unrelated thinking/replay cases.
  • node scripts/run-vitest.mjs extensions/github-copilot/index.test.ts extensions/github-copilot/provider-discovery.contract.test.ts extensions/github-copilot/stream.test.ts — 3 files, 60 tests passed on the corrected checkout.
  • git diff --check — passed.
  • Remote repository-wide pnpm format:check and pnpm build — AWS Crabbox run run_b2dda8e91f77, exit 0.
  • Mandatory complete-branch autoreview — no accepted/actionable findings.
  • Separate read-only exact-head review — no actionable findings; judged the owner-boundary cleanup behavior-neutral and best-fit.
  • Exact reviewed head: b4dd9596a3f386bec06ac163098990923cc4f892.

Exact-head CI and ClawSweeper state will be verified before landing.

@steipete
steipete marked this pull request as ready for review August 8, 2026 08:56
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 8, 2026
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 8, 2026
@clawsweeper

clawsweeper Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 5:42 AM ET / 09:42 UTC.

ClawSweeper review

What this changes

This PR reduces the GitHub Copilot plugin’s lazy runtime facade to the four runtime helpers its entry points actually load, and removes stale login-command test mocks.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This maintainer-authored cleanup correctly makes the private lazy facade match its two production consumers; no correctness or security finding was identified.

Priority: P3
Reviewed head: b4dd9596a3f386bec06ac163098990923cc4f892

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, source-verified cleanup with focused validation reported in the PR body and no identified patch defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored, behavior-neutral internal refactor, so the external-contributor real-behavior-proof gate does not apply.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored, behavior-neutral internal refactor, so the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 5 items Exact-head facade and consumers: The PR head exports exactly the four values destructured by the two lazy consumers; other former exports remain direct imports from their owner modules.
Entrypoint ownership: The plugin entry loads the facade dynamically only for starter-model resolution, runtime auth, and usage; stream and auth-store helpers are imported directly.
Login public surface remains intact: The public login facade exports from api.ts, while the SDK login helper targets api.js rather than register.runtime.js.
Findings None None.
Security None None.

How this fits together

The GitHub Copilot plugin loads a small runtime facade only when authentication, starter-model selection, dynamic discovery, or usage reporting needs it. Login, stream wrapping, and model fallback behavior are owned by direct plugin modules outside that lazy boundary.

flowchart LR
  A[Plugin entry] --> B[Lazy runtime facade]
  A --> C[Direct auth and stream owners]
  D[Dynamic model discovery] --> B
  B --> E[Runtime authentication]
  B --> F[Starter model and usage]
  C --> G[Provider registration]
  E --> G
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Several exact-head CI checks are still in progress; retain normal merge gates before landing.
  • Complete next step (P2) - No repair lane is needed: the branch is already the narrow owner-boundary cleanup, pending ordinary exact-head merge gates.
Agent review details

Security

None.

PR surface

Source -21, Tests -5. Total -26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 25 -21
Tests 1 0 5 -5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 4 30 -26

Review metrics

Metric Value Why it matters
Production versus test LOC production +4/-25; tests +0/-5 The refactor is net-negative and removes stale runtime coupling plus obsolete test assertions.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the runtime facade private and limited to the four actual lazy-load dependencies, with login, stream, auth-store, and model fallback behavior continuing through their direct owners.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the runtime facade private and limited to the four actual lazy-load dependencies, with login, stream, auth-store, and model fallback behavior continuing through their direct owners.

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

Not applicable: this is an internal facade-boundary cleanup, not a reported user failure.

Is this the best way to solve the issue?

Yes. The facade now contains precisely the dynamically consumed runtime contract; retaining the other re-exports would preserve misleading coupling, while moving them into a public API would broaden the contract unnecessarily.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small, behavior-neutral internal cleanup in an optional provider plugin.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored, behavior-neutral internal refactor, so the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P3: This is a small, behavior-neutral internal cleanup in an optional provider plugin.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored, behavior-neutral internal refactor, so the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Git history and blame attribute the original facade, entry point, dynamic-model loader, and login facade to Peter Steinberger; this PR continues that owner-boundary work. (role: feature introducer and recent area contributor; confidence: high; commits: fa9626c4e100, 26c4b0b95307, b4dd9596a3f3; files: extensions/github-copilot/register.runtime.ts, extensions/github-copilot/index.ts, extensions/github-copilot/dynamic-models.ts)

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

steipete commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head b4dd9596a3f386bec06ac163098990923cc4f892:

  • node scripts/run-vitest.mjs extensions/github-copilot/index.test.ts extensions/github-copilot/provider-discovery.contract.test.ts extensions/github-copilot/stream.test.ts — 3 files, 60/60 tests passed; git diff --check passed.
  • Remote repository-wide pnpm format:check and pnpm build — run run_b2dda8e91f77, exit 0.
  • Exact-head CI run 31250906036 is green.
  • Complete-branch autoreview and separate exact-head read-only review are clean.
  • ClawSweeper reviewed this exact head with no correctness/security findings. Its two Before merge items are resolved: exact-head CI is green, and its own review says no repair lane is needed. No Rank-up moves were listed.

@steipete
steipete merged commit 10c7f00 into main Aug 8, 2026
98 checks passed
@steipete
steipete deleted the worktree-agent-a01547d00e306998d branch August 8, 2026 09:56
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 9, 2026
* refactor(github-copilot): narrow runtime facade

* style(github-copilot): format runtime exports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: github-copilot maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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