You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Tool task panicked" crashes: pdf-extract panics on malformed PDFs; swarm context history byte-slices multibyte text #573
Two separate Tool task panicked crashes observed in production session logs, both reproducible on latest master (28e476ac). Each kills the running tool task and surfaces a raw panic to the model instead of a recoverable error.
1. read tool: pdf-extract panics on malformed PDFs
crates/jcode-pdf/src/lib.rs calls pdf_extract::extract_text directly. The pdf-extract crate panics on exotic/malformed PDFs, e.g.:
Error: Tool task panicked: task 235 panicked with message "unexpected entry in unicode map"
Error: Tool task panicked: task 629 panicked with message "explicit panic"
Fix: wrap extraction in std::panic::catch_unwind and return a normal error ("PDF text extraction failed (parser panic: ...)") so a bad PDF cannot take down the tool task.
2. swarm context history: byte-slice truncation panics on multibyte text
crates/jcode-protocol/src/comm_format.rsformat_comm_context_history truncates with &msg.content[..500] (byte index). With non-ASCII content (e.g. Vietnamese) index 500 can land inside a code point:
Error: Tool task panicked: task 10429 panicked with message
"end byte index 500 is not a char boundary; it is inside 'ủ' (bytes 499..502 of string)"
Fix: truncate on a char boundary via char_indices().nth(500).
Both crashes are fixed. jcode-pdf::extract_text now wraps pdf_extract in catch_unwind and returns "PDF text extraction failed (parser panic: ...)" instead of killing the tool task, and format_comm_context_history truncates on a char boundary rather than byte index 500. Regression tests added in both crates (cargo test -p jcode-protocol: 74 passed; -p jcode-pdf: 1 passed). Thanks for the clear panic traces.
— Jcode agent (automated triage), on behalf of @1jehuang
Note: the fix is committed on branch triage/2026-07-24-batch (pushed). GitHub's pull-request creation API is currently returning 500s repo-wide, so the PR link will follow once that clears.
— Jcode agent (automated triage), on behalf of @1jehuang
Activity
1jehuang commentedon Jul 24, 2026
Both crashes are fixed.
jcode-pdf::extract_textnow wrapspdf_extractincatch_unwindand returns "PDF text extraction failed (parser panic: ...)" instead of killing the tool task, andformat_comm_context_historytruncates on a char boundary rather than byte index 500. Regression tests added in both crates (cargo test -p jcode-protocol: 74 passed; -p jcode-pdf: 1 passed). Thanks for the clear panic traces.— Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Jul 24, 2026
Note: the fix is committed on branch
triage/2026-07-24-batch(pushed). GitHub's pull-request creation API is currently returning 500s repo-wide, so the PR link will follow once that clears.— Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Jul 24, 2026
GitHub's PR API recovered: the fix is now in #580.
— Jcode agent (automated triage), on behalf of @1jehuang
fix: recover pdf-extract panics and truncate swarm history on char bo…
fix: recover pdf-extract panics and truncate swarm history on char bo…
fix: recover pdf-extract panics and truncate swarm history on char bo…
fix: recover pdf-extract panics and truncate swarm history on char bo…