- SPRINT_BOARD.md: stage GAP-025/GAP-030 and correct GAP-062 deploy status - TASK_GAP025_RUNNER_ORDER_LIFECYCLE_LOGGING_PROMPT.md: add runner lifecycle logging prompt - TASK_GAP030_ORB_HYDRATION_VERIFY_PROMPT.md: add ORB hydration verify prompt - TASK_GAP051/052/059/060 prompts: record commit-only deploy instruction - TASK_GAP054_RUNNER_TRAIL_PROMPT.md: clarify SIM/replay validation path - docs/00-governance/2026-08-19-run-book.md: reconcile implemented/verified task states - docs/00-governance/active_work.md: update blocker status and validation requirements - docs/00-governance/decisions.md: record prompted follow-ups and resolved GAP-062 deploy status Build: clean | Tests: 569 passing | Deploy: GAP-062 deployed backup 20260826_005308
7.9 KiB
TASK: GAP-025 — runner/scaler order lifecycle invisible in the persistent session log
Staged: 2026-08-26 (long-queued Sprint 2.7 item, now prompted; DEC-20260825-07)
Sprint: Stage 1 — diagnostic logging only, zero trading-behaviour risk
Owner: Kilocode
Deploy: COMMIT ONLY — do NOT run deploy-to-nt8.bat or copy build output to
the live NT8 install as part of this task. Verify-build and commit
as usual; leave the deploy step for the operator to run manually
once ready.
─────────────────────────────────────────────────────────────────
THE DEFECT (why this is worth doing)
GAP-025 has sat in the backlog since Sprint 2.7 as "Runner No-Fill Anomaly
Diagnosis" with no concrete spec. Reading the actual order/execution
handling in NT8StrategyBase.cs on 2026-08-26 found a real, specific gap
that explains why a runner no-fill would be nearly undiagnosable from the
session log alone:
-
OnOrderUpdate(src/NT8.Adapters/Strategies/NT8StrategyBase.cs~1270-1301) never callsFileLogfor any order state transition. It onlyPrints (visible live in NT8's Output window only, not in the persistent session file) and only takes any other action (_circuitBreaker.RecordOrderRejection) for theRejectedstate specifically. Every other transition an order goes through — submitted, accepted, working, part-filled, cancelled — is invisible in the file log entirely. If a runner order is submitted but never acknowledged, or acknowledged but later cancelled by the broker, or stuck in a pending state, none of that appears anywhere insession_*.log. -
OnExecutionUpdate'sFILLline (NT8StrategyBase.cs~1306-1345) logs market position, quantity, price, and order ID — but not the order/signal name. Since a single trade submits two independently named orders (SDK_{Symbol}_S_{hex}for the scaler leg,SDK_{Symbol}_R_{hex}for the runner leg — seeSubmitOrderToNT8,NT8StrategyBase.cs~2240-2242), aFILLline in the log currently cannot tell you which leg filled. You cannot distinguish "the runner never got submitted," "the runner was submitted and rejected," "the runner is still working, unfilled," and "the runner filled but the scaler didn't" purely from the file log — diagnosing any of GAP-025's original "no-fill anomaly" concern currently requires NT8's live Output window open at the exact moment, which defeats the purpose of file-based session logging (the same motivation GAP-035 was originally built for).
This task closes that gap: make the full order lifecycle for both legs independently visible in the persistent session log after the fact, with zero change to order-management or execution logic itself.
READ-FIRST
src/NT8.Adapters/Strategies/NT8StrategyBase.cs~1270-1345 —OnOrderUpdate/OnExecutionUpdate, the two methods this task changes.src/NT8.Adapters/Strategies/NT8StrategyBase.cs~2171-2350 —SubmitOrderToNT8, to confirm the_scalerSignalName/_runnerSignalNamenaming convention and the existingSIGNAL/SUBMITFileLog lines this task's new lines will sit alongside.src/NT8.Adapters/Strategies/NT8StrategyBase.cs— the existingFileLogmethod (find its definition) to confirm signature and any existing rate-limiting/formatting conventions to stay consistent with.tests/NT8.Core.Tests/Adapters/SimpleORBNT8DefaultsTests.cs— the established source-text-assertion pattern this codebase already uses forNT8StrategyBase/SimpleORBNT8methods that can't be instantiated or invoked outside a live NT8 host (NinjaScript-derived classes). This task's tests will likely follow the same pattern.
THE CHANGE
-
OnOrderUpdate: for orders whoseorder.Namestarts withSDK_(the existing filter already applied earlier in the method), add aFileLogcall on every invocation — not just onRejected— recording at minimum: the order name (signal, so scaler vs runner is identifiable),orderState,filled/quantity, andaverageFillPrice. Suggested format (adjust to match this file's existingFileLogconventions):ORDER {order.Name} State={orderState} Filled={filled}/{quantity} AvgFillPrice={averageFillPrice:F2}. Gate it the same way other per-barFileLogcalls in this file are gated (state/logging-enabled checks — check how nearby methods do it, e.g.OnExecutionUpdate's existingState != State.Realtimeguard, and mirror that convention here too — catch-up replay order-state noise should not flood the live session log any more than fills already avoid it). Keep the existingPrintcall, the existingRejected-specific_circuitBreaker.RecordOrderRejectioncall, and the existing_executionAdapter.ProcessOrderUpdatecall completely unchanged — this is purely an additionalFileLogline, not a replacement. -
OnExecutionUpdate: add the order/signal name (execution.Order.Name) to the existingFILLline so scaler and runner fills are distinguishable after the fact. Do not change the line's other fields, theOrderFill/PortfolioRiskManager.ReportFillcall, or the_executionAdapter.ProcessExecutioncall.
DO NOT
- Do not change
SubmitOrderToNT8,EnterLong/EnterShort,SetStopLoss/SetTrailStop/SetProfitTarget, or any order-submission logic — this task only adds logging around order/execution events that already occur. - Do not change
_circuitBreakerlogic,_executionAdapter.ProcessOrderUpdate/ProcessExecutioncall arguments, orPortfolioRiskManager.ReportFill. - Do not change the existing
SIGNAL/SUBMIT/STATE/STATE_DETAIL/STATE_CONTEXT/PNL_UPDATE/REJECT/REJECT SUMMARYline formats — only add the newORDERline and extend the existingFILLline with one additional field. - Do not touch risk, sizing, or grade-filter code.
TESTS (required)
- A test proving
OnOrderUpdatenow emits aFileLogcall (source-text assertion, consistent with this codebase's established pattern for NinjaScript-derived methods — grep the compiled method body for the newFileLog/ORDERcall, same tier asSimpleORBNT8DefaultsTests.cs's existing tests) for state transitions beyondRejected, not just the rejection case. - A test proving the
FILLline format inOnExecutionUpdatenow includes the order/signal name. - A test proving the existing
Rejected-specific_circuitBreakerbehavior and the existingProcessOrderUpdate/ProcessExecutioncalls are unchanged (still present, same call sites, same arguments) — this task must be additive only. - Confirm the full existing suite still passes.
VALIDATION (operator)
No live order-management behavior changes — this is additive logging
only. Genuine validation is observational: the next SIM trade with an
active runner leg should show separately identifiable ORDER SDK_..._S_...
and ORDER SDK_..._R_... lines through their full lifecycle in
session_*.log, and FILL lines that name which leg filled. If the
runner leg has ever silently failed to fill, this is what will finally
show why — submitted-but-never-accepted, accepted-but-cancelled, or
genuinely never filled while working.
GOVERNANCE
Track as [GAP-025] in SPRINT_BOARD.md — move out of the "QUEUED —
branch-only during Gate Run #2" framing (that gate-sequencing language is
stale; this is diagnostic-only and safe to prompt now) into an
IMPLEMENTED/PROMPTED entry consistent with tonight's other tasks. Update
docs/00-governance/decisions.md with a new dated entry referencing this
task and DEC-20260825-07.
Reference: this task, DEC-20260825-07, TASK_GAP054_RUNNER_TRAIL_PROMPT.md
(the related runner-trail fix this diagnostic work follows up on).