[codex] fix EasySession input buffer lifetime#111
Merged
Conversation
| s.insert("edge", [2, 3]) | ||
| # Force Python allocations in the same window where step() also | ||
| # performs mode/callback bookkeeping. | ||
| _junk = [b"edge" for _ in range(32)] |
| } | ||
|
|
||
| s.insert("edge", [3, 4]) | ||
| _junk = [b"edge" for _ in range(32)] |
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.
Summary
Fixes a PyreWire FFI lifetime bug exposed by wirelog#863.
EasySession.insert()andremove()were passing temporary Python-ownedbytesandctypes.c_int64[]buffers into the wirelog easy facade, then allowing those objects to be reclaimed before the next evaluating call. If Python bookkeeping or other allocations happened beforestep(), the C incremental path could consume stale row pointers and emit missing deltas.This keeps easy-facade input buffers alive on the session until
step()orsnapshot()has consumed them, and clears the keepalive list afterward. The same keepalive treatment is applied to the variadicinsert_sym/remove_sympath.Validation
.venv/bin/ruff check src testspassedWIRELOG_LIB=/home/joykim/git/semantic-reasoning/wirelog/builddir-861/libwirelog.so.1 PYTHONPATH=src .venv/bin/pytest -q -o addopts='' tests/test_easy_session.py tests/test_easy_step_snapshot.py tests/test_easy_deltas.py tests/test_easy_insert_sym.py tests/test_async.pypassed: 48 passedWIRELOG_LIB=/home/joykim/git/semantic-reasoning/wirelog/builddir-861/libwirelog.so.1 PYTHONPATH=src .venv/bin/pytest -qreached 93.20% coverage but failed one existing metadata test:tests/test_changelog_format.py::test_topmost_released_section_matches_pyprojectbecauseCHANGELOG.mdtopmost released section is0.41.0whilepyproject.tomlis0.41.99.Notes
Raw
ctypescalls intowirelog_easy_set_delta_cb/wirelog_easy_stepwith a manually retained row buffer produced the expected reachability deltas, confirming the C easy facade was not the failing layer in this reproduction.