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 — fix: tool_use without tool_result causes API error on session resume · Issue #213 · randomm/opencode Closed Labels bugSomething isn't working DescriptionProblemWhen a session is interrupted mid-tool (e.g., abort, crash, or user interrupt) before the tool finishes executing, the tool part is left in `"pending"` state. On next session load, `processor.ts` silently ignores these pending tool parts when processing `tool-result` and `tool-error` events — because it only checks for `"running"` state, not `"pending"`. The result is a dangling `tool_use` block sent to the Anthropic API with no corresponding `tool_result`, which causes: ``` Root CauseFile: `packages/opencode/src/session/processor.ts` Line 182 (tool-result handler): Line 206 (tool-error handler): Both checks exclude `"pending"` tools — tools interrupted before execution began are never transitioned to an error state, so they remain as orphaned `tool_use` blocks in the persisted message. Existing Partial Workaround`message-v2.ts` lines 660–670 converts `pending`/`running` tool parts to synthetic error results during serialization for the API. This prevents the immediate crash but does not fix the root state — the tool remains `pending` in the store, so the workaround fires on every subsequent resume too. FixIn `processor.ts`, extend both conditions to also handle `"pending"` tools: Line 182 — change: When the matched tool is `"pending"` (i.e., `startTime` was never set), synthesize a safe `startTime`: Apply the same change at line 206 for the `tool-error` handler. Acceptance Criteria
Context
Quality Gates
Reacted by Jethro Guce Activity
MetadataMetadataAssigneesLabelsbugSomething isn't working 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. |