TheRealAIGuy commited on
Commit
af6fa71
·
1 Parent(s): 5191f15

Silence Recon Engine For Sure

Browse files
final_check.py CHANGED
@@ -59,7 +59,7 @@ class FinalIntegrityCheck(unittest.TestCase):
59
  spec = yaml.safe_load(f)
60
 
61
  self.assertEqual(spec.get("app"), "server.app:app", "App entry point mismatch")
62
- self.assertEqual(spec.get("port"), 8000, "Port mismatch")
63
 
64
  tasks = spec.get("tasks", [])
65
  self.assertGreaterEqual(len(tasks), 3, "Missing required tasks (Easy, Medium, Hard)")
@@ -145,7 +145,7 @@ class FinalIntegrityCheck(unittest.TestCase):
145
  self.assertTrue(len(step_lines) >= 1, "No STEP lines found")
146
  for sl in step_lines:
147
  step_match = re.match(
148
- r'^\[STEP\]\s+step=\d+ action=.*? reward=-?\d+\.\d{2} done=(true|false) error=.*$',
149
  sl
150
  )
151
  self.assertIsNotNone(step_match, f"STEP line doesn't match regex: {sl}")
@@ -153,7 +153,7 @@ class FinalIntegrityCheck(unittest.TestCase):
153
  # Verify END tag format
154
  end_line = lines[-1]
155
  end_match = re.match(
156
- r'^\[END\]\s+success=(true|false) steps=\d+ score=-?\d+\.\d+ rewards=(?:-?\d+\.\d{2}(?:,-?\d+\.\d{2})*)?$',
157
  end_line
158
  )
159
  self.assertIsNotNone(end_match, f"END line doesn't match regex: {end_line}")
 
59
  spec = yaml.safe_load(f)
60
 
61
  self.assertEqual(spec.get("app"), "server.app:app", "App entry point mismatch")
62
+ self.assertEqual(spec.get("port"), 7860, "Port mismatch - HF requires 7860")
63
 
64
  tasks = spec.get("tasks", [])
65
  self.assertGreaterEqual(len(tasks), 3, "Missing required tasks (Easy, Medium, Hard)")
 
145
  self.assertTrue(len(step_lines) >= 1, "No STEP lines found")
146
  for sl in step_lines:
147
  step_match = re.match(
148
+ r'^\[STEP\] step=\d+ action=.*? reward=-?\d+\.\d{2} done=(true|false) error=.*$',
149
  sl
150
  )
151
  self.assertIsNotNone(step_match, f"STEP line doesn't match regex: {sl}")
 
153
  # Verify END tag format
154
  end_line = lines[-1]
155
  end_match = re.match(
156
+ r'^\[END\] success=(true|false) steps=\d+ score=-?\d+\.\d+ rewards=(?:-?\d+\.\d{2}(?:,-?\d+\.\d{2})*)?$',
157
  end_line
158
  )
159
  self.assertIsNotNone(end_match, f"END line doesn't match regex: {end_line}")
hf auditor/src/reconciliation_engine.hpp CHANGED
@@ -105,16 +105,6 @@ public:
105
  anomaly_matrix_.resize(anomaly_capacity_ * 4, 0.0f);
106
  reward_details_.resize(reward_details_capacity_, 0.0f);
107
 
108
- std::cout << "[C++] ReconciliationEngine initialized.\n"
109
- << " Pool capacity: " << actual_cap << " slots ("
110
- << (actual_cap * sizeof(TradeSlot)) / (1024 * 1024) << " MB)\n"
111
- << " Ring buffer: " << RING_BUFFER_CAPACITY
112
- << " slots ("
113
- << (RING_BUFFER_CAPACITY * sizeof(RingEntry)) / (1024 * 1024)
114
- << " MB)\n"
115
- << " Timer wheel: 3-level, 256 slots/level\n"
116
- << " Delta_max: 5.0 seconds\n"
117
- << " Risk score: (counterparty_id % 100) / 100.0\n";
118
  }
119
 
120
  // ================================================================
 
105
  anomaly_matrix_.resize(anomaly_capacity_ * 4, 0.0f);
106
  reward_details_.resize(reward_details_capacity_, 0.0f);
107
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  // ================================================================
inference.py CHANGED
@@ -108,15 +108,12 @@ def log_start(task: str, env: str, model: str) -> None:
108
  def log_step(step: int, action: str, reward: float, done: bool, error: Optional[str]) -> None:
109
  error_val = error if error else "null"
110
  done_val = str(done).lower()
111
- print(
112
- f"[STEP] step={step} action={action} reward={reward:.2f} done={done_val} error={error_val}",
113
- flush=True,
114
- )
115
 
116
 
117
  def log_end(success: bool, steps: int, score: float, rewards: List[float]) -> None:
118
  rewards_str = ",".join(f"{r:.2f}" for r in rewards)
119
- print(f"[END] success={str(success).lower()} steps={steps} score={score:.2f} rewards={rewards_str}", flush=True)
120
 
121
 
122
  def build_user_prompt(step: int, features: list[list[float]]) -> str:
@@ -212,7 +209,7 @@ def get_model_message(client: OpenAI, step: int, features: list[list[float]]) ->
212
  if len(row) >= 4:
213
  # Matches SYSTEM_PROMPT: 1 if > 0.60, 0 if < 0.30, 1 if in between.
214
  risk_score = row[3]
215
- fallback_decisions.append(0 if risk_score < 0.30 else 1)
216
  else:
217
  fallback_decisions.append(1)
218
 
 
108
  def log_step(step: int, action: str, reward: float, done: bool, error: Optional[str]) -> None:
109
  error_val = error if error else "null"
110
  done_val = str(done).lower()
111
+ print(f"[STEP] step={step} action={action} reward={reward:.2f} done={done_val} error={error_val}", flush=True)
 
 
 
112
 
113
 
114
  def log_end(success: bool, steps: int, score: float, rewards: List[float]) -> None:
115
  rewards_str = ",".join(f"{r:.2f}" for r in rewards)
116
+ print(f"[END] success={str(success).lower()} steps={steps} score={score:.2f} rewards={rewards_str}", flush=True)
117
 
118
 
119
  def build_user_prompt(step: int, features: list[list[float]]) -> str:
 
209
  if len(row) >= 4:
210
  # Matches SYSTEM_PROMPT: 1 if > 0.60, 0 if < 0.30, 1 if in between.
211
  risk_score = row[3]
212
+ fallback_decisions.append(0.01 if risk_score < 0.30 else 0.99)
213
  else:
214
  fallback_decisions.append(1)
215
 
openenv.yaml CHANGED
@@ -4,6 +4,7 @@ type: space
4
  runtime: fastapi
5
  app: server.app:app
6
  port: 7860
 
7
 
8
  tasks:
9
  - id: anomaly_detection_easy
 
4
  runtime: fastapi
5
  app: server.app:app
6
  port: 7860
7
+ entrypoint: server.fin_auditor_environment:FinAuditorEnvironment
8
 
9
  tasks:
10
  - id: anomaly_detection_easy