Skip to content

fix(openshell-cli): auto-refresh sandbox list while deleting sandboxes - #2475

Merged
jeffmaury merged 4 commits into
openkaiden:mainfrom
jeffmaury:jeffmaury/GH-2330
Jul 20, 2026
Merged

jeffmaury merged 4 commits into
openkaiden:mainfrom
jeffmaury:jeffmaury/GH-2330

Conversation

@jeffmaury

Copy link
Copy Markdown
Contributor

Summary

  • When listing sandboxes via openshell sandbox list, if any sandbox is in "Deleting" phase, automatically re-poll after 5 seconds to detect when the deletion completes
  • The emitter only fires when the total sandbox count or deleting count actually changes, avoiding unnecessary UI refreshes
  • AgentWorkspaceManager subscribes to the new onDidSandboxListChange event and forwards agent-workspace-update to the renderer

Test plan

  • Unit tests for auto-refresh polling logic (schedule, dedup, change detection, error handling, dispose)
  • Unit test for AgentWorkspaceManager subscription wiring
  • Typecheck passes (pnpm run typecheck:main)
  • Lint passes (pnpm run lint:check)

Fixes #2330

🤖 Generated with Claude Code

@jeffmaury
jeffmaury requested a review from a team as a code owner July 16, 2026 18:17
@jeffmaury
jeffmaury requested review from MarsKubeX and fbricon and removed request for a team July 16, 2026 18:17
@coderabbitai

coderabbitai Bot commented Jul 16, 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: 1676cbab-f7bb-416d-8cbe-eb74d87ba2bf

📥 Commits

Reviewing files that changed from the base of the PR and between 7795624 and 7d70dce.

📒 Files selected for processing (4)
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: unit tests / macos-15
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: Linux
  • GitHub Check: linter, formatters
  • GitHub Check: macOS
  • GitHub Check: typecheck
  • GitHub Check: Windows
🧰 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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
packages/main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/main/src/**/*.{ts,tsx}: Use ipcHandle() to expose handlers in the main process with naming convention <registry-name>:<action> (e.g., container-provider-registry:listContainers)
Use apiSender.send() to send events from main process to renderer for real-time updates
Long-running operations should use TaskManager.createTask() with title and action configuration

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
packages/{main,renderer,preload}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Container operations must include engineId parameter to identify the container engine

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
🧠 Learnings (3)
📚 Learning: 2026-03-09T08:47:09.657Z
Learnt from: benoitf
Repo: kortex-hub/kortex PR: 1077
File: packages/main/src/plugin/skill/skill-manager.ts:80-109
Timestamp: 2026-03-09T08:47:09.657Z
Learning: In the kortex-hub/kortex repository, IPC handlers (via ipcHandle()) may be registered directly inside feature manager/service classes (e.g., SkillManager in packages/main/src/plugin/skill/skill-manager.ts) rather than exclusively in packages/main/src/plugin/index.ts. Treat this as an accepted design pattern for files under the plugin directory. Reviewers should not require centralization in index.ts; allow IPC registration proximity to the feature that owns the handler. When reviewing code, accept direct ipcHandle() registrations inside feature managers and ensure the pattern is consistently applied across similar feature-manager modules.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
📚 Learning: 2026-06-29T13:16:53.102Z
Learnt from: benoitf
Repo: openkaiden/kaiden PR: 2296
File: extensions/container/packages/extension/src/helper/socket-finder/_socket-finder-module.ts:28-29
Timestamp: 2026-06-29T13:16:53.102Z
Learning: When reviewing imports in openkaiden/kaiden TypeScript/JavaScript files, prefer the configured `/@/` path alias instead of relative imports that would require traversing out of the current directory/module group (i.e., paths containing `..` that cross boundaries). 

Do not require alias conversion for descendant-path relative imports within the socket-finder module directory—for example, in `extensions/container/packages/extension/src/helper/socket-finder/**`, imports like `./podman/podman-version-detector` and `./podman/podman-windows-finder` are acceptable and should not be flagged.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
🪛 Biome (2.5.3)
packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts

[error] 770-770: This callback passed to forEach() iterable method should not return a value.

(lint/suspicious/useIterableCallbackReturn)

🔇 Additional comments (6)
packages/main/src/plugin/openshell-cli/openshell-cli.ts (2)

290-313: Polling can still be re-armed after disposal (missing _disposed guard).

