feat(auto-trading): restore Phase 1 snapshot scheduler after UTA-split#207
Open
marrrrrcus wants to merge 4 commits into
Open
feat(auto-trading): restore Phase 1 snapshot scheduler after UTA-split#207marrrrrcus wants to merge 4 commits into
marrrrrcus wants to merge 4 commits into
Conversation
readMarketSnapshotFile + all_clear notify re-added to Alice main process. Uses Pump (not cron engine) — consistent with heartbeat pattern post-split. - src/domain/auto-trading/market-snapshot.ts: reads/validates market-snapshot.json - src/domain/auto-trading/scheduler.ts: Pump tick, dedup prevAllClear set, stale-snapshot + CIRCUIT_BREAKER=HALT guards, notify via ConnectorCenter - src/core/config.ts: autoTradingSchema (enabled=false, tickEvery=15m, marketSnapshotPath=data/market-snapshot.json), wired into Config + sectionSchemas - src/main.ts: createAutoTradingScheduler() after heartbeat, stop() in shutdown Phase 2 (open/reduce/stp order execution via UTA HTTP routes) deferred. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- scheduler.spec.ts: 7 cases covering all Phase 1 success criteria (notify once on transition, no re-notify on stay, re-notify after false, stale skip, CIRCUIT_BREAKER=HALT skip, missing file skip, price=undefined guard) - scheduler.ts: add runNow() to interface (delegates to pump.runNow()) - scheduler.ts: fix price cast — typeof guard, falls back to 0 instead of undefined Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…joined cmdline
On Windows, node_modules/.bin entries are .CMD files. node's spawn()
without shell:true looks for tsx.exe and throws ENOENT. Fix: join
command+args into a single string when shell:true (avoids DEP0190
concat warning). Non-Windows paths unchanged.
Also fix scheduler.spec.ts: createEventLog now takes {logPath} opts
object, not a bare string path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stderr capture + explicit exe path - Upgrade @anthropic-ai/claude-agent-sdk 0.2.72 → 0.3.150 (claudeCodeVersion 2.1.150, resolves protocol mismatch with user's claude.exe 2.1.149) - Upgrade @modelcontextprotocol/sdk 1.27.1 → 1.29.0 (peer dep for new agent SDK) - query.ts: always capture claude.exe stderr so exit-code-1 errors include the real error message (previously stderr was /dev/null by default) - query.ts: on Windows, resolve claude.exe path explicitly via APPDATA lookup so the SDK doesn't rely on PATH finding it - guardian/shared.ts: use cmd.exe /c for spawning .cmd shims on Windows (fixes EINVAL), resolve local .bin shims via resolveLocalBin() - guardian/dev.ts: inject claude.exe directory into PATH so agent-sdk subprocess can find it; detect latest versioned dir under %APPDATA%\Claude\claude-code\ Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
Restore the read-only auto-trading snapshot notification layer that was
lost during the UTA-split refactor. Phase 1 only — order execution deferred
to Phase 2 pending new UTA HTTP routes.
Changes
src/domain/auto-trading/market-snapshot.ts— reads and validatesmarket-snapshot.jsonwritten byokx_snapshot_writer.pysrc/domain/auto-trading/scheduler.ts— Pump-driven tick (not cron engine),prevAllCleardedup set, stale-snapshot +CIRCUIT_BREAKER=HALTguards,connectorCenter.notify()for signal notificationsrc/core/config.ts—autoTradingSchema(enabled=falsedefault,tickEvery,marketSnapshotPath), wired into Config + sectionSchemassrc/main.ts— wirecreateAutoTradingScheduler()after heartbeat,stop()in shutdownPer-session contributions
2026-05-24 — Auto-trading Phase 1 restore
stale skip, CIRCUIT_BREAKER=HALT skip, missing file, missing price guard
c105576,0ed8be4Test plan
pnpm vitest run src/domain/auto-trading/scheduler.spec.ts→ 7 passednpx tsc --noEmit— no new errors (existing workspace dependency errors unrelated)data/config/auto-trading.json:{"enabled":true,"tickEvery":"15m","marketSnapshotPath":"data/market-snapshot.json"}🤖 Generated with Claude Code