GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Session summary/diff is worktree-global (not session-scoped) causing cross-session attribution · Issue #11802 · anomalyco/opencode Closed as not planned Closed as not planned Copy link DescriptionTL;DRSession diffs are filtered by files from Root Cause// summary.ts - files comes from patch parts const files = new Set( input.messages .flatMap((x) => x.parts) .filter((x) => x.type === "patch") .flatMap((x) => x.files) // <-- from Snapshot.patch() = worktree-global ) // diffs also come from worktree-global snapshots const diffs = await computeDiff({ messages }).then((x) => x.filter((x) => files.has(x.file)) // <-- filtering is ineffective ) Both Proposed Fix1. Extract files from tool result metadata (session-scoped)// summary.ts - get files from tool metadata instead of patch parts const files = new Set( input.messages .flatMap((x) => x.parts) .filter((x): x is MessageV2.ToolPart => x.type === "tool" && x.state.status === "completed") .flatMap((x) => { if (x.tool === "edit") return [x.state.metadata?.filediff?.file] if (x.tool === "write") return [x.state.metadata?.filepath] if (x.tool === "bash") return x.state.metadata?.files ?? [] return [] }) .filter(Boolean) .map((x) => path.relative(Instance.worktree, x).replaceAll("\\", "/")), ) 2. Add per-tool snapshots to bash toolCurrently bash doesn't track which files it modifies. Add snapshot before/after: // bash.ts - capture files modified by bash command import { Snapshot } from "@/snapshot" async execute(params, ctx) { // Snapshot BEFORE bash runs const snapshotBefore = await Snapshot.track() // ... existing spawn and execution code ... // Capture changed files AFTER bash completes const changedFiles: string[] = [] if (snapshotBefore) { const patch = await Snapshot.patch(snapshotBefore) changedFiles.push(...patch.files) } return { title: params.description, metadata: { output: /* ... */, exit: proc.exitCode, description: params.description, files: changedFiles, // <-- track files modified by bash }, output, } } Remaining Collision WindowAfter this fix, false attribution only occurs if two sessions run bash commands that modify the exact same file during the exact same snapshot window (milliseconds). This is a dramatically smaller window than the current step-level collision. Environment
Reacted by Andrea Giacon and ualtinok Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |