perf(write-path): remove artificial write delays by default (part of #1375) - #31
Closed
easonLiangWorldedtech wants to merge 1 commit into
Closed
perf(write-path): remove artificial write delays by default (part of #1375)#31easonLiangWorldedtech wants to merge 1 commit into
easonLiangWorldedtech wants to merge 1 commit into
Conversation
…oo-Code-Org#1375) Two latency sources on the agent file-write path were removed or defaulted off: - DEFAULT_WRITE_DELAY_MS is now 0 instead of 1000, so writes no longer wait a full second for post-save diagnostics by default. The setting itself is unchanged: users who rely on auto-formatters that settle asynchronously (e.g. goimports for Go) can raise writeDelayMs back up; the comment on the constant documents that tradeoff. - WriteToFileTool no longer waits delay(300) before scrollToFirstDiff(). The other five write tools (EditFile, Edit, SearchReplace, ApplyPatch, ApplyDiff) already call scrollToFirstDiff() directly, and DiffViewProvider already re-reveals the first diff on a deferred 100ms timer to beat the diff editor's late layout pass, so the 300ms pause was redundant pacing. The delay() import is removed (DiffViewProvider still uses the package). Tests: ClineProvider spec now asserts the default via DEFAULT_WRITE_DELAY_MS instead of a hardcoded 1000. WriteToFileTool and ClineProvider suites pass (19 + 151).
Owner
Author
|
opened as cross-repo upstream PR instead |
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
Speed follow-through on epic Zoo-Code-Org#1375: removes the two artificial latency sources on the agent file-write path.
Changes
DEFAULT_WRITE_DELAY_MS: 1000 → 0 (packages/types/src/global-settings.ts)Every write (write_to_file, edit_file, edit, search_replace, apply_patch, apply_diff, and the DiffViewProvider save paths) waited a full second after saving, before reporting diagnostics. With the default now 0 the write path adds no artificial pacing.
writeDelayMsback up. The constant's doc comment now documents that tradeoff.state?.writeDelayMs ?? DEFAULT_WRITE_DELAY_MS, so the one-line default change is sufficient.Removed
delay(300)beforescrollToFirstDiff()(src/core/tools/WriteToFileTool.ts)The other five write tools already call
scrollToFirstDiff()without a preceding delay, andDiffViewProvider.scrollToFirstDiff()already re-reveals the first diff on a deferred 100 ms timer specifically to beat the diff editor's late layout pass — the 300 ms pause was redundant. The now-unuseddelayimport was removed (DiffViewProvider still imports the package).Tests
ClineProvider.spec.tsasserted the old default literally (toBe(1000)); it now assertsDEFAULT_WRITE_DELAY_MS.pnpm --dir src exec vitest run core/webview/__tests__/ClineProvider.spec.ts core/tools/__tests__/WriteToFileTool.spec.ts→ 151 + 19 passing.Tradeoff note
For languages where a post-save auto-formatter takes time to settle (Go/goimports is the documented case), the diagnostic window captured after a write is now 0 ms by default. That is the intended speed/safety tradeoff per Zoo-Code-Org#1375; the setting remains available for users who need the old behavior.