Skip to content

fix: macOS multiprocessing failures + unused import in CI - #152

Merged
bodencrouch merged 1 commit into
masterfrom
fix/rewrite-queue-macos-multiprocessing
Jul 30, 2026
Merged

fix: macOS multiprocessing failures + unused import in CI#152
bodencrouch merged 1 commit into
masterfrom
fix/rewrite-queue-macos-multiprocessing

Conversation

@bodencrouch

Copy link
Copy Markdown
Contributor

Summary

Two pre-existing CI failures on master, found while verifying the swkotor.exe autonomous recovery loop end-to-end.

  • tests/test_rewrite_queue.py's two concurrency tests create multiprocessing.Process without specifying a start method, defaulting to "spawn" on macOS (vs "fork" on Linux). Spawn re-imports the target in a fresh interpreter instead of reusing the parent's loaded image — fails on macOS CI with ModuleNotFoundError (test package not reliably importable there) and, for the one locally-nested function, AttributeError (can't pickle a <locals> function at all).
  • Reproduced the exact failure class locally on Linux via an explicit spawn context before fixing, to confirm root cause rather than guessing.
  • Fixed by forcing multiprocessing.get_context("fork") explicitly (available on both Linux and macOS — the only two CI platforms) and moving the previously-nested _writer to module level as defense in depth.
  • source_parity_synthesize.py: removed an unused .state.now import (ruff F401) — unrelated pre-existing dead import blocking the lint CI step.

Test plan

  • Reproduced the macOS-specific failure locally via an explicit spawn multiprocessing context
  • 601 unit tests pass after the fix
  • ruff check clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ros3797gzvmswnJudQ1Znk

Two pre-existing CI failures on master, discovered while verifying the
swkotor.exe autonomous recovery loop end-to-end:

- tests/test_rewrite_queue.py's two concurrency tests create
  multiprocessing.Process with the default start method, which is "spawn"
  on macOS (vs "fork" on Linux). Spawn re-imports the target function in a
  fresh interpreter rather than reusing the parent's loaded image -- this
  fails on macOS CI with ModuleNotFoundError ("tests" package not reliably
  importable by the fresh interpreter) and, for a locally-nested function,
  AttributeError (can't pickle a <locals> function at all). Reproduced
  locally on Linux via an explicit spawn context to confirm the exact
  failure class, then fixed by forcing multiprocessing.get_context("fork")
  explicitly (available on both Linux and macOS, the only two CI
  platforms) and moving the previously-nested _writer to module level as
  defense in depth.
- source_parity_synthesize.py: removed an unused `.state.now` import
  (ruff F401), unrelated pre-existing dead import blocking the lint step.

601 unit tests pass; ruff clean.
@bodencrouch
bodencrouch merged commit 14f9ee1 into master Jul 30, 2026
20 checks passed
bodencrouch pushed a commit that referenced this pull request Jul 30, 2026
bodencrouch added a commit that referenced this pull request Jul 30, 2026
* fix: inc_abs_global never wires target-side relocation evidence

render_target_coff_for_candidate() can reconstruct the objdiff target
side with a matching symbol relocation for absolute-address references
(absolute_address_relocations(), already used by
bink_buffer_set_direct_draw_forwarder), but inc_abs_global() set
evidence={"absoluteAddress": ...} instead of the
absoluteAddressRelocations shape the consumer actually reads. The
target side was always rendered as a raw byte blob with the address
baked in literally, so any correct candidate referencing the global
through a compiler-visible symbol relocation could never byte-match --
confirmed against the real MSVC8/wine toolchain on FUN_004a23b0 in
swkotor-parity-inv, where an instruction-for-instruction identical
inline-asm rewrite still reported DIFF_ARG_MISMATCH. With the fix,
the same candidate reaches objdiff differences: 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ros3797gzvmswnJudQ1Znk

* fix: remove unused .state.now import (pre-existing ruff F401)

Pre-existing on master; blocks CI's ruff lint step. Unrelated to the
relocation-evidence fix itself; fixing since it's a one-line, zero-risk
removal blocking merge readiness.

* fix: macOS multiprocessing failures + unused import in CI (#152)

Two pre-existing CI failures on master, discovered while verifying the
swkotor.exe autonomous recovery loop end-to-end:

- tests/test_rewrite_queue.py's two concurrency tests create
  multiprocessing.Process with the default start method, which is "spawn"
  on macOS (vs "fork" on Linux). Spawn re-imports the target function in a
  fresh interpreter rather than reusing the parent's loaded image -- this
  fails on macOS CI with ModuleNotFoundError ("tests" package not reliably
  importable by the fresh interpreter) and, for a locally-nested function,
  AttributeError (can't pickle a <locals> function at all). Reproduced
  locally on Linux via an explicit spawn context to confirm the exact
  failure class, then fixed by forcing multiprocessing.get_context("fork")
  explicitly (available on both Linux and macOS, the only two CI
  platforms) and moving the previously-nested _writer to module level as
  defense in depth.
- source_parity_synthesize.py: removed an unused `.state.now` import
  (ruff F401), unrelated pre-existing dead import blocking the lint step.

601 unit tests pass; ruff clean.

Co-authored-by: Copilot <th3w1zard1@users.noreply.github.com>

---------

Co-authored-by: Copilot <th3w1zard1@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Boden Crouch <boden.crouch@gmail.com>
bodencrouch added a commit that referenced this pull request Jul 30, 2026
…150)

* docs: add [all] extra and document ilspycmd as external prerequisite

ilspycmd is ILSpy's .NET global tool (dotnet tool install -g ilspycmd),
not a PyPI package -- it cannot be expressed as a pip dependency, and
adding it to optional-dependencies would break `pip install
agentdecompile[all]` for everyone (confirmed: pip/uv cannot resolve it
under any name). Added an [all] extra bundling the real pip-installable
optional features (currently `semantic`) and documented ilspycmd
installation separately in the README as an external prerequisite.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ros3797gzvmswnJudQ1Znk

* fix: macOS multiprocessing failures + unused import in CI (#152)

Two pre-existing CI failures on master, discovered while verifying the
swkotor.exe autonomous recovery loop end-to-end:

- tests/test_rewrite_queue.py's two concurrency tests create
  multiprocessing.Process with the default start method, which is "spawn"
  on macOS (vs "fork" on Linux). Spawn re-imports the target function in a
  fresh interpreter rather than reusing the parent's loaded image -- this
  fails on macOS CI with ModuleNotFoundError ("tests" package not reliably
  importable by the fresh interpreter) and, for a locally-nested function,
  AttributeError (can't pickle a <locals> function at all). Reproduced
  locally on Linux via an explicit spawn context to confirm the exact
  failure class, then fixed by forcing multiprocessing.get_context("fork")
  explicitly (available on both Linux and macOS, the only two CI
  platforms) and moving the previously-nested _writer to module level as
  defense in depth.
- source_parity_synthesize.py: removed an unused `.state.now` import
  (ruff F401), unrelated pre-existing dead import blocking the lint step.

601 unit tests pass; ruff clean.

Co-authored-by: Copilot <th3w1zard1@users.noreply.github.com>

---------

Co-authored-by: Copilot <th3w1zard1@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant