fix: run main body on a 16 MiB worker thread (Windows stack) (0.26.1)#48
Merged
Conversation
The command dispatch sits near Windows' 1 MiB main-thread stack limit — a single added branch overflowed it (STATUS_STACK_OVERFLOW at startup on every command). Move the real work into real_main() and run it on a 16 MiB worker thread so the dispatch can grow safely and this can't recur. Exit codes and panics propagate (verified: success=0, bail=1). claude-memory-65t Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#47 hit
STATUS_STACK_OVERFLOW(code -1073741571) on Windows: the binary crashed at startup on every command because the giant CLI command dispatch inmainsits near Windows' 1 MiB main-thread stack and one added branch tipped it over. Linux/macOS (8 MiB stack) were unaffected. #47 fixed the immediate case by extracting a branch; this removes the underlying time-bomb.Change
mainnow spawns the real work (real_main) on a worker thread with a 16 MiB stack, then joins and propagates the result. The dispatch can grow safely; a future added branch can't re-overflow it.--version→ 0,complete tj-nope(bail) → 1, invalid arg → 1.std::process::exit(...)paths still terminate the process from the worker thread.Tests
Full
test --workspacegreen (the integration suite exercises many commands and asserts.success()/.failure()exit codes through the wrapper). The real proof is Windows CI passing.🤖 Generated with Claude Code