Skip to content

fix(cli): guard cyclic session fork remaps#9250

Open
markijbema wants to merge 1 commit intomainfrom
fix/memleak-9216-session-fork-cycle
Open

fix(cli): guard cyclic session fork remaps#9250
markijbema wants to merge 1 commit intomainfrom
fix/memleak-9216-session-fork-cycle

Conversation

@markijbema
Copy link
Copy Markdown
Contributor

Prevent session fork child remapping from re-entering the public fork path for already-seen task sessions, so self-referential and cyclic task metadata terminate safely.
Seed the root session remap and reuse it recursively so cycles point at the copied session graph instead of forking indefinitely.

Fixes #9216

Tests: bun test test/kilocode/session-fork-remap.test.ts

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 20, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

No diff-line issues eligible for inline comments.

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
packages/opencode/src/server/instance/session.ts 390 session.fork still calls Session.Service.fork(...) directly, so SDK/HTTP forks bypass kiloSessionFork and never run remapChildren. The new cyclic remap logic is therefore only exercised by callers that use the promise helper (Session.fork), not by the public API path used by clients such as the VS Code extension.
Files Reviewed (4 files)
  • .changeset/guard-session-fork-cycles.md - 0 issues
  • packages/opencode/src/kilocode/session/fork.ts - 0 issues
  • packages/opencode/src/kilocode/session/index.ts - 0 diff-line issues
  • packages/opencode/test/kilocode/session-fork-remap.test.ts - 0 issues

Reviewed by gpt-5.4-20260305 · 377,844 tokens

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.

[autodetected memoryleak] Guard cyclic child-session fork remapping

1 participant