Skip to content

feat(goose): implement agent configuration for workspace preparation#2192

Open
bmahabirbu wants to merge 2 commits into
openkaiden:mainfrom
bmahabirbu:worktree-extend-goose
Open

feat(goose): implement agent configuration for workspace preparation#2192
bmahabirbu wants to merge 2 commits into
openkaiden:mainfrom
bmahabirbu:worktree-extend-goose

Conversation

@bmahabirbu

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the configurationFiles and preWorkspaceStart stubs with a real implementation that writes GOOSE_MODEL into .goose/config.yaml from the workspace context, preserving existing configuration fields.

Fixes #2174

Test plan

  • Unit tests pass (9/9)
  • Verify model label is correctly written to config.yaml
  • Verify existing config fields are preserved when updating

🤖 Generated with Claude Code

@bmahabirbu bmahabirbu requested a review from a team as a code owner June 17, 2026 06:21
@bmahabirbu bmahabirbu requested review from fbricon and gastoner and removed request for a team June 17, 2026 06:21
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e804bcdd-639b-40af-b46b-9026a1a39ea2

📥 Commits

Reviewing files that changed from the base of the PR and between 0fb7be9 and af81505.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • extensions/goose/package.json
  • extensions/goose/src/extension.spec.ts
  • extensions/goose/src/extension.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: Windows
🧰 Additional context used
📓 Path-based instructions (5)
extensions/*/package.json

📄 CodeRabbit inference engine (AGENTS.md)

extensions/*/package.json: Extensions must declare engines.kaiden version compatibility in their package.json
Extension package.json must have main field pointing to ./dist/extension.js
Configuration properties for API keys, tokens, or secrets must use "format": "password" in the configuration definition to ensure input masking in the UI

Files:

  • extensions/goose/package.json
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use /@/ path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
extensions/*/src/extension.ts

📄 CodeRabbit inference engine (AGENTS.md)

Extensions should export a standard activation API from their entry point

Files:

  • extensions/goose/src/extension.ts
extensions/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Register inference, container, and Kubernetes providers through the ProviderRegistry via extension APIs

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
**/*.spec.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.{ts,tsx,js,jsx}: Use test() instead of it() for test cases in Vitest unit tests
Use vi.mock(import('...')) for auto-mocking modules in unit tests; avoid manual mock factories when possible
Use vi.resetAllMocks() in beforeEach hooks instead of vi.clearAllMocks() for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, use vi.mocked(...) with the prototype pattern for class methods: vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)

Files:

  • extensions/goose/src/extension.spec.ts
🧠 Learnings (7)
📚 Learning: 2026-05-06T11:29:33.170Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/package.json:9-11
Timestamp: 2026-05-06T11:29:33.170Z
Learning: In the openkaiden/kaiden repo, all built-in extensions under extensions/ should specify engines with kaiden: "^0.0.1" in package.json. Do not flag each extension individually; enforce a repo-wide alignment in a single PR. During reviews, verify that every extensions/*/package.json has "engines": { "kaiden": "^0.0.1" }. If a file deviates, surface the discrepancy as a single repo-wide task rather than per-file.

Applied to files:

  • extensions/goose/package.json
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-06T11:15:56.238Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/extension.spec.ts:43-51
Timestamp: 2026-05-06T11:15:56.238Z
Learning: In all extensions under extensions/*/src/extension.ts, deactivate() should only clear the module-level instance reference (e.g., set the instance to undefined) and must not call dispose() directly. The dispose() method is invoked by the extension host when processing extensionContext.subscriptions. Do not suggest asserting dispose() in tests for deactivate(); such assertions are unnecessary because disposal is handled by the host and CI checks should validate subscriptions handling instead.

Applied to files:

  • extensions/goose/src/extension.ts
📚 Learning: 2026-06-18T08:20:05.553Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2185
File: extensions/gemini/src/extension.ts:45-52
Timestamp: 2026-06-18T08:20:05.553Z
Learning: When reviewing openkaiden/kaiden extension code that registers `configurationFiles` via `agents.registerAgent()` (typically in `extensions/*/src/extension.ts`), do not flag an intentionally stub `read()` (e.g., returning `'{}'`) as causing data loss or as a missing file-I/O implementation. Per the framework, runtime behavior uses the declared `path` and the real, file-backed `read()`/`update()` implementations are supplied through `context.configurationFiles` during `preWorkspaceStart`.

