Skip to content

feat(finance): add continuous watch review loop#56

Merged
ashione merged 16 commits into
mainfrom
auto/finance-continuous-watch
May 20, 2026
Merged

feat(finance): add continuous watch review loop#56
ashione merged 16 commits into
mainfrom
auto/finance-continuous-watch

Conversation

@ashione

@ashione ashione commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • add productized finance intelligence stages for persistent evidence indexes, retriever runtime, durable job control, and replay evaluation
  • split finance evidence indexing/search logic into finance_pack.evidence_index and add FinanceEvidenceRetriever so CLI orchestration no longer owns retrieval internals
  • remove hash embedding from the finance intelligence product path; semantic retrieval is explicitly disabled until a real production embedding provider is configured, and v2 indexes force stale hash-vector indexes to rebuild
  • add finance_intelligence_jobs plus finance intelligence jobs/status/stop/resume so agents can inspect, stop, and resume durable watch/intelligence runs without scraping logs
  • add finance_intelligence_evaluations plus finance intelligence evaluate/eval-report for persisted-row signal/provider/retrieval/runtime quality metrics
  • update CLI help, Python README, plan/spec docs, and velaria_python_local skill examples so velaria_cli_run can discover the complete workflow

Validation

  • TDD red checks observed for missing finance_pack.jobs and missing finance_pack.evaluation, then fixed with focused tests
  • uv run --project python python -m unittest python.tests.test_finance_pack python.tests.test_python_cli_contract -> 100 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 intelligence --help -> includes jobs, status, stop, resume, evaluate, and eval-report
  • git diff --check -> passed
  • focused changed-file secret scan -> no real secrets found
  • live persisted-session status smoke with VELARIA_HOME=/tmp/velaria-finance-reviewfix-us-20260520: finance intelligence status --session-id us_watch_reviewfix_20260520 --format json returned event_count=61, signal_count=4, and effective_status=completed
  • live retrieval smoke on the same session: finance intelligence search --query "AAPL MSFT NVDA realtime news fundamentals signal" --format json returned retriever=finance_evidence_retriever, index_status=hit, semantic.status=disabled, doc_count=61, and top symbol AAPL
  • live durable job smoke on the same session: finance intelligence jobs --session-id us_watch_reviewfix_20260520 --format json returned the persisted evidence_search_job under finance_intelligence_jobs
  • live replay evaluation smoke on the same session: finance intelligence evaluate --session-id us_watch_reviewfix_20260520 --format json returned quality_status=ok, row_count=61, signal_count=4, search_count=9, job_count=1, and provider_refetch=false
  • live evaluation report smoke on the same session: finance intelligence eval-report --session-id us_watch_reviewfix_20260520 --format json returned quality_status=ok, no_hash_embedding=true, and research-only disclaimers
  • GitHub PR checks for latest commit 9f2856a: native-and-python passed, python-wrapper-leak-smoke passed, wheel jobs skipped by workflow

Notes

  • Outputs remain research evidence only, not investment advice.
  • Replay/evaluation commands read persisted rows and durable job/search/index events only; they do not refetch public providers.
  • Quote freshness is provider-reported; Yahoo U.S. quotes may be delayed.
  • Semantic retrieval remains disabled until a production embedding provider is explicitly configured.

Review follow-up: a318d4a

  • Hardened finance intelligence resume so it only executes trusted persisted watch-session start argv records with Python/module/session markers and matching argv fingerprint; untrusted records now return structured resume_unavailable and do not call Popen.
  • Fixed text-mode finance intelligence resume when the runtime is already running so it renders the normal intelligence report instead of exiting silently.
  • Extended replay evaluation hash checks to detect legacy vector/hash artifacts such as vectors_path, vector_path, vectors_json, vector_count, and nested semantic provider metadata.
  • Added regression tests for all three review findings.

Review follow-up validation:

  • Focused red/green tests for the three findings: 4 tests passed after fixes.
  • 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.
  • focused changed-file secret scan -> no secrets found.
  • live persisted-session evaluation smoke now detects legacy hash-vector artifacts in the older /tmp/velaria-finance-reviewfix-us-20260520 session: quality_status=failed, no_hash_embedding=false, provider_refetch=false.

Review follow-up: 730c620

  • Added a structured SEC Company Facts provider policy via sec_user_agent_policy(), replacing the previous placeholder contact User-Agent with an environment-configurable VELARIA_SEC_USER_AGENT policy.
  • Wired finance doctor to report sec_companyfacts_policy in JSON/text flows so agents and users can see whether SEC access is production-configured.
  • Updated Python README and velaria_python_local skill examples to tell users to set a descriptive SEC User-Agent before production fundamentals fetches.

Review follow-up validation:

  • TDD red check observed before implementation: focused tests failed because sec_user_agent_policy was missing.
  • Focused red/green tests for SEC policy/fetch/doctor: 3 tests passed.
  • 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 -> reports sec_companyfacts_policy warning with default non-production policy.
  • VELARIA_SEC_USER_AGENT=... finance doctor --skip-network --format json -> reports sec_companyfacts_policy ok with configured env source.
  • git diff --check -> passed.
  • focused diff secret scan -> no secret-pattern hits in added lines.

Information-source follow-up: 75def60

  • Added two more public, no-key information sources: yahoo-finance-news for symbol-focused Yahoo Finance RSS headlines and sec-filings for official SEC EDGAR Atom filing events.
  • Added provider/row-level source classification and scoring: source_category, source_type, source_score, and source_score_reason now appear in finance sources catalog output and fetched evidence rows.
  • Fed source_score into finance evidence structured ranking so higher-authority sources can influence hybrid search ordering alongside keyword, symbol, signal, and recency signals.
  • Updated Python README and velaria_python_local skill examples so agents can discover and run the new sources directly.

Information-source validation:

  • TDD red check observed before implementation: focused tests failed because classify_information_source was missing.
  • Focused red/green tests for provider catalog, source classification, Yahoo RSS parsing, SEC Atom parsing, and source-score ranking: 5 tests passed.
  • 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.
  • Live finance fetch-news --provider yahoo-finance-news --market us --symbol AAPL --limit 2 -> returned 2 scored news rows.
  • Live VELARIA_SEC_USER_AGENT=... finance fetch-news --provider sec-filings --market us --symbol AAPL --limit 2 -> returned SEC 10-Q/8-K filing rows with source_score=0.96.
  • git diff --check -> passed.
  • focused diff secret scan -> no secret-pattern hits in added lines.

Code-review follow-up: f9e47c9

  • Fixed Yahoo chart/history rows so they are enriched with source_category, source_type, source_score, and source_score_reason like other fetched evidence rows.
  • Wrapped sec-filings SEC ticker-map failures in FinanceProviderError so CLI/agent callers receive structured provider diagnostics instead of raw exceptions.
  • Made SEC User-Agent policy identify the shared SEC policy as provider=sec because it is used by both sec-companyfacts and sec-filings.
  • Clarified fetch-news --query help in both the direct finance pack parser and the public velaria finance wrapper.

Code-review follow-up validation:

  • Focused red tests reproduced the review gaps before implementation.
  • Focused review-fix tests plus doctor smoke: 4 tests passed.
  • Public CLI help smoke: finance fetch-news --help now 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.
  • focused diff secret scan -> no secret-pattern hits in added lines.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1084 to +1085
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 []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@ashione ashione merged commit e6568c8 into main May 20, 2026
4 checks passed
@ashione ashione deleted the auto/finance-continuous-watch branch May 20, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant