Repository navigation
Fix routed cancellation lifecycle and clarify order execution code - #39
Merged
Richard-LZ-Zhang merged 5 commits intoOct 22, 2026
Conversation
Rename risk and child-order helpers, decompose routed replanning, and document current lifecycle behavior and proposed cancellation work. Verified 289 offline tests passed; 23 skipped.
Richard-LZ-Zhang
merged commit Oct 22, 2026
27b4ea4
into
codex/order-lifecycle-storage
5 checks passed
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
A routed bucket parent could stay
cancellingindefinitely after a venue acknowledged cancellation while still reporting its child open: later child updates and timer ticks were gated onworking. Routing-boundary stops could also receive callbacks before leavingworking.Enter
cancellingbefore requesting cancellations, keep processing child results and retry cleanup on timer ticks, and prevent replacement allocations while stopping. Preserve the original incomplete ending across retries and restart; a complete fill wins over cancellation. Existing public statuses and stop reasons remain unchanged.Includes the requested readability checkpoint: descriptive risk/controller/callback names, purpose comments,
_replanstages, and local lifecycle walkthroughs. Integrates the current experimental base, including updated RFQ callers. Python names are intentionally changed on this development branch; HTTP contracts are unchanged.Test coverage and verification
Review
/reviewcovered scope, concurrency, callers/contracts, tests, maintainability, security/performance and an independent adversarial pass. Corrected two stale RFQ method references; added actual database restart tests; clarified internal journal downgrade documentation. No unresolved introduced defect identified by those passes. Independent CLI review also reported no introduced bugs; its runtime attempt lackedeth_utils, while the parent environment produced the passing test evidence above. GitHub CI remains pending.Documentation
Lifecycle documentation is alongside the implementation. Engine README clarifies that some upstream downgrade functions remove fields or recreate tables empty. No website documentation or SDK release/version changes.
Rollout and scope
Merge into
codex/order-lifecycle-storageonly. This is a feature PR into the terminal-compatible experimental branch; it does not merge the umbrella experimental PR into publicmain, create a release or publish to PyPI.Workspace PR https://github.com/Synpath-ai/prediction_market/pull/106 now follows the latest
codex/order-lifecycle-storagecommit, per the agreed development policy. It removes the fixed workspace SHA pin, verifies existing clean checkouts against the latest remote tip without changing local files, and records tested commits in CI evidence. SDK-first landing, backups and rollback limits are documented there. This SDK PR merged after all native/pure-Python, Rust and PostgreSQL CI passed.The cancellation patch adds a field to existing managed snapshots and adds no migration. The workspace's older pin-to-pin upgrade includes other upstream changes and migrations; its rollout plan covers that wider upgrade.
Failed venue reads, uncertain sends, routing-time cancellation acknowledgments, consistent stop reasons, bucket synchronization and amendments remain deferred. This PR handles tracked-child stopping and does not establish complete recovery safety for unattended live routing.