Applied to files:

  • extensions/goose/src/extension.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
🔇 Additional comments (4)
extensions/goose/src/extension.spec.ts (2)

87-94: createContext still omits required workspace on AgentWorkspaceContext.

The returned mock object is missing workspace, which is required by the AgentWorkspaceContext contract.

Suggested fix
     function createContext(configFiles: AgentConfigurationFile[], modelLabel = 'gpt-4o'): AgentWorkspaceContext {
       return {
         model: {
           model: { label: modelLabel },
         },
         configurationFiles: configFiles,
+        workspace: {} as AgentWorkspaceContext['workspace'],
       };
     }

19-23: LGTM!

Also applies to: 78-84, 96-168

extensions/goose/src/extension.ts (1)

19-42: LGTM!

Also applies to: 55-77

extensions/goose/package.json (1)

26-27: LGTM!


📝 Walkthrough

Walkthrough

Adds an exported GOOSE_CONFIG_PATH constant (.goose/config.yaml), introduces a YAML parser helper to update the GOOSE_MODEL field while preserving other config structure, registers a configurationFiles entry on the Goose agent, and implements preWorkspaceStart to read the config, update it via the helper with the active model label, and persist it back. Tests cover all scenarios including field preservation and edge cases.

Changes

Goose Config File and preWorkspaceStart Hook

Layer / File(s) Summary
GOOSE_CONFIG_PATH constant, updateGooseModelConfig helper, and yaml dependency
extensions/goose/src/extension.ts, extensions/goose/package.json
Exports GOOSE_CONFIG_PATH = '.goose/config.yaml' and implements updateGooseModelConfig(content, modelLabel) to parse YAML into a mapping, set GOOSE_MODEL to the label, validate structure, throw on errors or non-mapping configs, and return YAML text with a guaranteed trailing newline. Adds yaml package (^2.8.2) dependency to enable YAML parsing.
Agent configurationFiles registration and preWorkspaceStart implementation
extensions/goose/src/extension.ts
Registers a configurationFiles entry for GOOSE_CONFIG_PATH with a stub read() returning an empty string. Implements preWorkspaceStart(context) to locate the config file, read its contents, rewrite via updateGooseModelConfig with context.model.model.label, and persist changes via configFile.update().
Tests for configurationFiles and preWorkspaceStart
extensions/goose/src/extension.spec.ts
Adds imports for AgentConfigurationFile, AgentWorkspaceContext, and GOOSE_CONFIG_PATH. Asserts the agent declares exactly one configurationFiles entry with path === GOOSE_CONFIG_PATH. Tests preWorkspaceStart for empty config, overwriting existing model values, preserving unrelated YAML fields and comments, and no-op when the config file is absent from workspace context.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • openkaiden/kaiden#1958: The main PR builds on the initial Goose agent registration by extending it to export GOOSE_CONFIG_PATH, register a configurationFiles entry, and add a preWorkspaceStart hook.
  • openkaiden/kaiden#2168: Both PRs introduce/consume the new configurationFiles and preWorkspaceStart(AgentWorkspaceContext) agent lifecycle wiring, with the retrieved PR adding the scaffold and the main PR implementing Goose's concrete logic.
  • openkaiden/kaiden#2185: Both PRs implement the same workspace-prep pattern: exporting a config path constant, registering a configurationFiles entry, and implementing preWorkspaceStart to overwrite the model field with the workspace model label.

Suggested reviewers

  • benoitf
  • fbricon
  • jeffmaury
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: implementing agent configuration for workspace preparation, which is the core objective of this PR.
Description check ✅ Passed The description is clearly related to the changeset, explaining the implementation of configurationFiles and preWorkspaceStart with GOOSE_MODEL handling.
Linked Issues check ✅ Passed The PR implements the requested agent configuration API from issue #2174, with configurationFiles registration and preWorkspaceStart hook that writes GOOSE_MODEL to .goose/config.yaml while preserving existing fields.
Out of Scope Changes check ✅ Passed All changes directly support the stated objective: yaml dependency addition for YAML parsing, GOOSE_CONFIG_PATH export, updateGooseModelConfig helper, preWorkspaceStart implementation, and comprehensive test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bmahabirbu bmahabirbu force-pushed the worktree-extend-goose branch from ff4e136 to bc0b280 Compare June 17, 2026 06:25

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@extensions/goose/src/extension.ts`:
- Around line 56-57: The filter condition in the split operation only removes
lines that start with 'GOOSE_MODEL:' at column 0, but it fails to remove entries
that have leading whitespace (like indented YAML keys). Modify the filter to
trim each line before checking if it starts with 'GOOSE_MODEL:' so that both
`GOOSE_MODEL:` and `  GOOSE_MODEL:` entries are properly removed before
appending the new value. This prevents duplicate YAML keys in the config file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01dfb65c-d9ed-4cf4-b625-ba614e4eb913

📥 Commits

Reviewing files that changed from the base of the PR and between 17f4b1b and ff4e136.

📒 Files selected for processing (2)
  • extensions/goose/src/extension.spec.ts
  • extensions/goose/src/extension.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: macOS
  • GitHub Check: typecheck
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: Linux
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: Windows
  • GitHub Check: unit tests / macos-15
  • GitHub Check: linter, formatters
  • GitHub Check: unit tests / windows-2022
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use /@/ path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
extensions/*/src/extension.ts

📄 CodeRabbit inference engine (AGENTS.md)

Extensions should export a standard activation API from their entry point

Files:

  • extensions/goose/src/extension.ts
extensions/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Register inference, container, and Kubernetes providers through the ProviderRegistry via extension APIs

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
**/*.spec.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.{ts,tsx,js,jsx}: Use test() instead of it() for test cases in Vitest unit tests
Use vi.mock(import('...')) for auto-mocking modules in unit tests; avoid manual mock factories when possible
Use vi.resetAllMocks() in beforeEach hooks instead of vi.clearAllMocks() for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, use vi.mocked(...) with the prototype pattern for class methods: vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)

Files:

  • extensions/goose/src/extension.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-06T11:15:56.238Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/extension.spec.ts:43-51
Timestamp: 2026-05-06T11:15:56.238Z
Learning: In all extensions under extensions/*/src/extension.ts, deactivate() should only clear the module-level instance reference (e.g., set the instance to undefined) and must not call dispose() directly. The dispose() method is invoked by the extension host when processing extensionContext.subscriptions. Do not suggest asserting dispose() in tests for deactivate(); such assertions are unnecessary because disposal is handled by the host and CI checks should validate subscriptions handling instead.

Applied to files:

  • extensions/goose/src/extension.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
🔇 Additional comments (2)
extensions/goose/src/extension.ts (1)

19-42: LGTM!

Also applies to: 49-55, 58-60

extensions/goose/src/extension.spec.ts (1)

19-24: LGTM!

Also applies to: 29-37, 77-154

Comment thread extensions/goose/src/extension.ts Outdated
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
extensions/goose/src/extension.ts 80.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread extensions/goose/src/extension.ts Outdated
}

const content = await configFile.read();
const lines = content.split('\n').filter(line => !line.startsWith('GOOSE_MODEL:'));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it looks fragile to parse using split function

https://block-goose.mintlify.app/configuration#config-yaml-structure

goose config file is using yaml so we should parse using a yaml library (we do that in some extensions/core of Podman Desktop or kaiden)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@bmahabirbu bmahabirbu force-pushed the worktree-extend-goose branch from a716034 to ed15a78 Compare June 18, 2026 13:28
@bmahabirbu bmahabirbu force-pushed the worktree-extend-goose branch 2 times, most recently from 7aab882 to 0fb7be9 Compare June 18, 2026 19:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@extensions/goose/package.json`:
- Line 27: The yaml package dependency is pinned to version 2.8.2 which contains
a MODERATE severity Stack Overflow vulnerability that can be triggered through
deeply nested YAML collections. Update the yaml package version constraint in
the package.json file from "^2.8.2" to "^2.9.0" to resolve this vulnerability.
This will ensure the package is updated to the latest stable release that
includes the security fix.

