tui: pasting a PDF path auto-attaches it, which text-only models cannot read
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
packages/tui/src/component/prompt/index.tsx から始めます。ここでは pasteInputText() が貼り付けられたパスを確認し、pasteAttachment() が添付ファイルにラベルを付けます。バイナリ添付ファイルがどのように処理されるかをたどり、貼り付け動作に関する既存のプロンプトテストを確認してください。PDF のパスを貼り付けてもテキスト専用モデルへのリクエストが失敗しなくなり、issue で期待されている動作が満たされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Pasting a path to an existing PDF into the prompt auto-attaches the file as [PDF 1]. With a text-only model (no PDF input), sending the message fails, and there is no setting to disable this auto-attachment.
Environment
- opencode version: 2.0.32
- OS: Linux 7.2.9-arch1-1 (Arch Linux, x86_64)
- Terminal: xterm-256color
- Shell: /usr/bin/zsh
- Install/channel: packaged binary at
/usr/bin/opencode(latest) - Active plugins: none found in config
Reproduction
- Copy the absolute path of an existing PDF (e.g.
/home/user/Downloads/paper.pdf). - Paste it into the prompt.
- The prompt inserts a
[PDF 1]attachment instead of the path text. - Send the message with a model that does not accept PDF input.
- The request fails:
this model does not support pdf input.
Reproducible consistently.
Expected Behavior
Pasting a document path should insert the path as text so the agent can read it with tools. Auto-attachment should be limited to images, which vision-capable models can consume — or there should be a setting to disable file-path auto-attachment.
Actual Behavior
Any pasted text that resolves to an existing binary file is attached. PDFs become [PDF n], which text-only models cannot read, so the turn fails instead of passing the path to the agent.
Additional Context
Relevant code: packages/tui/src/component/prompt/index.tsx
pasteInputText()computespastedFilepath(text), callsreadLocalAttachment(filepath), and forattachment.type === "binary"callspasteAttachment().pasteAttachment()labels PDFs as[PDF n]and images as[Image n].
Possible fixes (either):
- Only auto-attach images; insert everything else as text:
if (attachment?.type === "binary") {
if (!attachment.mime.startsWith("image/")) {
input.insertText(normalizedText)
return
}
await pasteAttachment({ filename, filepath, mime: attachment.mime, content: ... })
return
}
- Add a CLI setting (e.g. in
~/.config/opencode/cli.json), such as:
{ "prompt": { "paste_attach": "images" } }
with values images | all | never.
The second keeps the current behavior available for users who do want document attachments.
- 主要言語
- TypeScript
- スター
- 215k
- フォーク
- 28.9k
- 平均マージ
- 8時間 11分
- マージ済み PR(30日)
- 365
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
anomalyco/opencode#57711 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
pending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
anomalyco/opencode#57664 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
anomalyco/opencode#57579 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#57536 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fs: /cd and file pickers fail on FreeBSD/ZFS — `stat` throws "dev exceeds the safe integer range" (fixed in @effect/platform-node-shared 4.0.5)対応中かも @argszero が 1 日前に担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
anomalyco/opencode#57518 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
agent/scanner help wanted hive/claimed-by-scanner kind/bug stage/020-claimed
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
hivecommons/rationguard#315 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area: ui-sdk priority: p3 type: chore
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
schlessera/brain-kit#2534 ·
メンテナーはふだん 1 日以内に返信
-
bug lane:gh-5
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
LLM-4-People/bridlewise-testing#122 ·
メンテナーはふだん 1 日以内に返信
-
bug priority: P2
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信