Conversation
…SDK (#2917) Add power_steering_sdk.py that auto-detects the active launcher (Claude Code or GitHub Copilot CLI) via LauncherDetector and routes LLM queries to the correct SDK. One code path, two backends. - New: power_steering_sdk.py with query_llm(prompt, project_root) -> str - Refactored: claude_power_steering.py — replaced 5 identical 12-line SDK call blocks with single-line query_llm() calls (-228 lines) - Auto-detection: uses existing LauncherDetector from adaptive context - Fail-open: returns "" if neither SDK available (heuristic fallback) - Both SDKs support sessions for future optimization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
🤖 Auto-fixed version bump The version in If you need a minor or major version bump instead, please update |
Contributor
Repo Guardian - PassedAll changed files in this PR are legitimate project code:
No ephemeral content detected.
|
…fecycle (#2917) CopilotClient methods are async coroutines, not sync. Fixed _query_copilot to await start/create_session/send_and_wait/stop. Extract response text from event.data.content. Verified against real Copilot SDK (hit version mismatch on server but API calls resolved correctly). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rysweet
pushed a commit
that referenced
this pull request
Mar 7, 2026
…ing unit tests PR #2918 replaced `from claude_agent_sdk import query` with `from power_steering_sdk import query_llm`, removing `query` as a module-level attribute from `claude_power_steering`. This broke two test files that patched the now-removed attribute. Fixes: - test_power_steering_shutdown.py: remove stale @patch("claude_power_steering.query") decorator and unused mock_query param from test_no_timing_regression (test only calls is_shutting_down() which needs no SDK mock) - test_issue_1872_bug_fixes.py: update 8 tests to patch `claude_power_steering.query_llm` (AsyncMock returning str) instead of the removed `claude_power_steering.query` (generator yielding MockMessage) Bug fixes: - power_steering_sdk.py (both copies): fix _detector_cache type annotation from `object | None` to `str | None` and remove the # type: ignore[return-value] comment that worked around the self-inflicted mismatch New tests: - tests/test_power_steering_sdk.py: 21 mock-based unit tests covering _query_copilot async lifecycle (start/create_session/send_and_wait/stop), event.data.content text extraction, query_llm routing to Copilot/Claude, fallback behavior, SDK_AVAILABLE flag, and _query_claude text extraction All 68 tests across test_power_steering_sdk, test_sdk_integration, test_copilot_e2e_power_steering, and test_power_steering_shutdown pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rysweet
added a commit
that referenced
this pull request
Mar 7, 2026
…ing unit tests (#2920) PR #2918 replaced `from claude_agent_sdk import query` with `from power_steering_sdk import query_llm`, removing `query` as a module-level attribute from `claude_power_steering`. This broke two test files that patched the now-removed attribute. Fixes: - test_power_steering_shutdown.py: remove stale @patch("claude_power_steering.query") decorator and unused mock_query param from test_no_timing_regression (test only calls is_shutting_down() which needs no SDK mock) - test_issue_1872_bug_fixes.py: update 8 tests to patch `claude_power_steering.query_llm` (AsyncMock returning str) instead of the removed `claude_power_steering.query` (generator yielding MockMessage) Bug fixes: - power_steering_sdk.py (both copies): fix _detector_cache type annotation from `object | None` to `str | None` and remove the # type: ignore[return-value] comment that worked around the self-inflicted mismatch New tests: - tests/test_power_steering_sdk.py: 21 mock-based unit tests covering _query_copilot async lifecycle (start/create_session/send_and_wait/stop), event.data.content text extraction, query_llm routing to Copilot/Claude, fallback behavior, SDK_AVAILABLE flag, and _query_claude text extraction All 68 tests across test_power_steering_sdk, test_sdk_integration, test_copilot_e2e_power_steering, and test_power_steering_shutdown pass. Co-authored-by: Ubuntu <azureuser@deva.ftnmxvem3frujn3lepas045p5c.xx.internal.cloudapp.net> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
power_steering_sdk.py: thin abstraction that auto-detects launcher and routes to Claude Agent SDK or Copilot SDKclaude_power_steering.py: 5 identical 12-line SDK call blocks → 5 one-linequery_llm()calls (-228 lines)Problem
Power-steering hard-codes the Claude Agent SDK. Users running
gh copilotcan't use power-steering because they don't have the Claude SDK.Solution
query_llm(prompt, project_root)— one function, auto-selects backend:LauncherDetector(reads.claude/runtime/launcher_context.json)_query_claude()or_query_copilot()""if neither SDK available (existing heuristic fallback kicks in)Test plan
gh copilotwith Copilot SDK🤖 Generated with Claude Code