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 the GeminiCliSession sendStream() describe block with:
TypeError: Cannot read properties of undefined (reading 'sendMessageStream')
❯ GeminiCliSession.sendStream src/session.ts:206:29
Root cause has two parts:
1. Incorrect mock in session.test.ts (PR #21897)
The test file (added in #21897, commit 1023c5b7a) mocks Config with getGeminiClient() as a method:
getGeminiClient: vi.fn().mockReturnValue(mockClient),
But session.ts accesses the client via the AgentLoopContext property getter (migrated in #22115):
const loopContext2: AgentLoopContext = this.config;
this.client = loopContext2.geminiClient; // property, not method
Since the mock has no geminiClient property, this.client remains undefined, crashing all sendStream() tests.
2. @google/gemini-cli-sdk is missing from PR CI test matrix
The CI workflow (.github/workflows/ci.yml) explicitly lists workspaces per shard:
cli shard: @google/gemini-cli
others shard: @google/gemini-cli-core, @google/gemini-cli-a2a-server, gemini-cli-vscode-ide-companion, @google/gemini-cli-test-utils
@google/gemini-cli-sdk is not included in either shard, so its tests never run during PR checks. The nightly release uses npm run test:ci --workspaces --if-present (all workspaces), which is why it caught the failure.
What did you expect to happen?
- The SDK test mock should correctly match the
AgentLoopContext interface (using geminiClient property instead of getGeminiClient() method).
@google/gemini-cli-sdk should be included in the others shard of ci.yml so 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 initialized
GeminiCliSession sendStream() > completes cleanly when model returns no tool calls
GeminiCliSession sendStream() > accepts an AbortSignal without throwing
GeminiCliSession sendStream() > executes tool call loop and sends function response back to model
GeminiCliSession sendStream() > calls setUserMemory and updateSystemInstruction when instructions is a function
GeminiCliSession sendStream() > does not call setUserMemory when instructions is a string
Suggested fix:
- In
session.test.ts, change the mock to use geminiClient: mockClient (property) and similarly fix toolRegistry, messageBus to match AgentLoopContext.
- In
.github/workflows/ci.yml, add --workspace "@google/gemini-cli-sdk" to the others shard (lines 181, 269, 436).
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).