If dispose() runs while a scheduled listSandboxesPerGateway() is in flight (timer already fired and cleared to undefined), the resolving call re-enters scheduleDeletingPollIfNeeded() at Line 286 and creates a fresh timer after teardown. dispose() clears the timer that existed at teardown time but cannot cancel this later-created one, so background CLI polling leaks until deletion happens to complete. Add a _disposed flag, return early from scheduleDeletingPollIfNeeded when set, and set it at the start of dispose().

This repeats a prior review comment that has not been addressed in the current code.


23-29: LGTM!

Also applies to: 88-91

packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts (2)

770-770: Use a for...of loop instead of forEach.

The arrow implicitly returns disposable.dispose(), tripping Biome's useIterableCallbackReturn. Replace with a for...of loop. This repeats a prior, still-open review comment and is confirmed by static analysis.

Source: Linters/SAST tools


489-491: LGTM!

Also applies to: 629-631, 746-757

packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts (1)

769-924: LGTM!

packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts (1)

130-190: LGTM!

Also applies to: 227-259, 883-930


📝 Walkthrough

Walkthrough

Sandbox deletion polling now detects relevant sandbox-list changes and emits an event. AgentWorkspaceManager forwards that event as an agent-workspace-update IPC notification, with subscriptions and polling resources disposed during teardown.

Changes

Sandbox refresh notifications

Layer / File(s) Summary
Sandbox list change event contract
packages/main/src/plugin/openshell-cli/openshell-cli.ts
OpenshellCli exposes an emitter-backed sandbox list change event and tracks the deletion polling timer.
Deleting sandbox polling and cleanup
packages/main/src/plugin/openshell-cli/openshell-cli.ts, packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
Deleting sandboxes trigger guarded five-second refreshes; count changes emit events, polling errors are logged, and disposal clears timers and emitters.
Workspace update event wiring
packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts, packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
AgentWorkspaceManager subscribes to sandbox list changes, forwards agent-workspace-update through IPC, and disposes registered subscriptions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenshellCli
  participant Gateway
  participant AgentWorkspaceManager
  participant apiSender
  OpenshellCli->>Gateway: list sandboxes per gateway
  Gateway-->>OpenshellCli: sandbox results
  OpenshellCli->>OpenshellCli: schedule deleting-sandbox refresh
  OpenshellCli->>Gateway: re-list sandboxes after 5 seconds
  Gateway-->>OpenshellCli: refreshed sandbox results
  OpenshellCli->>AgentWorkspaceManager: emit onDidSandboxListChange
  AgentWorkspaceManager->>apiSender: send agent-workspace-update
Loading

Possibly related PRs

Suggested reviewers: bmahabirbu, fbricon, marskubex

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds polling and event forwarding, but it does not implement the issue's required optimistic pending-deletions tracking in main and renderer. Add pending-deletions tracking in AgentWorkspaceManager and a renderer-side deletingSandboxNames filter, then clear them once the CLI confirms deletion.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: auto-refreshing sandbox lists while sandboxes are deleting.
Description check ✅ Passed The description matches the code changes and test coverage around sandbox auto-refresh and workspace updates.
Out of Scope Changes check ✅ Passed All changes support sandbox refresh, event wiring, tests, and cleanup for the deletion fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@jeffmaury
jeffmaury requested a review from bmahabirbu July 16, 2026 18:20

@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: 3

🤖 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 `@packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts`:
- Around line 745-748: Store the disposable returned by onDidSandboxListChange
in a private AgentWorkspaceManager property, and dispose it at the start of the
`@preDestroy`() dispose method before cleaning up other resources. Preserve the
existing agent-workspace-update callback behavior.

In `@packages/main/src/plugin/openshell-cli/openshell-cli.ts`:
- Around line 286-313: Introduce a private _disposed flag on the OpenshellCli
class, check it at the start of scheduleDeletingPollIfNeeded so no timer is
created after disposal, and set it to true at the beginning of dispose before
clearing the existing _deletingPollTimer.
- Around line 308-311: Update the polling error handler around
scheduleDeletingPollIfNeeded so its catch branch passes the previous results
back into scheduleDeletingPollIfNeeded, preserving the existing results while
restarting the timer after listSandboxesPerGateway fails.
🪄 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: 44336f38-d895-4b61-96b3-1af4140d8030

📥 Commits

Reviewing files that changed from the base of the PR and between 87cd3bc and 59ee44a.

📒 Files selected for processing (4)
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: unit tests / macos-15
  • 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: unit tests / windows-2022
  • GitHub Check: linter, formatters
  • GitHub Check: typecheck
  • GitHub Check: macOS
  • GitHub Check: Windows
🧰 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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
packages/main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/main/src/**/*.{ts,tsx}: Use ipcHandle() to expose handlers in the main process with naming convention <registry-name>:<action> (e.g., container-provider-registry:listContainers)
Use apiSender.send() to send events from main process to renderer for real-time updates
Long-running operations should use TaskManager.createTask() with title and action configuration

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
packages/{main,renderer,preload}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Container operations must include engineId parameter to identify the container engine

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.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:

  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
🧠 Learnings (3)
📚 Learning: 2026-03-09T08:47:09.657Z
Learnt from: benoitf
Repo: kortex-hub/kortex PR: 1077
File: packages/main/src/plugin/skill/skill-manager.ts:80-109
Timestamp: 2026-03-09T08:47:09.657Z
Learning: In the kortex-hub/kortex repository, IPC handlers (via ipcHandle()) may be registered directly inside feature manager/service classes (e.g., SkillManager in packages/main/src/plugin/skill/skill-manager.ts) rather than exclusively in packages/main/src/plugin/index.ts. Treat this as an accepted design pattern for files under the plugin directory. Reviewers should not require centralization in index.ts; allow IPC registration proximity to the feature that owns the handler. When reviewing code, accept direct ipcHandle() registrations inside feature managers and ensure the pattern is consistently applied across similar feature-manager modules.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
📚 Learning: 2026-06-29T13:16:53.102Z
Learnt from: benoitf
Repo: openkaiden/kaiden PR: 2296
File: extensions/container/packages/extension/src/helper/socket-finder/_socket-finder-module.ts:28-29
Timestamp: 2026-06-29T13:16:53.102Z
Learning: When reviewing imports in openkaiden/kaiden TypeScript/JavaScript files, prefer the configured `/@/` path alias instead of relative imports that would require traversing out of the current directory/module group (i.e., paths containing `..` that cross boundaries). 

Do not require alias conversion for descendant-path relative imports within the socket-finder module directory—for example, in `extensions/container/packages/extension/src/helper/socket-finder/**`, imports like `./podman/podman-version-detector` and `./podman/podman-windows-finder` are acceptable and should not be flagged.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts
  • packages/main/src/plugin/openshell-cli/openshell-cli.ts
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts
🔇 Additional comments (2)
packages/main/src/plugin/openshell-cli/openshell-cli.spec.ts (1)

769-925: LGTM!

packages/main/src/plugin/agent-workspace/agent-workspace-manager.spec.ts (1)

262-270: LGTM!

Comment thread packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts Outdated
Comment thread packages/main/src/plugin/openshell-cli/openshell-cli.ts
Comment thread packages/main/src/plugin/openshell-cli/openshell-cli.ts
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bmahabirbu bmahabirbu 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.

LGTM codewise and tested this I think 5 seconds is a good time for polling!

Orthogonal, while testing I noticed that Kaiden currently treats these two situations the same:

  • The gateway is reachable and has no sandboxes.
  • The gateway cannot be reached, so Kaiden cannot determine whether it has sandboxes.

So would be a good follow up to have kaiden give an error for a gateway cant be reached

@fbricon

fbricon commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

I think we could still improve the design. Right now the deletion is blocking, so this.apiSender.send('agent-workspace-update'); will only be triggered after the actual deletion happened. In the meantime, the UI still shows the sandbox in Ready mode. Then the sandbox just disappears.
We could probably start the deletion promise, tell the UI to refresh within 1 sec (would show Deleting), then await deletion, while the UI keeps polling the sandbox list status. I'd use a Fibonacci-style backoff delays [1s, 2s, 3s, 5s]
(capped at 5s) instead of a fixed 5s interval

@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 `@packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts`:
- Line 780: Replace the this.disposables.forEach callback with a for...of loop
that iterates over this.disposables and calls disposable.dispose() without
returning its result.
🪄 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: 9ccf0793-906c-426e-99e4-2aa2a13c3d85

📥 Commits

Reviewing files that changed from the base of the PR and between 59ee44a and 7795624.

📒 Files selected for processing (1)
  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
packages/main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/main/src/**/*.{ts,tsx}: Use ipcHandle() to expose handlers in the main process with naming convention <registry-name>:<action> (e.g., container-provider-registry:listContainers)
Use apiSender.send() to send events from main process to renderer for real-time updates
Long-running operations should use TaskManager.createTask() with title and action configuration

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
packages/{main,renderer,preload}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Container operations must include engineId parameter to identify the container engine

