Files
nt8-sdk/TASK_GAP048_REJECT_TAXONOMY_PROMPT.md
mo d84949caa3 chore: checkpoint remaining pre-gate worktree changes
- governance: stage v7.0 review prompts, run book, roadmap/current-status/decision updates, and sprint board state

- adapters: capture DASH/trailing-drawdown/state-telemetry strategy work already present in the worktree

- tools: capture dashboard console/KPI parser updates, logtriage notes, and runnersweep output

Build: previously clean | Tests: previously 511 passing | Includes all open staged files
2026-08-21 14:53:15 -04:00

89 lines
4.1 KiB
Markdown

# TASK: GAP-048 — Split the overloaded reject-reason taxonomy
# Staged: 2026-08-18 (v7.0 review, Finding 2 remedy (a))
# Sprint: Stage 0 — Unblock (P0-C). Diagnostics only, zero trading-behaviour risk.
# Owner: Kilocode
# ─────────────────────────────────────────────────────────────────
## THE DEFECT
`REJECT SUMMARY` aggregates on `reason`. Three reasons are overloaded, so the
counts an operator and the dashboard read are ambiguous.
`KillSwitch` is emitted by FOUR distinct paths in NT8StrategyBase.cs:
~721 the actual kill switch (EnableKillSwitch=True KillSwitchTriggered=True)
~1970 portfolio risk block (Portfolio blocked: ...)
~2000 Tier 1 per-strategy risk (Risk manager rejected: ...)
~2055 circuit breaker open (Circuit breaker open: ...)
`GradeFilter` is emitted by FOUR paths:
~1979 EnableLongTrades=False
~1986 EnableShortTrades=False
~2020 sized below MinContracts
SimpleORBStrategy.cs ~613/~622 regime veto before score
SimpleORBStrategy.cs ~650 genuine grade-below-threshold
`TrailingDrawdownBreach` covers both a real breach and an unconfigured monitor.
`OrbRangeNotEstablished` covers three distinct ORB states.
## WHY IT MATTERS — two days, two meanings, one label
2026-08-17 session_20260817_082103.log REJECT SUMMARY: reason=KillSwitch count=647
→ detail=EnableKillSwitch=True KillSwitchTriggered=True (a real kill switch)
2026-08-18 session_20260818_071117.log REJECT SUMMARY: reason=KillSwitch count=5
→ detail=Risk manager rejected: Trade risk too high: $225.00 (MaxTradeRisk)
The `detail` line distinguishes them, but `detail` is rate-limited to the first
occurrence per reason, so the aggregate count is all an operator sees. This
directly defeats what GAP-035 was built for.
## THE CHANGE
Replace the overloaded literals with distinct reasons. Suggested set — confirm
naming before implementing:
KillSwitch (leave ~721 as-is)
PortfolioRisk (~1970)
MaxTradeRisk (~2000)
CircuitBreaker (~2055)
LongTradesDisabled (~1979)
ShortTradesDisabled (~1986)
SizeBelowMinContracts (~2020)
RegimeVeto (SimpleORBStrategy ~613/~622)
GradeFilter (SimpleORBStrategy ~650 — genuine grade rejection only)
TrailingDrawdownBreach (real breach only)
TrailingDrawdownNotConfigured (misconfiguration — coordinate with TASK_GAP045_GAP046)
Leave `OrbRangeNotEstablished` alone for now unless it is trivial — its three
sub-states are already distinguishable in `detail` and it is lower priority.
## CONSTRAINTS
- Logging only. MUST NOT change any guard's CONDITION, ORDER or OUTCOME.
- `REJECT:` and `REJECT SUMMARY:` LINE FORMATS must not change — only the value
of the `reason=` token. Downstream parsers (`tools/dashboard/parsers.py`,
`tools/logtriage/logtriage.py`, `tools/logwatch/logwatch.py`) are
reason-agnostic and should need no change. VERIFY that claim by reading them
rather than assuming it.
- `LogRejectRateLimited()` rate-limits per unique reason. Splitting reasons
therefore INCREASES the number of `REJECT:` detail lines slightly. Confirm
this is acceptable and note the expected volume change.
- The `HistoricalReplayCatchup` exemption in `LogRejectRateLimited()` must be
preserved (DEC-20260818-08).
## TESTS
Assert each of the paths above produces its own distinct `reason` value.
Assert the line format is byte-identical apart from the reason token.
## VALIDATION (operator)
Run one session and confirm `REJECT SUMMARY` shows distinct reasons, and that
the dashboard's rejection panels still render without a frontend change.
## GOVERNANCE
Track as [GAP-048] in SPRINT_BOARD.md. decisions.md entry recording the final
reason vocabulary — it becomes a contract for every downstream tool.
Reference: NT8_SDK_Master_Document_v7.0 Finding 2, Appendix B, Section 9.3 (P0-C).