fix: use atomic write for tui.toml config to prevent corruption - #6
Closed
hobostay wants to merge 1 commit into
Closed
fix: use atomic write for tui.toml config to prevent corruption#6hobostay wants to merge 1 commit into
hobostay wants to merge 1 commit into
Conversation
saveTuiConfig was writing directly to the target file. If the process crashed or lost power mid-write, tui.toml would be truncated and the user's theme, editor, and notification preferences silently lost on next startup. Now uses the same write-to-temp-then-rename pattern as writeJsonFile in persistence.ts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Collaborator
|
Thank you for your interest in contributing to kimi-code. |
zha-ji-tui
added a commit
to zha-ji-tui/kimi-code
that referenced
this pull request
Jun 1, 2026
- Gate the readdir fallback on `gitCache.isGitRepo()` instead of `snapshot === null`, so a transient `git ls-files` failure inside a real git repo does not expose `.gitignore`d files. The previous gate conflated "not a git repo" with "git ls-files failed transiently". - Break out of the per-entry `walkDir` loop once `READDIR_MAX_ENTRIES` is reached, so a single large directory does not `statSync` every remaining file after the cap is filled. The cap was previously only checked on entry to `walkDir`. - Handle the snapshot-null case after the `isGitRepo()` gate to avoid NPE when `getSnapshot()` returns null transiently inside a real git repo. - Add a transient-failure test (isGitRepo=true, getSnapshot=null) and extend `stubGitCache` to decouple `isGitRepo` from snapshot presence. Refs PR MoonshotAI#268 codex review (P2 MoonshotAI#5, MoonshotAI#6).
sailist
added a commit
that referenced
this pull request
Jun 5, 2026
…@ifoo (P2.5) VSCode-style ctor migration for the seven in-process service implementations: * SessionServiceImpl, MessageServiceImpl, ToolServiceImpl, McpServiceImpl, TaskServiceImpl: ctor goes from `(private readonly bridge: IHarnessBridge)` to `(@IHarnessBridge private readonly bridge: IHarnessBridge)`. * PromptServiceImpl: ctor goes from `(private readonly bridge, private readonly eventBus)` to `(@IHarnessBridge ..., @IEventBus ...)` — same shape, services decorated. * HarnessBridge: ctor reorders from `(eventBus, approvalBroker, questionBroker, options = {})` to `(options, @IEventBus eventBus, @IApprovalBroker approvalBroker, @IQuestionBroker questionBroker)` — VSCode-convention static-first. Inline `options = {}` default is dropped because TS forbids a required param after an optional one, and `options` now precedes the 3 service params. Daemon start.ts already passes `opts.bridgeOptions ?? {}` explicitly, so the change is local. HarnessBridge singleton invariant is preserved: start.ts continues to `services.set(IHarnessBridge, built)` after construction, so every consumer's `a.get(IHarnessBridge)` resolves to the same instance from the ServiceCollection cache. * packages/services/test/bridge.test.ts: 3 `new HarnessBridge(...)` call sites reordered to the new `(options, eventBus, approvalBroker, questionBroker)` shape. * packages/daemon/src/start.ts: six `ix.createInstance(...Impl, a.get(IHarnessBridge), ...)` call sites collapse to single-arg `ix.createInstance(Impl)`; HarnessBridge construction collapses to `ix.createInstance(HarnessBridge, opts.bridgeOptions ?? {})`. agent-core/src/di/ untouched (sealed for Phase 2). services test green (120 pass); daemon test green (241 pass after one flake-rerun on fs-watch.e2e.test.ts:302). services build is gated on test only per phase-1 reviewer handoff #6 (pre-existing tsdown .yaml issue is out-of-scope). VERDICT: PASS — 7 impls decorated at session/message/tool/mcp/task-service-impl.ts:144/266/34/42/44 + prompt-service-impl.ts:156 + harness-bridge.ts:108; bridge.test.ts call-site swap; 241/241 daemon + 120/120 services tests green.
wintrover
added a commit
to wintrover/kimy
that referenced
this pull request
Jun 29, 2026
…nshotAI#8 Replace manual file-set declarations with build engine introspection. - tsdown native config: add manifestPlugin() that writes build-manifest.json via OutputChunk.moduleIds (850 bundled modules, zero test files) - kimy wrapper: lockfile-based dependency hashing via pnpm-lock.yaml importers - kimy wrapper: manifest-based native hashing (bundledModules only) - kimy wrapper: double-checked locking inside flock (TOCTOU fix) - kimy wrapper: atomic hash file writes via temp + mv
asdshuaishuai
pushed a commit
to d2rabbit/kimi-code
that referenced
this pull request
Jul 21, 2026
) Wires up the user's request to use codegraph (https://github.com/colbymchenry/codegraph) as the project indexer and auto-sync the index whenever a code task finishes. Rust (commands.rs / lib.rs): · update_codegraph_index(cwd): spawns the codegraph CLI outside the webview (no ACL). Strategy: - if <cwd>/.codegraph/ exists → 'codegraph sync <cwd>' (incremental) - otherwise → 'codegraph init <cwd>' (first-time build) - if codegraph isn't on PATH → silent Ok (hook is opt-in; users without codegraph see no errors or toasts) Runs with --quiet and a 5-minute timeout so a stuck build can't hold the async runtime. Failures return Ok with the stderr text rather than Err (codegraph errors are often 'language unsupported' non-issues that would just annoy users). · resolve_codegraph_cli(): PATH-only lookup. No in-repo fallback because codegraph is an external tool installed separately via curl | bash (per upstream docs). Frontend (client.svelte.ts): · maybeUpdateCodegraphIndex(sessionId): invoked from the sessionStatusChanged === 'idle' branch in connectEvents(). Reads the session's cwd, calls update_codegraph_index, surfaces an info toast on success ('codegraph 索引已更新'). Throttled to one in-flight call per session (overlapping syncs would just re-index the same changes). Silently no-ops in browser mode. The hook fires on EVERY session-idle transition, which is exactly the 'task complete' moment the user asked for — by then the agent has finished editing files and the graph can pick up the new state. The result is that codegraph-aware features (symbol search, call graph, etc.) stay current without a manual reindex step. svelte-check 0 errors, cargo check 0 warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
saveTuiConfigwas writing directly to the target file, risking corruption on crash/power losswriteJsonFileinpersistence.tsTest plan
🤖 Generated with Claude Code