Files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
🧠 Learnings (3)
📚 Learning: 2026-03-09T08:47:09.657Z
Learnt from: benoitf
Repo: kortex-hub/kortex PR: 1077
File: packages/main/src/plugin/skill/skill-manager.ts:80-109
Timestamp: 2026-03-09T08:47:09.657Z
Learning: In the kortex-hub/kortex repository, IPC handlers (via ipcHandle()) may be registered directly inside feature manager/service classes (e.g., SkillManager in packages/main/src/plugin/skill/skill-manager.ts) rather than exclusively in packages/main/src/plugin/index.ts. Treat this as an accepted design pattern for files under the plugin directory. Reviewers should not require centralization in index.ts; allow IPC registration proximity to the feature that owns the handler. When reviewing code, accept direct ipcHandle() registrations inside feature managers and ensure the pattern is consistently applied across similar feature-manager modules.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.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:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
📚 Learning: 2026-06-29T13:16:53.102Z
Learnt from: benoitf
Repo: openkaiden/kaiden PR: 2296
File: extensions/container/packages/extension/src/helper/socket-finder/_socket-finder-module.ts:28-29
Timestamp: 2026-06-29T13:16:53.102Z
Learning: When reviewing imports in openkaiden/kaiden TypeScript/JavaScript files, prefer the configured `/@/` path alias instead of relative imports that would require traversing out of the current directory/module group (i.e., paths containing `..` that cross boundaries). 

Do not require alias conversion for descendant-path relative imports within the socket-finder module directory—for example, in `extensions/container/packages/extension/src/helper/socket-finder/**`, imports like `./podman/podman-version-detector` and `./podman/podman-windows-finder` are acceptable and should not be flagged.

Applied to files:

  • packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
🪛 Biome (2.5.3)
packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts

[error] 780-780: This callback passed to forEach() iterable method should not return a value.

(lint/suspicious/useIterableCallbackReturn)

🔇 Additional comments (2)
packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts (2)

92-92: LGTM!


742-752: LGTM!

Comment thread packages/main/src/plugin/agent-workspace/agent-workspace-manager.ts
jeffmaury and others added 3 commits July 19, 2026 22:49
When listing sandboxes, if any are in "Deleting" phase, schedule an
automatic re-list after 5 seconds. The emitter only fires when the
total sandbox count or deleting count changes, avoiding unnecessary
UI refreshes. The polling chain self-terminates once no sandboxes
remain in "Deleting" state.

Fixes openkaiden#2330
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@jeffmaury
jeffmaury force-pushed the jeffmaury/GH-2330 branch from 7795624 to 0d7203c Compare July 19, 2026 20:55
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@jeffmaury
jeffmaury enabled auto-merge (squash) July 20, 2026 06:34
@jeffmaury
jeffmaury merged commit b71d40b into openkaiden:main Jul 20, 2026
34 checks passed
fbricon added a commit to fbricon/kortex that referenced this pull request Jul 22, 2026
…penkaiden#2030, openkaiden#2033)

Workspaces were not visible until fully created, and there was no progress
indication during creation or deletion.

Backend (OpenshellCli):
- Add operation polling around create/delete CLI calls: an early poll at
  500ms catches the transitional phase (Provisioning/Deleting), and an
  immediate refresh on CLI completion picks up the final state.
- Keep the 5-second transitional poll (from openkaiden#2475) for sandboxes that
  enter transitional states outside of Kaiden (e.g. external CLI usage).
  It also activates indirectly after our operation polls: the emitter
  update triggers a renderer re-fetch via listSandboxesPerGateway(),
  which schedules the transitional poll if transitional sandboxes are
  still present — this is desirable as it keeps monitoring until the
  sandbox reaches its final state after the CLI completes.

Renderer:
- Make create and delete fire-and-forget: navigate to the workspace list
  immediately without waiting for the IPC call to complete. Draft is
  preserved on creation error.
- Pin sandbox phase to Deleting in the store once observed, until the
  sandbox disappears. Works around a Podman driver race where
  derive_phase briefly returns Provisioning between the stop and remove
  events during deletion.
- Disable interactions (name link, trash icon) on sandboxes in Deleting
  phase.
- Auto-redirect the details page to the list when a workspace disappears
  from the store.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fred Bricon <fbricon@gmail.com>
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.

Openshell workspaces does not disappear after deleting.

4 participants