Skip to content

Snapshot opencode.json by content hash, not mtime - #70

Closed
strk-ai-agent wants to merge 1 commit into
ominiverdi:mainfrom
strk-ai-agent:fix/snapshot-content
Closed

Snapshot opencode.json by content hash, not mtime#70
strk-ai-agent wants to merge 1 commit into
ominiverdi:mainfrom
strk-ai-agent:fix/snapshot-content

Conversation

@strk-ai-agent

Copy link
Copy Markdown

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. 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.

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
@ominiverdi

Copy link
Copy Markdown
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.

@ominiverdi ominiverdi closed this Aug 10, 2026
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.

3 participants