Skip to content

issue_pdf_bug #2641

@njsgdd10086

Description

@njsgdd10086

Bug Report: read_file 读 PDF 不加 pages 参数导致 channel close

Description

read_file 读取 PDF 文件时,如果不指定 pages 参数(全量提取),工具调用会挂起无响应。按 ESC 中断后显示 Error: channel closed。但指定 pages 按页读取完全正常。

测试文件:教务系统导出的成绩单 PDF,60~80KB,仅 2 页,非扫描件(纯文本 PDF)。

Steps to reproduce

  1. 准备一个教务系统导出的 PDF(如附件的成绩单 PDF)
  2. 在 codewhale-tui 中执行:read_file("xxx.pdf", pages: "1") → 正常返回文本
  3. 执行:read_file("xxx.pdf") 不加 pages 参数 → 挂起无响应
  4. 按 ESC → Error: channel closed

Expected behavior

不加 pages 参数时正常提取全部页面文本,行为应与 pages: "1-N" 一致。

Actual behavior

工具调用挂起,通信 channel 断开。

Impact

每次读 PDF 必须手动指定 pages 范围。如果不知道 PDF 页数,需要先试探页数,体验较差。这个问题 100% 可复现于该测试文件。

Environment

  • OS: Windows(传统控制台主机,非 Windows Terminal)
  • codewhale version: 0.8.49 (492f20d)
  • Install method: release binary (codewhale-tui.exe)
  • codewhale doctor summary:
    • pdftotext: not found(使用内置纯 Rust 提取器)
    • tesseract: not found(无 OCR)
    • sandbox: not available
  • Model/provider: deepseek-v4-pro / DeepSeek
  • Terminal app: Windows Console Host(legacy)
  • Shell: PowerShell

Logs, screenshots, or recordings

  • pages: "1" 正常返回
  • pages: "2" 正常返回
  • 不加 pages → 挂起 → ESC → Error: channel closed
  • 文件仅 60~80KB、2 页,排除文件过大或 OCR 慢的可能
  • 怀疑纯 Rust PDF 提取器在全量提取模式下,对某些 PDF 交叉引用表/字体编码存在死循环

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status
    In progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions