Skip to content

Prevent freezes when expanding large generic tool details#137

Merged
dnouri merged 1 commit intomasterfrom
fix/large-tool-call-output-syntax
Feb 23, 2026
Merged

Prevent freezes when expanding large generic tool details#137
dnouri merged 1 commit intomasterfrom
fix/large-tool-call-output-syntax

Conversation

@dnouri
Copy link
Copy Markdown
Owner

@dnouri dnouri commented Feb 23, 2026

What this fixes

Expanding/collapsing large generic tool details (especially subagent output) could trigger expensive full-region markdown fontification and sometimes fail with Stack overflow in regexp matcher.

What changed

  • Mark generic **Details** payload as metadata (pi-coding-agent-no-fontify)
  • On toggle, fontify only non-metadata ranges
  • Stop fontification after the first font-lock failure in a toggle pass (prevents repeated failing work)
  • Keep toggle resilient on font-lock errors (debug-only diagnostic)
  • Unify collapsed/expanded tool-content insertion path to reduce drift

User-visible outcome

  • Large details can be toggled repeatedly without freezing
  • No regexp stack overflow in details-heavy toggles
  • Non-details syntax highlighting still works as expected

Verification

  • make check green (655 tests)
  • Manual stress check in emacs -nw + tmux:
    • ~1.5MB details payload
    • 60 repeated toggles
    • no freeze, no overflow
    • non-details highlighting confirmed
@dnouri dnouri force-pushed the fix/large-tool-call-output-syntax branch from 0a3ad51 to 636350f Compare February 23, 2026 11:05
- mark generic Details payload as metadata via pi-coding-agent-no-fontify
- on expand/collapse, fontify only non-metadata ranges
- stop after first font-lock failure in a toggle pass; keep debug-only diagnostics
- share rendered-content insertion between collapsed and expanded paths
- add regressions for large details toggles, range splitting, non-nil exclusion values, and path-based generic tools
@dnouri dnouri force-pushed the fix/large-tool-call-output-syntax branch from 636350f to b0dda53 Compare February 23, 2026 11:48
@dnouri dnouri merged commit 7bb772e into master Feb 23, 2026
7 checks passed
@dnouri dnouri deleted the fix/large-tool-call-output-syntax branch February 23, 2026 12:07
dnouri added a commit that referenced this pull request Feb 25, 2026
- mark generic Details payload as metadata via pi-coding-agent-no-fontify
- on expand/collapse, fontify only non-metadata ranges
- stop after first font-lock failure in a toggle pass; keep debug-only diagnostics
- share rendered-content insertion between collapsed and expanded paths
- add regressions for large details toggles, range splitting, non-nil exclusion values, and path-based generic tools
dnouri added a commit that referenced this pull request Feb 26, 2026
- mark generic Details payload as metadata via pi-coding-agent-no-fontify
- on expand/collapse, fontify only non-metadata ranges
- stop after first font-lock failure in a toggle pass; keep debug-only diagnostics
- share rendered-content insertion between collapsed and expanded paths
- add regressions for large details toggles, range splitting, non-nil exclusion values, and path-based generic tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant