-
Notifications
You must be signed in to change notification settings - Fork 13.6k
bug(ci): SDK tests not run in PR CI; nightly broken by incorrect mock in session.test.ts #24999
Copy link
Copy link
Open
Open
Copy link
Labels
area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent QualityIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualityarea/platformIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmtIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmtkind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triagedtype/bug🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
Metadata
Metadata
Assignees
Labels
area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent QualityIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualityarea/platformIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmtIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmtkind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triagedtype/bug🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
Status
No status
What happened?
The nightly release workflow (run #24165914961) fails with 6 test failures in
packages/sdk/src/session.test.ts. All 6 failures are in theGeminiCliSession sendStream()describe block with:Root cause has two parts:
1. Incorrect mock in
session.test.ts(PR #21897)The test file (added in #21897, commit
1023c5b7a) mocksConfigwithgetGeminiClient()as a method:But
session.tsaccesses the client via theAgentLoopContextproperty getter (migrated in #22115):Since the mock has no
geminiClientproperty,this.clientremainsundefined, crashing allsendStream()tests.2.
@google/gemini-cli-sdkis missing from PR CI test matrixThe CI workflow (
.github/workflows/ci.yml) explicitly lists workspaces per shard:clishard:@google/gemini-cliothersshard:@google/gemini-cli-core,@google/gemini-cli-a2a-server,gemini-cli-vscode-ide-companion,@google/gemini-cli-test-utils@google/gemini-cli-sdkis not included in either shard, so its tests never run during PR checks. The nightly release usesnpm run test:ci --workspaces --if-present(all workspaces), which is why it caught the failure.What did you expect to happen?
AgentLoopContextinterface (usinggeminiClientproperty instead ofgetGeminiClient()method).@google/gemini-cli-sdkshould be included in theothersshard ofci.ymlso SDK tests are run during PR checks.Client information
Client Information
N/A — this is a CI infrastructure issue, not a runtime bug.
Anything else we need to know?
Failed tests (all in
packages/sdk/src/session.test.ts):GeminiCliSession sendStream() > auto-initializes if not yet initializedGeminiCliSession sendStream() > completes cleanly when model returns no tool callsGeminiCliSession sendStream() > accepts an AbortSignal without throwingGeminiCliSession sendStream() > executes tool call loop and sends function response back to modelGeminiCliSession sendStream() > calls setUserMemory and updateSystemInstruction when instructions is a functionGeminiCliSession sendStream() > does not call setUserMemory when instructions is a stringSuggested fix:
session.test.ts, change the mock to usegeminiClient: mockClient(property) and similarly fixtoolRegistry,messageBusto matchAgentLoopContext..github/workflows/ci.yml, add--workspace "@google/gemini-cli-sdk"to theothersshard (lines 181, 269, 436).