Skip to content

Fix issue where config was undefined.#22397

Merged
gundermanc merged 1 commit intomainfrom
gundermanc/fix-bug
Mar 14, 2026
Merged

Fix issue where config was undefined.#22397
gundermanc merged 1 commit intomainfrom
gundermanc/fix-bug

Conversation

@gundermanc
Copy link
Member

Summary

Fixes an issue introduced by #22115 which caused the config property to be undefined.

The bulk of the change is correct however it fell afoul of a usage of Object.create() which performs an unsafe replication of the underlying type with only a subset of the properties declared on the type.

Going forward we should take care to never introduce code that creates objects that are inconsistent with their typings. I will follow up with additional PRs to disallow this.

@gundermanc gundermanc requested a review from a team as a code owner March 14, 2026 01:18
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug where the 'config' property within the 'AgentLoopContext' was not being properly initialized, leading to it being 'undefined' at runtime. The root cause was an incorrect usage of 'Object.create()' which failed to replicate all necessary properties from the underlying type. The changes ensure that the 'AgentLoopContext' is now explicitly constructed with all its required properties, including the 'config' object, thereby enhancing the stability and type safety of the agent scheduling mechanism. A new test has been added to prevent future regressions of this issue.

Highlights

  • Resolved Undefined Config: Fixed an issue where the 'config' property within the AgentLoopContext was 'undefined' due to an unsafe 'Object.create()' usage, which failed to replicate all necessary properties.
  • Refactored Context Creation: Modified 'agent-scheduler.ts' to explicitly construct the 'schedulerContext' object, ensuring all properties, including 'config', 'promptId', 'messageBus', 'geminiClient', and 'sandboxManager', are correctly initialized.
  • Updated ToolExecutor Instantiation: Adjusted 'coreToolScheduler.ts' to pass the entire 'AgentLoopContext' object to the 'ToolExecutor' constructor, aligning with the corrected context structure.
  • Added Regression Test: Introduced a new test case in 'agent-scheduler.test.ts' to verify that the 'AgentLoopContext' correctly contains a defined 'config' property and other expected values.
Changelog
  • packages/core/src/agents/agent-scheduler.test.ts
    • Added a new test case to assert that the AgentLoopContext has a defined 'config' property and correctly carries 'promptId' and 'toolRegistry'.
  • packages/core/src/agents/agent-scheduler.ts
    • Replaced the 'Object.create()' based context creation with an explicit object literal, ensuring all necessary properties like 'config', 'promptId', 'toolRegistry', 'messageBus', 'geminiClient', and 'sandboxManager' are present.
    • Updated the 'Scheduler' instantiation to use the newly constructed 'schedulerContext'.
  • packages/core/src/core/coreToolScheduler.ts
    • Modified the 'ToolExecutor' constructor call to pass the full 'this.context' object instead of 'this.context.config', reflecting the updated AgentLoopContext structure.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves a critical issue where the config property was undefined, causing runtime errors due to passing a Config object where an AgentLoopContext was expected. The fix involves creating a proper AgentLoopContext in agent-scheduler.ts and ensuring ToolExecutor is instantiated with the correct context in coreToolScheduler.ts. A new test case was added to prevent regressions. A thorough security audit was conducted, and no high or critical severity security vulnerabilities were identified in the modified code.

@github-actions
Copy link

Size Change: +227 B (0%)

Total Size: 26.1 MB

Filename Size Change
./bundle/chunk-IX7UT4XO.js 0 B -13.4 MB (removed) 🏆
./bundle/chunk-S363URX6.js 0 B -3.62 MB (removed) 🏆
./bundle/core-BITOVHVD.js 0 B -40.3 kB (removed) 🏆
./bundle/devtoolsService-XNHSIYXL.js 0 B -27.7 kB (removed) 🏆
./bundle/interactiveCli-GJYFQR3H.js 0 B -1.59 MB (removed) 🏆
./bundle/oauth2-provider-QE7XPRTD.js 0 B -9.19 kB (removed) 🏆
./bundle/chunk-WRPTJ6Q3.js 13.4 MB +13.4 MB (new file) 🆕
./bundle/chunk-YGKDOQHS.js 3.62 MB +3.62 MB (new file) 🆕
./bundle/core-4DXZ5536.js 40.3 kB +40.3 kB (new file) 🆕
./bundle/devtoolsService-DCNGDYFB.js 27.7 kB +27.7 kB (new file) 🆕
./bundle/interactiveCli-3JEOW27Q.js 1.59 MB +1.59 MB (new file) 🆕
./bundle/oauth2-provider-VRO4YB7U.js 9.19 kB +9.19 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./bundle/chunk-34MYV7JD.js 2.45 kB
./bundle/chunk-37ZTTFQF.js 966 kB
./bundle/chunk-5AUYMPVF.js 858 B
./bundle/chunk-664ZODQF.js 124 kB
./bundle/chunk-BXZA3XKQ.js 1.95 MB
./bundle/chunk-DAHVX5MI.js 206 kB
./bundle/chunk-IUUIT4SU.js 56.5 kB
./bundle/chunk-RJTRUG2J.js 39.8 kB
./bundle/devtools-36NN55EP.js 696 kB
./bundle/dist-T73EYRDX.js 356 B
./bundle/gemini.js 695 kB
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB
./bundle/memoryDiscovery-ZBBGU3A2.js 922 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB
./bundle/src-QVCVGIUX.js 47 kB
./bundle/tree-sitter-7U6MW5PS.js 274 kB
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB
./bundle/undici-4X2YZID5.js 360 B

compressed-size-action

@gundermanc gundermanc added this pull request to the merge queue Mar 14, 2026
Merged via the queue into main with commit 64c50d3 Mar 14, 2026
30 checks passed
@gundermanc gundermanc deleted the gundermanc/fix-bug branch March 14, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants