Restore 45-action factored space via Branching DQN (Tavakoli 2018), outputting 11 Q-values (5+3+3) instead of 45. This was reduced to 5 exposure-only actions during debugging and was never intended as permanent. - Enable use_branching: true by default in DQNConfig and DQNHyperparameters - Add branching paths to select_action_with_confidence and select_action_inference - Update agent.rs select_action_factored for branching-aware selection - Expand CountBonus to per-branch tracking with bonuses_branched() - Add order_type + urgency distribution tracking in monitoring - Add DQN_ORDER_ACTIONS=3, DQN_URGENCY_ACTIONS=3, DQN_TOTAL_ACTIONS=45 to CUDA header - Fix 7 pre-existing clippy doc_markdown errors in regime_conditional.rs - Fix pre-existing cognitive_complexity in replay_buffer_type.rs (extract helpers) - Fix flaky GPU test OOM under parallel execution (CPU fallback + test VRAM safety) - Delete unused flash_attention submodules (block_sparse, causal_masking, etc.) - Add GPU hot-path guard scripts and ensemble/hyperopt adapter improvements Tests: ml-dqn 416/0, ml 905/0, clippy 0 errors on both crates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
903 B
Bash
Executable File
34 lines
903 B
Bash
Executable File
#!/bin/bash
|
|
# Claude Code PostToolUse hook: HARD ERROR on GPU→CPU leaks in hot-path files.
|
|
# Reads JSON from stdin (Claude Code hook input), extracts file_path, runs guard.
|
|
# Exit 1 = leak detected → Claude Code blocks the edit and must fix immediately.
|
|
set -euo pipefail
|
|
|
|
INPUT=$(cat)
|
|
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty' 2>/dev/null)
|
|
|
|
if [ -z "$FILE" ] || [ ! -f "$FILE" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Only check Rust files
|
|
case "$FILE" in
|
|
*.rs) ;;
|
|
*) exit 0 ;;
|
|
esac
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
GUARD="$SCRIPT_DIR/gpu-hotpath-guard.sh"
|
|
|
|
if [ -x "$GUARD" ]; then
|
|
OUTPUT=$("$GUARD" "$FILE" 2>&1) || {
|
|
echo "⛔ GPU HOT-PATH HARD ERROR in $FILE"
|
|
echo "$OUTPUT"
|
|
echo ""
|
|
echo "CPU usage in GPU hot paths is NOT allowed. Fix the code — do not annotate with // gpu-ok:"
|
|
exit 1
|
|
}
|
|
fi
|
|
|
|
exit 0
|