feat(finance): add continuous watch review loop#56
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c0d270975
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| summary = _compact_watch_session_summary(_summarize_watch_session(session)) if session else _empty_watch_session_summary(session_id=session_id) | ||
| rows = _read_watch_session_events(session, feed="all", limit=0) if session else [] |
There was a problem hiding this comment.
Avoid rescanning all events in each supervise iteration
_build_watch_session_review computes summary via _summarize_watch_session(session), which already performs a full _read_watch_session_events(..., limit=0) scan, and then immediately performs another full scan for rows on the next line. In watch-session supervise (especially long-running --iterations 0 sessions), this doubles per-iteration I/O and makes review latency grow with session size, so the supervisor can fall behind and produce increasingly stale diagnostics.
Useful? React with 👍 / 👎.
Summary
finance_pack.evidence_indexand addFinanceEvidenceRetrieverso CLI orchestration no longer owns retrieval internalsdisableduntil a real production embedding provider is configured, and v2 indexes force stale hash-vector indexes to rebuildfinance_intelligence_jobsplusfinance intelligence jobs/status/stop/resumeso agents can inspect, stop, and resume durable watch/intelligence runs without scraping logsfinance_intelligence_evaluationsplusfinance intelligence evaluate/eval-reportfor persisted-row signal/provider/retrieval/runtime quality metricsvelaria_python_localskill examples sovelaria_cli_runcan discover the complete workflowValidation
finance_pack.jobsand missingfinance_pack.evaluation, then fixed with focused testsuv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract-> 100 tests passedbazel test --cache_test_results=no //python:finance_pack_test //python:python_cli_contract_test //:python_ecosystem_regression-> 14 targets passeduv run --project python python python/velaria_cli.py finance intelligence --help-> includesjobs,status,stop,resume,evaluate, andeval-reportgit diff --check-> passedVELARIA_HOME=/tmp/velaria-finance-reviewfix-us-20260520:finance intelligence status --session-id us_watch_reviewfix_20260520 --format jsonreturnedevent_count=61,signal_count=4, andeffective_status=completedfinance intelligence search --query "AAPL MSFT NVDA realtime news fundamentals signal" --format jsonreturnedretriever=finance_evidence_retriever,index_status=hit,semantic.status=disabled,doc_count=61, and top symbol AAPLfinance intelligence jobs --session-id us_watch_reviewfix_20260520 --format jsonreturned the persistedevidence_search_jobunderfinance_intelligence_jobsfinance intelligence evaluate --session-id us_watch_reviewfix_20260520 --format jsonreturnedquality_status=ok,row_count=61,signal_count=4,search_count=9,job_count=1, andprovider_refetch=falsefinance intelligence eval-report --session-id us_watch_reviewfix_20260520 --format jsonreturnedquality_status=ok,no_hash_embedding=true, and research-only disclaimers9f2856a:native-and-pythonpassed,python-wrapper-leak-smokepassed, wheel jobs skipped by workflowNotes
Review follow-up: a318d4a
finance intelligence resumeso it only executes trusted persistedwatch-session startargv records with Python/module/session markers and matching argv fingerprint; untrusted records now return structuredresume_unavailableand do not callPopen.finance intelligence resumewhen the runtime is already running so it renders the normal intelligence report instead of exiting silently.vectors_path,vector_path,vectors_json,vector_count, and nested semantic provider metadata.Review follow-up validation:
uv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract-> 103 tests passed.bazel test --cache_test_results=no //python:finance_pack_test //python:python_cli_contract_test //:python_ecosystem_regression-> 14 targets passed.git diff --check-> passed./tmp/velaria-finance-reviewfix-us-20260520session:quality_status=failed,no_hash_embedding=false,provider_refetch=false.Review follow-up: 730c620
sec_user_agent_policy(), replacing the previous placeholder contact User-Agent with an environment-configurableVELARIA_SEC_USER_AGENTpolicy.finance doctorto reportsec_companyfacts_policyin JSON/text flows so agents and users can see whether SEC access is production-configured.velaria_python_localskill examples to tell users to set a descriptive SEC User-Agent before production fundamentals fetches.Review follow-up validation:
sec_user_agent_policywas missing.uv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract-> 105 tests passed.bazel test --cache_test_results=no //python:finance_pack_test //python:python_cli_contract_test //:python_ecosystem_regression-> 14 targets passed.uv run --project python python python/velaria_cli.py finance doctor --skip-network --format json-> reportssec_companyfacts_policywarning with default non-production policy.VELARIA_SEC_USER_AGENT=... finance doctor --skip-network --format json-> reportssec_companyfacts_policyok with configured env source.git diff --check-> passed.Information-source follow-up: 75def60
yahoo-finance-newsfor symbol-focused Yahoo Finance RSS headlines andsec-filingsfor official SEC EDGAR Atom filing events.source_category,source_type,source_score, andsource_score_reasonnow appear infinance sourcescatalog output and fetched evidence rows.source_scoreinto finance evidence structured ranking so higher-authority sources can influence hybrid search ordering alongside keyword, symbol, signal, and recency signals.velaria_python_localskill examples so agents can discover and run the new sources directly.Information-source validation:
classify_information_sourcewas missing.uv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract-> 109 tests passed.bazel test --cache_test_results=no //python:finance_pack_test //python:python_cli_contract_test //:python_ecosystem_regression-> 14 targets passed.uv run --project python python python/velaria_cli.py finance sources --format json-> catalog includes source category/type/score fields.finance fetch-news --provider yahoo-finance-news --market us --symbol AAPL --limit 2-> returned 2 scored news rows.VELARIA_SEC_USER_AGENT=... finance fetch-news --provider sec-filings --market us --symbol AAPL --limit 2-> returned SEC 10-Q/8-K filing rows withsource_score=0.96.git diff --check-> passed.Code-review follow-up: f9e47c9
source_category,source_type,source_score, andsource_score_reasonlike other fetched evidence rows.sec-filingsSEC ticker-map failures inFinanceProviderErrorso CLI/agent callers receive structured provider diagnostics instead of raw exceptions.provider=secbecause it is used by bothsec-companyfactsandsec-filings.fetch-news --queryhelp in both the direct finance pack parser and the publicvelaria financewrapper.Code-review follow-up validation:
finance fetch-news --helpnow documents provider-specific query semantics.uv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract-> 110 tests passed.bazel test --cache_test_results=no //python:finance_pack_test //python:python_cli_contract_test //:python_ecosystem_regression-> 14 targets passed.git diff --check-> passed.