-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(cli): prevent CLI memory leaks from oversized diffs and session accumulation #7617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5410533
7f57983
59d1bbb
2451764
d7f73a1
1a07ad1
a3c8340
6878ddb
1c4918c
6819ee7
10e3b12
1a0536d
a7d3731
5e38d95
1596cae
5d611d6
8b676f8
3ed648d
bfbfbb9
721b3d0
664ceec
1cb4b5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,16 +121,23 @@ export namespace SessionSummary { | |
| }), | ||
| async (input) => { | ||
| const diffs = await Storage.read<Snapshot.FileDiff[]>(["session_diff", input.sessionID]).catch(() => []) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Existing oversized
|
||
| // kilocode_change start — scrub oversized diffs from stored session_diff | ||
| const next = diffs.map((item) => { | ||
| const file = unquoteGitPath(item.file) | ||
| if (file === item.file) return item | ||
| const oversized = | ||
| Buffer.byteLength(item.before) > Snapshot.MAX_DIFF_SIZE || | ||
| Buffer.byteLength(item.after) > Snapshot.MAX_DIFF_SIZE | ||
| if (file === item.file && !oversized) return item | ||
| return { | ||
| ...item, | ||
| file, | ||
| before: oversized ? "" : item.before, | ||
| after: oversized ? "" : item.after, | ||
| } | ||
| }) | ||
| const changed = next.some((item, i) => item.file !== diffs[i]?.file) | ||
| const changed = next.some((item, i) => item !== diffs[i]) | ||
| if (changed) Storage.write(["session_diff", input.sessionID], next).catch(() => {}) | ||
| // kilocode_change end | ||
| return next | ||
| }, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ export const TaskTool = Tool.define("task", async (ctx) => { | |
| const agent = await Agent.get(params.subagent_type) | ||
| if (!agent) throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`) | ||
|
|
||
| const allowsTask = agent.permission.some((rule) => rule.permission === "task" && rule.action === "allow") | ||
| const allowsTask = agent.permission.some((rule) => rule.permission === "task" && rule.action === "allow") // kilocode_change | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Granular This only checks whether the agent has any allowed |
||
|
|
||
| const session = await iife(async () => { | ||
| if (params.task_id) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.