Skip to content

Port daemon and offers lifecycle to native Rust engine#96

Merged
hoffmang9 merged 21 commits into
mainfrom
cursor/daemon-rust-cycle-phases-3-4
May 30, 2026
Merged

Port daemon and offers lifecycle to native Rust engine#96
hoffmang9 merged 21 commits into
mainfrom
cursor/daemon-rust-cycle-phases-3-4

Conversation

@hoffmang9
Copy link
Copy Markdown
Owner

Summary

  • Move daemon cycle orchestration, reconcile, watchlist, offer dispatch, and coin-op phases into greenfloor-engine, with greenfloord and manager offers commands delegating to native CLI subcommands (daemon, offers-reconcile, offers-status, offers-cancel).
  • Slim PyO3 to dict/serde boundaries for cycle entry (run_daemon_cycle_once, run_daemon_loop); delete Python shims (cycle_runner, offers_lifecycle, offer_watchlist, market-cycle stack, strategy dispatch stack).
  • Extract shared Dexie cancel executor, canonicalize reconcile_offer (break reconcile_phase circular dependency), and tighten cancel CLI (--venue dexie only; remove dead onchain flags).

Test plan

  • pre-commit run --all-files (ruff, pyright, pytest)
  • pytest tests/ — 496 passed, 4 skipped
  • Live testnet soak: greenfloor-engine daemon --once + offers-reconcile against configured market

Made with Cursor

hoffmang9 and others added 20 commits May 29, 2026 20:22
Move reconcile/cancel phases and cycle entry into greenfloor-engine,
delegate inventory/strategy/coin_ops via a Python subprocess bridge, and
route greenfloord --once through the native engine binary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use an in-process bridge for embedded cycles, detach during block_on so Dexie
mock I/O is not blocked for 20s, and remove duplicate Python dispatch/shim paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Unifies loop and run-once on run_daemon_cycle_once with Rust preamble,
inventory/strategy/coin-op planning, honest parallel_markets, and non-zero
exit when every selected market fails.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire key allowlist, real coinset websocket-once capture, honest coin-op
planning with vault mixed-split execution, ledger writes, and simpler
parallel market dispatch so the native cycle matches Python behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drive inventory/strategy/cancel/coin_ops from the Rust phase table with
correct cancel-before-coin_ops ordering, unify daemon entry on the engine
binary, and port watchlist/inventory logic with unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Run the cycle in-process via run_daemon_cycle_once, port active-offer
counting and sequential strategy execution to Rust, drop duplicate
strategy_offer_execution audits, and split coin_ops_execution.

Co-authored-by: Cursor <cursoragent@cursor.com>
Split storage sqlite and watchlist modules, tighten engine cycle request typing, and delete obsolete Python dispatch tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add offer-dispatch unit tests, shared managed post helper, DaemonCycleSummary and request test_controls, fix parallel transient detection, and move watchlist tests out of mod.rs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Unify greenfloord --once on the in-process engine path, introduce MarketCycleContext
with single config load, port disabled-market and stale-sweep behavior to Rust, align
parallel offer dispatch errors, and move websocket-capture coverage to Rust tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the phase enum loop with a direct pipeline using MarketCycleResultState, add typed PyO3 cycle request/response classes, consolidate disabled-market logging and websocket policy, remove dead subprocess entry points, and restore offer-dispatch integration tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move lock, logging, websocket loop, and offer-dispatch tests to the Rust engine; unify cycle metrics on MarketCycleResultState and use dict JSON at the PyO3 boundary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Consolidate phase dispatch, reconcile augmentation, and coinset helpers in Rust; expose typed cycle request/response classes; remove duplicate Python inventory and logging glue.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move coin watchlist and dispatch orchestration into the engine, flatten market cycle phases, and slim Python to PyO3 wrappers with matching tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Scope watchlist to per-loop cache, run markets sequentially on one SQLite connection, unify path resolution, drop dead Python glue, and emit JSON cycle summaries from PyO3.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove duplicate reconcile/cycle glue, add typed lock errors and Rust reconcile tests, and fix Dexie 404 handling on the production path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move CLI batch reconcile into reconcile_offers_batch, drop duplicate Python orchestration and watchlist shims, unify build-and-post on in-process PyO3, and remove the native daemon run-once CLI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Markets always run sequentially in-process; remove the ignored config flag.
Add typed cycle/reconcile/build-post PyO3 types, DexieOfferPayload, shared
engine_bridge helpers, Rust coinset WS handler tests, and test updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move CLI reconcile, long-running loop, and reload handling into the engine, delete Python mirror layers, and use JSON/dict PyO3 contracts instead of hand-maintained wrapper types.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Extract shared Dexie cancel executor, canonicalize reconcile_offer, unify daemon PyO3 on dict/serde boundaries, and delete cycle_runner/offers_lifecycle/watchlist shims.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hoffmang9 hoffmang9 marked this pull request as ready for review May 30, 2026 08:59
Serialize global offer-dispatch test overrides with TestHooksScope so concurrent Rust tests on Linux CI cannot clobber each other's transient/fatal modes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hoffmang9 hoffmang9 merged commit 8df35a0 into main May 30, 2026
3 checks passed
@hoffmang9 hoffmang9 deleted the cursor/daemon-rust-cycle-phases-3-4 branch May 30, 2026 09:35
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