agent review: reject future-dated sources at submit; treat fetched pages as data

validate() now takes the submission stamp and rejects any source without a
readable publication date or dated after the submission day (UTC). The skill
tells the agent and its subagents that web pages, news and filings are data,
never instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 22:24:47 -07:00
parent cd0721eada
commit 2ff7bc07cf
3 changed files with 50 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
"""Contracts of the agent-reviewed strategy: without score files it holds
exactly what its base strategy holds, a scores file only steers sessions it
was stamped before, and a vetoed holding is replaced the same session."""
was stamped before, a vetoed holding is replaced the same session, and
submit rejects sources dated after the submission."""
import json
import os
@@ -10,6 +11,7 @@ import unittest
import numpy as np
import pandas as pd
from agent_review import validate
from strategies.agent_review import AgentReviewStrategy, session_deadline
from strategies.robust_momentum import RobustMomentumStrategy
from tests.test_robust_strategies import _bars
@@ -72,5 +74,19 @@ class AgentReviewTests(unittest.TestCase):
self.assertTrue(np.allclose(after.iloc[:k + 1], before.iloc[:k + 1]))
class SubmitValidationTests(unittest.TestCase):
def _check(self, *dates):
pack = {"candidates": [{"ticker": "AAA"}]}
sub = {"scores": {"AAA": {"score": 0, "summary": "x",
"sources": [{"url": "u", "date": d} for d in dates]}}}
return validate(sub, pack, pd.Timestamp("2026-10-12 04:00", tz="UTC"))
def test_sources_must_be_dated_no_later_than_the_submission_day(self):
self._check("2026-10-09", "2026-10-12", "2026-09")
for bad in ("2026-10-13", "2026-10-12T23:00:00-04:00", None, "next week"):
with self.subTest(date=bad), self.assertRaises(ValueError):
self._check("2026-10-09", bad)
if __name__ == "__main__":
unittest.main()