anomalyco / anomalyco/opencode
[BUG] /compact crashes with EXC_BREAKPOINT (SIGTRAP) on macOS arm64 — Worker thread hits PAC trap
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Running /compact in the TUI causes opencode to crash immediately with EXC_BREAKPOINT (signal 5 / SIGTRAP). The process dies with zsh: trace trap opencode --auto and the terminal returns to the shell. This happens every time /compact is invoked, not intermittently.
Environment
- opencode version: 1.18.25 (installed via
npm install -g opencode-ai) - OS: macOS 26.5.1 (25F80), Apple Silicon (Mac17,9, arm64)
- Terminal: Apple Terminal (also reproduced from VS Code integrated terminal)
- Provider: Custom OpenAI-compatible proxy at
http://127.0.0.1:8787/v1(Sarvam Code gateway, modelglm-5.2) - Low power mode: was active at time of crash
Reproduction
- Start a session, work in it until context is moderately large (multiple tool calls, file reads, etc.)
- Run
/compact - Process crashes immediately —
zsh: trace trap opencode --auto
Crash details
Two crash reports generated (both today, same crash signature):
~/Library/Logs/DiagnosticReports/opencode.exe-2026-09-01-092213.ips~/Library/Logs/DiagnosticReports/opencode.exe-2026-09-01-092337.ips
Key crash info
exception: EXC_BREAKPOINT (signal SIGTRAP, code 5)
faultingThread: 13 (named "Worker")
esr.description: "Breakpoint pointer authentication trap IB"
uptime: 15000ms (process lived ~15 seconds before crash)
The crash is in the opencode.exe binary itself (imageIndex 0, offset 4503560), on a Worker thread. The PAC trap indicates an intentional __builtin_trap() or failed assertion in opencode's own code, not a segfault from bad memory access.
The crashing Worker thread stack shows the crash going through opencode's own code (imageIndex 0) at multiple frames, with a call into a dynamic library (imageIndex 6) before the trap.
Thread 13 (crashing thread) frame summary
imageOffset 4503560 (imageIndex 0) — opencode.exe
imageOffset 4474264 (imageIndex 0)
imageOffset 4507908 (imageIndex 0)
imageOffset 4507032 (imageIndex 0)
imageOffset 4469380 (imageIndex 0)
imageOffset 4467780 (imageIndex 0)
imageOffset 4488216 (imageIndex 0)
imageOffset 3125464 (imageIndex 0)
imageOffset 4739350588 (imageIndex 6) — dynamic library
imageOffset 52998948 (imageIndex 0)
imageOffset 4753733888 (imageIndex 6)
...
Expected behavior
/compact should summarize the context and continue the session, not crash the process.
Additional context
- This is not the "Compaction produced no summary" error (issue #42371) — the process hard-crashes before any response.
- The crash happens before any request reaches the provider proxy (confirmed via proxy logs — no
/compact-related request was logged). - Memory usage was high before the crash (~4.6 GB for the main opencode process), which is why
/compactwas being invoked. - Config has
compaction.auto: trueandcompaction.reserved: 300000.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing /compact in the TUI on macOS arm64 and inspect the two DiagnosticReports paths listed in the issue, especially the crashing Worker thread and PAC trap. Trace the relevant /compact entry point and its worker path; done means compaction no longer terminates the process and the session continues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, typescript
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100