In `@extensions/goose/src/extension.spec.ts`:
- Around line 87-94: The createContext helper function is returning an object
that is missing the required workspace property from the AgentWorkspaceContext
interface. Add the workspace property to the returned object in the
createContext function. The workspace property should be a valid mock object
that satisfies the AgentWorkspaceContext interface requirements. Ensure all
required properties of the workspace object are included to resolve the
TypeScript compilation error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a02333c5-64fd-42f2-8120-53487a3d22de

📥 Commits

Reviewing files that changed from the base of the PR and between ff4e136 and 0fb7be9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • extensions/goose/package.json
  • extensions/goose/src/extension.spec.ts
  • extensions/goose/src/extension.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: Linux
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: linter, formatters
  • GitHub Check: unit tests / macos-15
  • GitHub Check: Windows
  • GitHub Check: typecheck
  • GitHub Check: macOS
🧰 Additional context used
📓 Path-based instructions (5)
extensions/*/package.json

📄 CodeRabbit inference engine (AGENTS.md)

extensions/*/package.json: Extensions must declare engines.kaiden version compatibility in their package.json
Extension package.json must have main field pointing to ./dist/extension.js
Configuration properties for API keys, tokens, or secrets must use "format": "password" in the configuration definition to ensure input masking in the UI

Files:

  • extensions/goose/package.json
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use /@/ path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
extensions/*/src/extension.ts

📄 CodeRabbit inference engine (AGENTS.md)

Extensions should export a standard activation API from their entry point

Files:

  • extensions/goose/src/extension.ts
extensions/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Register inference, container, and Kubernetes providers through the ProviderRegistry via extension APIs

Files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
**/*.spec.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.{ts,tsx,js,jsx}: Use test() instead of it() for test cases in Vitest unit tests
Use vi.mock(import('...')) for auto-mocking modules in unit tests; avoid manual mock factories when possible
Use vi.resetAllMocks() in beforeEach hooks instead of vi.clearAllMocks() for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, use vi.mocked(...) with the prototype pattern for class methods: vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)

Files:

  • extensions/goose/src/extension.spec.ts
🧠 Learnings (7)
📚 Learning: 2026-05-06T11:29:33.170Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/package.json:9-11
Timestamp: 2026-05-06T11:29:33.170Z
Learning: In the openkaiden/kaiden repo, all built-in extensions under extensions/ should specify engines with kaiden: "^0.0.1" in package.json. Do not flag each extension individually; enforce a repo-wide alignment in a single PR. During reviews, verify that every extensions/*/package.json has "engines": { "kaiden": "^0.0.1" }. If a file deviates, surface the discrepancy as a single repo-wide task rather than per-file.

Applied to files:

  • extensions/goose/package.json
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-06T11:15:56.238Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/extension.spec.ts:43-51
Timestamp: 2026-05-06T11:15:56.238Z
Learning: In all extensions under extensions/*/src/extension.ts, deactivate() should only clear the module-level instance reference (e.g., set the instance to undefined) and must not call dispose() directly. The dispose() method is invoked by the extension host when processing extensionContext.subscriptions. Do not suggest asserting dispose() in tests for deactivate(); such assertions are unnecessary because disposal is handled by the host and CI checks should validate subscriptions handling instead.

Applied to files:

  • extensions/goose/src/extension.ts
📚 Learning: 2026-06-18T08:20:05.553Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2185
File: extensions/gemini/src/extension.ts:45-52
Timestamp: 2026-06-18T08:20:05.553Z
Learning: When reviewing openkaiden/kaiden extension code that registers `configurationFiles` via `agents.registerAgent()` (typically in `extensions/*/src/extension.ts`), do not flag an intentionally stub `read()` (e.g., returning `'{}'`) as causing data loss or as a missing file-I/O implementation. Per the framework, runtime behavior uses the declared `path` and the real, file-backed `read()`/`update()` implementations are supplied through `context.configurationFiles` during `preWorkspaceStart`.

Applied to files:

  • extensions/goose/src/extension.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).

Applied to files:

  • extensions/goose/src/extension.ts
  • extensions/goose/src/extension.spec.ts
🔇 Additional comments (4)
extensions/goose/src/extension.ts (3)

19-42: LGTM!


55-62: LGTM!


70-78: LGTM!

extensions/goose/src/extension.spec.ts (1)

78-84: LGTM!

Also applies to: 106-167

"dependencies": {
"@openkaiden/api": "workspace:*"
"@openkaiden/api": "workspace:*",
"yaml": "^2.8.2"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check yaml package version availability and security advisories

# Check npm registry for yaml package versions
echo "=== Checking yaml package versions ==="
npm view yaml versions --json | jq -r '.[-5:]'
echo ""
echo "Latest version:"
npm view yaml version

# Check for security advisories
echo ""
echo "=== Checking for security vulnerabilities ==="
npm audit --package-lock-only --json 2>/dev/null || echo "Note: Full audit requires package-lock.json"

# Alternative: Check via GitHub API for known vulnerabilities
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "yaml") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Repository: openkaiden/kaiden

Length of output: 1591


Update yaml package from 2.8.2 to 2.9.0 to resolve a MODERATE severity vulnerability.

Version 2.8.2 is affected by a Stack Overflow vulnerability via deeply nested YAML collections (published 2026-03-25). The minimum safe version is 2.8.3, but the latest stable release 2.9.0 is recommended.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@extensions/goose/package.json` at line 27, The yaml package dependency is
pinned to version 2.8.2 which contains a MODERATE severity Stack Overflow
vulnerability that can be triggered through deeply nested YAML collections.
Update the yaml package version constraint in the package.json file from
"^2.8.2" to "^2.9.0" to resolve this vulnerability. This will ensure the package
is updated to the latest stable release that includes the security fix.

Comment on lines +87 to +94
function createContext(configFiles: AgentConfigurationFile[], modelLabel = 'gpt-4o'): AgentWorkspaceContext {
return {
model: {
model: { label: modelLabel },
},
configurationFiles: configFiles,
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if workspace property is required in AgentWorkspaceContext

# Find the interface definition
echo "=== AgentWorkspaceContext interface definition ==="
ast-grep --pattern $'export interface AgentWorkspaceContext {
  $$$
}'

# Check for optional markers on workspace property
echo ""
echo "=== Checking workspace property definition ==="
rg -A2 -B2 'interface AgentWorkspaceContext' packages/extension-api/src/extension-api.d.ts

Repository: openkaiden/kaiden

Length of output: 1150


Add the required workspace property to the mock AgentWorkspaceContext.

The createContext helper is missing the workspace property, which is required (not optional) by the AgentWorkspaceContext interface. This will cause a TypeScript compilation error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@extensions/goose/src/extension.spec.ts` around lines 87 - 94, The
createContext helper function is returning an object that is missing the
required workspace property from the AgentWorkspaceContext interface. Add the
workspace property to the returned object in the createContext function. The
workspace property should be a valid mock object that satisfies the
AgentWorkspaceContext interface requirements. Ensure all required properties of
the workspace object are included to resolve the TypeScript compilation error.

bmahabirbu and others added 2 commits June 20, 2026 19:33
Replaces the configurationFiles and preWorkspaceStart stubs with a real
implementation that writes GOOSE_MODEL into .goose/config.yaml from the
workspace context, preserving existing configuration fields.

Fixes: openkaiden#2174

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Brian <bmahabir@bu.edu>
Replace naive line-splitting with the `yaml` library's AST-based parsing
so that user comments and formatting in .goose/config.yaml survive model
config updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Brian <bmahabir@bu.edu>
@bmahabirbu bmahabirbu force-pushed the worktree-extend-goose branch from 0fb7be9 to af81505 Compare June 20, 2026 23:33
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.

Extend goose extension to handle agent configuration

2 participants