Skip to content

fix(cli): persist snapshot disable across restarts - #13195

Merged
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
quanzhuo:issues/13134
Aug 18, 2026
Merged

fix(cli): persist snapshot disable across restarts#13195
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
quanzhuo:issues/13134

Conversation

@quanzhuo

Copy link
Copy Markdown
Contributor

The slow-repo prompt wrote snapshot:false outside the Effect fiber, so the project config was skipped and snapshots came back after a VS Code restart.

Issue

Addresses #13134 (slow-repo / chat prompt path only).
This does not change the settings-panel snapshot: false save path. If that path still fails after restart, keep #13134 open or file a follow-up.

Context

On a slow repo, the snapshot init prompt offers Disable for this project. That choice is supposed to write "snapshot": false to .kilo/kilo.jsonc so later sessions stay off.
The write ran through Effect.promise(...). That drops InstanceRef / ALS across the Promise boundary. persistDisable then could not see the project directory, skipped the file write, and only flipped the in-memory session flag. After a VS Code restart, snapshots came back.

Implementation

Keep the existing “write the project file, do not call Config.update()” design so the live turn is not disposed.
Two small changes:

  1. Call hooks.persistDisable() with EffectBridge.fromPromise so instance context survives the Promise boundary (same pattern as other kilo Effect/Promise edges).
  2. Capture InstanceContext synchronously at the start of persistDisable via capture(), before any await. If there is no instance, log an error instead of returning silently.

No settings-panel or Config.update() changes.

Screenshots / Video

N/A — no visual changes.

How to Test

Manual/local verification

  • Agent: bun test ./test/kilocode/snapshot-track-timeout.test.ts from packages/opencode/ — passed, including the new persistDisable cases.
  • Agent: bun run typecheck for @kilocode/cli — passed.
  • Human: local git push pre-push ran bun turbo typecheck --filter=!@kilocode/kilo-jetbrains — passed (29/29). JetBrains typecheck failed afterward on a CloudFront DNS fetch for rpc-compiler-plugin; unrelated to this diff.

Reviewer test steps

  1. Open a large/slow git repo in VS Code so the snapshot init prompt appears.
  2. Choose Disable for this project.
  3. Confirm .kilo/kilo.jsonc contains "snapshot": false.
  4. Reload the VS Code window (or restart VS Code) and confirm snapshots stay disabled for that project.
  5. Optional: run from packages/opencode/:
    bun test ./test/kilocode/snapshot-track-timeout.test.ts

Blocked checks and substitute verification

  • Full bun turbo typecheck --filter=@kilocode/kilo-jetbrains was not completed on the author’s machine because Gradle could not resolve com.jetbrains.fleet:rpc-compiler-plugin (CloudFront DNS). This PR does not touch packages/kilo-jetbrains/. Substitute: CLI typecheck + the persistDisable regression tests above.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes

The slow-repo prompt wrote snapshot:false outside the Effect fiber, so the project config was skipped and snapshots came back after a VS Code restart.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kilo-code-bot

kilo-code-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The fix is sound: Snapshot.track yields InstanceState.context (which requires InstanceRef in the fiber) before wrap runs, so EffectBridge.fromPromise reliably recovers the instance context at the disable branch, and capturing it synchronously at the top of persistDisable (before any await) closes the ALS gap that caused the silent skip. This matches the established EffectBridge.fromPromise pattern used across other Kilo Effect/Promise edges. The new tests exercise the real persistDisable through the real wrap rather than duplicating logic, and the no-context case now logs an error instead of returning silently. No memory-leak concerns: the change adds no timers, subscriptions, or retained resources — only per-call context captures.

Files Reviewed (3 files)
  • .changeset/persist-snapshot-disable.md
  • packages/opencode/src/kilocode/snapshot/track.ts
  • packages/opencode/test/kilocode/snapshot-track-timeout.test.ts

Reviewed by kimi-k3 · Input: 148.6K · Output: 15.3K · Cached: 1.1M

Review guidance: REVIEW.md from base branch main

@marius-kilocode marius-kilocode left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @quanzhuo this looks good!

@marius-kilocode
marius-kilocode merged commit 9f04990 into Kilo-Org:main Aug 18, 2026
32 checks passed
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