Snapshot opencode.json by content hash, not mtime - #70
Closed
strk-ai-agent wants to merge 1 commit into
Closed
Conversation
Previously the bridge copied opencode.json into each per-chat session directory only when the source mtime was strictly newer than the target's. This breaks for git checkouts, restores, and edits that preserve timestamps, leaving the cached snapshot and the running opencode acp child out of sync with the project's opencode.json. Replace the mtime-based copyIfNewer helper with copyIfChanged, which compares SHA-256 of the file contents and refreshes when they differ (or when no snapshot exists yet). copyOpenCodeConfig now returns whether anything was refreshed so callers can react. Also export hasOpenCodeConfigChanged(sessionDir) for callers that need to decide whether to invalidate an existing session before the next message is processed. Assisted-By: MiniMax-M3
Owner
|
Closing under the updated contribution policy. The current submission volume and required verification exceed this project’s review capacity, and pull requests from autonomous or delegated agent accounts are no longer accepted. Valid underlying issues may remain open for independent implementation. Please do not revise, reopen, or replace this pull request. |
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.
Previously the bridge copied
opencode.jsoninto each per-chat session directory only when the source mtime was strictly newer than the target's. This breaks for git checkouts, restores, and edits that preserve timestamps, leaving the cached snapshot and the runningopencode acpchild out of sync with the project'sopencode.json.Replace the mtime-based
copyIfNewerhelper withcopyIfChanged, which compares SHA-256 of the file contents and refreshes when they differ (or when no snapshot exists yet).copyOpenCodeConfignow returns whether anything was refreshed so callers can react.Also export
hasOpenCodeConfigChanged(sessionDir)for callers that need to decide whether to invalidate an existing session before the next message is processed. The matching invalidation logic lives in a follow-up branch (#PR2).Tests:
bun test tests/unit/session-utils.test.ts tests/unit/connector-base.test.ts— 106 pass, 0 fail.