Repository navigation
Mover mode's first Alpaca paper runs on the Mac (trials A and C) and the partial-fill precision fix - #205
Conversation
Trial mover-mac-20260924a ran the mover trial mode against Alpaca paper for the first time: five scanner-selected entries and three X2 exits filled, then GRML's exit filled in parts at 15.00 and 15.01. Alpaca's six-decimal cumulative average (15.000833) made the native adapter derive 15.009996 and stop with cumulative_fill_precision_requires_reconciliation. Forced recovery sold the rest; the account reconciled flat, P&L +0.87 USD, recover proof passed. The trial record and its offline verifier are under trials/mac-2026-09-24-mover-a/. native_adapter.execution_price takes each fill's own execution price from the trade-update event when its quantity equals the new shares and it agrees with the reported average; otherwise it rounds the derived price only when the average's reporting bound is under half a price unit. Anything else still stops the adapter. The new native tests reproduce the run's arithmetic and fail on the previous adapter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…evidence manifest Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…sonl; force-added like the stop drill's) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…idence (1149 trading, 14 data) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ter and the ledger An independent pre-merge review (Codex, a different model family) found the first version too narrow: rounding assumed one price per snapshot delta, the tolerance came from the normalized string's exponent, an exactly representable derived price was accepted without an ambiguity check, a contradictory execution event was replaced by a derived price, and the ledger's limit check still halted on rounded averages at the limit (1 x 100.00 then 2 x 100.01 at 100.01 derives 100.0100005). fills.resolve_execution now accepts an execution event only when its price is on the grid and agrees with the average (else fill_event_price_requires_reconciliation), and otherwise requires the new shares' notional to be the only whole number of ticks strictly within filled x 0.000001 of the report, dividing into an on-grid price per share. It computes in its own decimal context. The ledger's limit check halts only on a violation that is certain within fills.incremental_notional_bound. Each counterexample from the review is a test; the ledger test fails on main's safety.py. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ifest Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lse halt separately The delta review of the previous commit found that loosening the ledger's limit check by the rounding bound lets a real one-tick violation pass on large 4-decimal orders (buy limit 0.9354, 99 x 0.9354 then 1 x 0.9355, reported 0.935401). A correct check needs grid resolution of both cumulative notionals, fractional-share handling and a chosen trade-off between false halts and missed violations, which belongs in its own change. safety.py is back to main; the guard test that a certain violation halts stays (it passes on main). The adapter's fill resolution (fills.py) is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Independent pre-merge review record (Codex CLI, OpenAI family; read-only). Round 1 reviewed the first fix ( Round 1No blocker found; the major findings below warrant fixes before merge.
Read-only probes reproduced these findings; the two extracted arithmetic tests passed. The full native suite was not run because Nautilus was unavailable in the review interpreter. Delta verification
NEW major — real limit violations can pass the relaxed check ( All 11 arithmetic tests passed. Ledger counterexamples used SQLite in memory; no files modified. |
|
A second native case for this fix, from the WSL host's adaptive 1x leverage-ladder attempt on 2026-09-24. Full record in #212,
Expected resolution. The final share's price is 126.31, because 884.29 / 7 = 126.327142857…, which rounds to 126.327143. The pair is (6, 126.33) → (7, 126.327143), with one new share, so it may already be covered by your unambiguous-derived-price path. It could still serve as a regression fixture taken from a different lane (adaptive, not mover) and a different host. 🤖 Generated with Claude Code |
…e; first 1x leverage-ladder attempt (needs_attention) (#212) Native-fault receipt.json is now the 2026-09-24 18:58Z run on the #198 order-contract engine (native_faults_passed, bound to main 3b7ae71, with an independent observation). The 14:39Z receipt is retained as receipt-20260924t143905.json. The first 1x leverage-ladder attempt (ladder-1x-20260924a) is retained as a failure: needs_attention after 190 s on a false-positive fill-precision refusal (the #205 class; broker FILL activities show on-grid executions), flat and reconciled, peak leverage 0.151. Rate-limit evidence regenerated (705/14). No gate status changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…quotes, needs_attention, not flat The second broker run of the mover mode (engine at d7a11b3, the first fill-fix version; no partial fills occurred): four entries filled at the quoted ask; GCTK was skipped. After a market-data websocket reconnect at 15:49, PFSA and SRZN quotes stayed stale, the transport's 3 s required-symbol freshness froze it, and X1 at 15:58 never sent. The hard flatten latched at 16:01:22 and GRML's sell was attempted but never reached Alpaca (client-ID 404). Recovery fails closed on that ambiguous intent ("owned intent absent from complete snapshot"), and after-hours quotes are too sparse for the freshness rule even at the 30 s maximum. Four paper positions remain open pending an operator decision. The verifier now separates integrity checks from reported outcomes, and the order-throughput evidence counts the new headers (1629 trading, 15 data). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… the evidence manifest Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… fill-precision branch Conflicts were registries and counts only: took main's copies, regenerated the rate-limit evidence (1693 trading, 16 data headers), re-pinned this branch's five sources in source-hashes.json and re-registered its files in the evidence manifest. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Trading lane, 2026-09-25: a proposal for landing this PR, given #221. #221, the adaptive-paper engine P0 release (merged as 8bd4ca7 on 2026-09-25), fixes the same false That makes the Proposal:
If the Mac coordinator is active, please take it or reply here. If this PR is still idle by the next session, the trading lane will do the three steps above, following the dormant-owner merge etiquette the user approved, and post the result here before merging. 🤖 Generated with Claude Code |
…ls, executable rollback (B3, B4, B5) B4: the before-GET, PUT, after-GET and PR-status claims are labelled historical, recorded by the PR author, output not retained. Measured today (2026-09-29T03:18:04Z, read-only): the recorded diff of the live ruleset 23739774 against origin/main (b0fb65b, GitHub's main tip then) exited 0 after stripping eight response-metadata keys and sorting rules by type; the rules order is the only other difference; the 57fb6d8 negative control exits 1 on the sota-sources context only; updated_at is still the recorded PUT second. packet.md L90-92 cited as historical corroboration. B3: rollback is git show 57fb6d8:.github/main-ruleset.json | gh api --method PUT .../rulesets/23739774 --input - (not run); verified 57fb6d8's file equals 7bbb021's minus sota-sources (jq -S, cmp exit 0) and main still carries 7bbb021's file. B5: a rebase is not the only way to get a sota-sources run (validate.yml L6-9 reopened/edited; docs/lanes.md merge path), GitHub starts no pull_request run while a PR conflicts, and reporting is not passing (the job reads only the description, L517-521); #205/#216 measured CONFLICTING with no sota-sources run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uire sota-sources (#430) * docs/lanes.md: merge with the reviewed head pinned (--match-head-commit) Strict up-to-date checks stay off and this User-owned repository cannot use a merge queue (docs/decisions/2026-09-22-github-automation-closure.md), so `gh pr merge <N> --squash --match-head-commit <SHA>` is the guard against merging a head nobody reviewed (https://cli.github.com/manual/gh_pr_merge). It was practised but not written down: grep for match-head-commit across docs, recipes, adoption, examples and AGENTS.md returned nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Decision record: close the sota-sources ruleset drift with dated GETs The live ruleset 23739774 now requires the committed eight checks. Before-GET 21:00:04Z (seven, no sota-sources); PUT of .github/main-ruleset.json at main e82e6be at 21:00:13Z; after-GET matches the committed file. Records the open PRs affected at PUT time and the rollback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs/lanes.md merge guard: pin the checked and reviewed head read just before merge (B1, B2) B1: <SHA> is the full 40-character headRefOid read with gh pr view <N> --json headRefOid,statusCheckRollup immediately before the merge, on which the review completed and every required check ran with none running or failed. The hot-file protocol's rebase or merge of main comes before that read; if main changed a shared hot file after <SHA>, merge main again, wait for the checks on the new head and pin it; the review carries over only if the reviewed files are byte-identical (GitHub's stale-approval rule, available-rules-for-rulesets). Sources: gh 2.101.0 'gh pr merge --help'; cli/cli v2.101.0 pkg/cmd/pr/merge/http.go L77-80 (expectedHeadOid); GraphQL MergePullRequestInput.expectedHeadOid read by schema introspection and in github/docs src/graphql/data/fpt/schema-pulls.json. B2: the flag guards the head, not the base: with strict up-to-date checks off and no merge queue, two PRs green against an older main can still break it together (GitHub docs, loose required status checks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drift closed entry: measured live-ruleset comparison, historical labels, executable rollback (B3, B4, B5) B4: the before-GET, PUT, after-GET and PR-status claims are labelled historical, recorded by the PR author, output not retained. Measured today (2026-09-29T03:18:04Z, read-only): the recorded diff of the live ruleset 23739774 against origin/main (b0fb65b, GitHub's main tip then) exited 0 after stripping eight response-metadata keys and sorting rules by type; the rules order is the only other difference; the 57fb6d8 negative control exits 1 on the sota-sources context only; updated_at is still the recorded PUT second. packet.md L90-92 cited as historical corroboration. B3: rollback is git show 57fb6d8:.github/main-ruleset.json | gh api --method PUT .../rulesets/23739774 --input - (not run); verified 57fb6d8's file equals 7bbb021's minus sota-sources (jq -S, cmp exit 0) and main still carries 7bbb021's file. B5: a rebase is not the only way to get a sota-sources run (validate.yml L6-9 reopened/edited; docs/lanes.md merge path), GitHub starts no pull_request run while a PR conflicts, and reporting is not passing (the job reads only the description, L517-521); #205/#216 measured CONFLICTING with no sota-sources run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hot-file step: re-register docs/lanes.md and the automation-closure record in manifests/evidence.json Registered with host_receipts.register_file; component_matrix.py --write and new_host_grand_list.py --write left the four generated reports unchanged; scripts/validate.py passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs/lanes.md: read the pinned head's required checks with gh pr checks --required; move merge-guard mechanics to the decision record The round-one verifier showed the documented statusCheckRollup filter prints superseded runs, so 'none failed' could not be judged with it (merged #389, #411 and #413 each show an earlier sota-sources failure and a later success on the final head). gh pr checks --required lists only the required checks with the latest run of each; measured exit 0 (all passed), 1 (one failed, none pending) and 8 (pending). The implementation-level citations move to the decision record, the stale-approval comparison is called an analogy, and 'today' leaves the dated record. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Scout <scout@local> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#221 (8bd4ca7, merged 2026-09-25) books each trade_updates fill as its own execution and closes fill gaps from GET /v2/account/activities/FILL, so the adapter never derives a price from a cumulative average. That supersedes fills.py's inference (trading-lane proposal on PR #205, step 1). - Remove blueprints/us-equities/adaptive-paper/fills.py and tests/test_adaptive_paper_fills.py. - Restore native_adapter.py, tests/test_adaptive_paper_native.py and README-mover.md to the merge base, so the merge takes main's versions. The native test changes exercised fills.py's price recovery from rounded averages (dropped). The same-quantity average-correction test duplicates main's test_same_quantity_with_a_changed_average_still_freezes (dropped). - Keep tests/test_adaptive_paper_safety.py's test_a_certain_limit_violation_still_halts: main's ledger still books a cumulative-only observation from the averages, with a rounding tolerance, and this is the only test that a certain violation still halts there. - source-hashes.json: the base copy, re-pinned for the kept safety test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on branch Conflicts and their resolution: - manifests/evidence.json: main's copy, unchanged here. The branch's files are re-registered in the last commit (docs/lanes.md hot-file protocol). - blueprints/us-equities/adaptive-paper/source-hashes.json: main's copy, re-pinned for the one file the merge leaves changed, tests/test_adaptive_paper_safety.py (main plus the kept test_a_certain_limit_violation_still_halts). native_adapter.py, tests/test_adaptive_paper_native.py and README-mover.md now equal main's (#221 per-execution booking; #559 FEE reconciliation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cord #501 (df41236) made rate_limit_evidence.py read a fixed DATED_TRIAL_FILES set, so that a trial committed later cannot move the 2026-09-24 totals. That set was built on main, where this branch's two mover trials were not yet merged. They also ran on 2026-09-24, and this branch's record already counts them (1693 trading and 16 data headers). After the merge, --check reported the record stale and test_rate_limit_evidence_is_current_and_matches_brief failed (705/14 built vs 1693/16 committed). - Append trials/mac-2026-09-24-mover-a/mover-paper.json and trials/mac-2026-09-24-mover-c/mover-paper.json to DATED_TRIAL_FILES. `--write` reproduces the committed record byte for byte, and `--check` passes. - test_a_later_trial_receipt_does_not_change_the_dated_evidence: expect the dated totals with the mover trials (16 and 1693). A later trial still does not move them. rate_limit_evidence.py is outside the brief's path list, so this change is a separate commit. To drop it, revert this commit and restore main's rate-limit-evidence-20260924.json, its order-throughput/README.md row and the test_order_throughput.py totals line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otocol) docs/lanes.md hot-file protocol, merge path. The merge took main's manifests/evidence.json unchanged. This commit registers, through scripts/host_receipts.register_file: - the changed files main's manifest already lists: adaptive-paper/source-hashes.json, order-throughput/rate_limit_evidence.py, tests/test_adaptive_paper_safety.py and tests/test_order_throughput.py; - the 37 new trial-record files this branch registered (trials/mac-2026-09-24-mover-a/ and trials/mac-2026-09-24-mover-c/). Not re-added: order-throughput/README.md and rate-limit-evidence-20260924.json. They are changed, not new, and main's manifest does not list them. fills.py and tests/test_adaptive_paper_fills.py are gone, and main's manifest never listed them. scripts/component_matrix.py --write and scripts/new_host_grand_list.py --write left their reports unchanged. scripts/validate.py passed (8669 hashed files), and scripts/evidence_manifest.py --check passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Trading lane, 2026-10-01 ~02:50Z (native-agent-stack-ae): landing under the 2026-09-25 proposal (comment 5838301567). This is the note posted before merging. The PR had been idle since 2026-09-25. The branch now carries three changes, all on top of the original head
The full account, including the one file outside the proposal's list ( Verification: an independent Claude Opus verifier passed it.
Merge: in the Gate A train's next free slot, after the hot-file step on the then-current |
…tocol) manifests/evidence.json is main's copy (3361b34) with this branch's files re-registered through scripts/host_receipts.register_file; component_matrix.py --write and new_host_grand_list.py --write re-run (no change). scripts/validate.py and scripts/evidence_manifest.py --check exit 0 on this tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Landing (2026-10-01, trading lane
native-agent-stack-ae), per the 2026-09-25 proposal (comment 5838301567)This PR was idle from 2026-09-25 (Mac coordinator), so the trading lane landed it under the dormant-owner etiquette: a merge, never a rewrite or force-push, with this note posted before merging. The
fills.resolve_executionsections below describe the original head29c4a87eand are superseded.1b1b7469):blueprints/us-equities/adaptive-paper/fills.py,tests/test_adaptive_paper_fills.py, thenative_adapter.pyhook (now equal tomain's), and the native test changes that only fed the dropped tests.trade_updatesfill as its own execution and gap-fills fromGET /v2/account/activities/FILL, so the fills inference is redundant.test_same_quantity_average_change_beyond_rounding_still_needs_reconciliationwas dropped as redundant:main'stest_same_quantity_with_a_changed_average_still…covers the same behaviour.trials/mac-2026-09-24-mover-{a,c}/, byte-identical to the PR head.fillsmodule. It is part of the frozen trial record, so it is left as written, and this note supersedes it.test_a_certain_limit_violation_still_halts(+21 lines; it passes againstmain's ledger, and a tolerance mutant makes it fail).order-throughput/README.md,rate-limit-evidence-20260924.json).c2171fddalso editsorder-throughput/rate_limit_evidence.py, which builds that dated record. It adds the two trial receipts toDATED_TRIAL_FILES, so the builder reproduces the committed record byte for byte.--checkpasses.origin/main(merge commit4a92d944atdca821cc, which includes Adaptive paper: book Alpaca FEE activities in ledger cash accounting (unblocks account 2's IOVA recovery) #559).docs/lanes.mdhot-file protocol, in the last commit (e5a001e5).execution_idor per-event quantity or price), so there are no events to replay.Verification (independent Claude Opus verifier, read-only): pass. Every
tests/test_adaptive_paper_*,tests.test_mover_*andtests.test_order_throughputmodule ran under the pinned runtime:Ran 1403 tests,OK (skipped=4), withNativeIntegration10/10.scripts/validate.pyandscripts/evidence_manifest.py --checkpassed. Lows are recorded above.SOTA sources
TradingStreamtrade_updatesper-execution events: https://github.com/alpacahq/alpaca-py/tree/v0.44.0.GET /v2/account/activities/FILLgap-fill: https://docs.alpaca.markets/us/docs/account-activities.md (updatedAt 2026-05-25).Scope
lane:trading. The trading lane (native-agent-stack-71) ownsblueprints/us-equities/adaptive-paper/; this PR comes from the Mac coordinator, which operates this Mac's own Alpaca paper account. Please acknowledge or review before merge.main, merged in at5e95754(Record the 2026-09-24 trading-star refresh: 15 new stars and 6 re-reviews in the star audit #207), not rebased, so trial C's frozen source commitd7a11b3stays in history. Wire the order-contract boundary into every Alpaca paper submit (local refusal before any network call) #198 also editssource-hashes.json; whichever merges second re-pins.fills.py, resolves every native fill's price.native_adapter.observeuses it.trials/mac-2026-09-24-mover-a/andtrials/mac-2026-09-24-mover-c/.safety.py. Its limit check has a related false halt, tracked in Ledger limit check halts falsely on rounded averages at the limit; a bound-only fix misses real violations #211 (see Review).What the paper run found
Trial
mover-mac-20260924aran at 12:45 ET on this Mac's paper account, frozen before any broker I/O (FREEZE.md):10:00|G0.20|V250000|any, with a late scan and entry and X2 as recorded deviations.(12 x 15.000833 - 165) / 1 = 15.009996and stopped withcumulative_fill_precision_requires_reconciliation.recoverpassed.needs_attention, recorded as-is. Peak use was 23 requests and 5 submits per 60 s, against the 200 and 180 caps.Fix:
fills.resolve_executionfilled x avgmisses the true notional by strictly less thanfilled x 0.000001(Alpaca's six-decimal report; the transport drops trailing zeros, so the string's own exponent is not used). Every execution price is on the instrument's grid.fill_event_price_requires_reconciliation. It is never replaced by a derived price.cumulative_fill_precision_requires_reconciliation. That covers several execution prices in one report and an ambiguous notional, even one with an on-grid derived price.observetracks the exact resolved notional, and it compares same-quantity repeats within the bound. The module computes in its own decimal context, and native prices use fixed-point text.Review
An independent pre-merge review ran with Codex, a different model family, read-only. Its first round found no blocker, five majors and two minors against the first version of this fix. That version rounded the derived price when
2 x filled x unit < delta x tick.(0, 0, 100, 0.935401)now refuses15,15.0and1E+1all use 0.000001; a 15.01→15 correction is refused(299, 279.6846, 300, 0.935401)refusestests/test_adaptive_paper_fills.py, 10 tests, stdlib only. Ledger coverage moves with #211Evidence-class table
native_papertrials/mac-2026-09-24-mover-a/mover-paper.json,mover-recovery.json,ledger-readback.jsonlocal_integrationpython3 trials/mac-2026-09-24-mover-a/verify_mover_trial.py trials/mac-2026-09-24-mover-a→ 9 oklocal_integrationmain's adapter: both FakePort modes fail withorder_cumulative_fill_precision_requires_reconciliationlocal_integrationpython3 -m unittest tests.test_adaptive_paper_fills→ 10 OK, no Nautiluslocal_integrationlocal_integrationscripts/validate.pypassed (5,325 hashed files);evidence_manifest.py --checkpassed; CI green on each pushed headTrial C (
trials/mac-2026-09-24-mover-c/): not flat, operator decision neededSetup: the engine at
d7a11b3(the first version of this fix), the candidate's X1 exit, entries at 14:52 ET. Four entries filled at the quoted ask. No partial fills occurred, so the fill code path was not reached.owned intent absent from complete snapshot). After-hours quotes are also too sparse for the freshness rule, even at its 30 s maximum.Tracked in #215: per-symbol freshness for exits and recovery, and an operator resolution for attempted-but-absent intents.
Not covered
--allow-shared-account). Its next trial here will refuse withnext_trial_cash_mismatchuntil the lanes use separate paper accounts.🤖 Generated with Claude Code