Skip to content

[Fix] Tasks crash when agents read icon files - #1103

Merged
mrubens merged 2 commits into
developfrom
fix/prevent-icon-read-crashes-1htrynbg5h43k
Aug 4, 2026
Merged

[Fix] Tasks crash when agents read icon files#1103
mrubens merged 2 commits into
developfrom
fix/prevent-icon-read-crashes-1htrynbg5h43k

Conversation

@roomote-community

@roomote-community roomote-community Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

Added a managed OpenCode safety hook that rejects reads of ICO and CUR files before their binary content can be attached to the model conversation. The hook checks both the requested path and its resolved filesystem target so a safe-looking symlink cannot bypass the guard. It accepts the supported OpenCode read argument shapes, preserves ordinary file and image reads, and returns guidance for text-only inspection or safe conversion.

Added focused coverage for case-insensitive extensions, Windows-style paths, query-suffixed paths, hook argument variants, safe and blocked symlink targets, ordinary reads, and worker bootstrap installation.

Why this change was made

OpenCode can treat icon files returned by the read tool as model image input even though inference providers do not consistently support those formats. The resulting provider failure could terminate an otherwise healthy task.

Impact

Attempts to read unsupported icon formats, including through symlink aliases, now fail as a recoverable tool error before reaching the model provider. Other read operations and tools are unchanged.

@roomote-community

roomote-community Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

  • apps/worker/src/run-task/opencode-tool-safety-plugin-script.ts:33-35 The hook only checks the requested filename. OpenCode follows symlinks, so reading preview.png that points to favicon.ico passes this check and attaches ICO bytes under the PNG MIME type, preserving the provider-crash path this PR is intended to prevent. Resolve the target or validate the file content before allowing image reads.

Reviewed 6b75d4d

@roomote-community

roomote-community Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the symlink bypass in 6b75d4d. The read guard now checks the resolved filesystem target before allowing image reads, with regression coverage for both blocked and safe symlinks. See task.

@mrubens
mrubens marked this pull request as ready for review August 4, 2026 19:56
@mrubens
mrubens merged commit 2a3bc5d into develop Aug 4, 2026
19 checks passed
@mrubens
mrubens deleted the fix/prevent-icon-read-crashes-1htrynbg5h43k branch August 4, 2026 19:56
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.

1 participant