AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).
fix(watchlist): finding credit must concern the source; direct adds only for the entity's own source
Rufuse6d30de412bd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5793b6f2..02753d00 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -31,8 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0and the research turn ("stock watches grounded in a competitor: 4approved / 1 declined"). Research-added watches retire themselves: thescheduler sweep disables one that fired ≥5 alerts with ≥2 dismissed and- low trust, a feed/page/status watch with no signal in 30 days, or one with- 3 consecutive poll failures (audited; re-enable from `/watchlist`).+ low trust, or one with 3 consecutive poll failures (audited; re-enable+ from `/watchlist`; silence alone never retires a watch).Endpoints: `POST /watchlist/{slug}/approve`, `POST /watchlist/{slug}/decline`.Settings: `WATCHLIST_RESEARCH_MAX_DIRECT_ADDS=2`,`WATCHLIST_RESEARCH_MAX_PROPOSALS=2`, `WATCHLIST_MAX_ENABLED=40`,diff --git a/packages/core/openexecutive/architecture/prebuilt/external_monitoring.json b/packages/core/openexecutive/architecture/prebuilt/external_monitoring.jsonindex e8eb8f64..4b767cb9 100644--- a/packages/core/openexecutive/architecture/prebuilt/external_monitoring.json+++ b/packages/core/openexecutive/architecture/prebuilt/external_monitoring.json@@ -1,7 +1,7 @@{"section_id": "external_monitoring","title": "External Monitoring",- "markdown": "`openexecutive.monitoring` watches the outside world on a heartbeat and turns detected changes into briefing proposals via the same alert pipeline that handles inbound email and Slack.\n\nThe `external_monitor_scan` heartbeat (`__internal__` channel, default every 5 min) walks `list_watchlist(enabled_only=True)`, skipping rows fresher than their per-source cadence floor. For each due row it fires a read-only source adapter resolved from `_REGISTRY` by `signal_type`:\n\n- `vendor_status` — Statuspage Atom/RSS incident feeds (AWS, Stripe, GitHub, …). Reads each incident's current status out of the entry body, parses `<updated>` into `published_at`, and keys its dedup on `(entry id, <updated>)`; a **seeding** source (see below).\n- `rss` — generic Atom/RSS via feedparser (changelogs, layoffs.fyi, filings). Parses each entry's `<pubDate>`/`<updated>` into `published_at`; a **seeding** source (see below).\n- `stock` — Yahoo Finance chart endpoint; fires on `abs_change_pct_gte` moves.\n- `page_watch` — change-detection on a feed-less page. Fetches via the keyless httpx fetcher by default, or via xcrawl's scrape API when the row carries `config.fetch = \"xcrawl\"` — so JS-rendered / bot-blocked pages that publish no RSS (most modern news / marketing sites) are still monitorable.\n- `edgar` and the BILLED `query` web-search adapter.\n\nEach `Signal` is trigger-filtered, severity-clamped to the row's `[floor, ceiling]`, and INSERTed into `external_signals` where `UNIQUE(dedup_key)` drops replays. Survivors pass a suppression cascade (`baseline` → `stale` → `dry_run` → `below_floor` → capture-time relevance enrichment → promote), then `promote_signal_to_alert` builds an `AlertEvent` handed to `alerts.pipeline.schedule_evaluation` and surfaced as a `/today` proposal.\n\nEvery signal carries two timestamps that are never conflated: `captured_at` (when the monitor first saw it) and `published_at` (when the upstream says it happened — RSS `<pubDate>`, EDGAR filing date; null for `stock`, `page_watch`, `query`). Two freshness gates run first in the cascade, before anything that costs an LLM call. **Baseline:** the first poll that returns entries for a row whose adapter declares `seed_on_first_poll` (`rss`, `edgar`) records every entry already in the feed — trigger misses included, so the first entry that ever matches a keyword is news and a later, wider trigger can't resurface old ones — as `suppressed_baseline`, promotes nothing, and stamps `watchlist.baselined_at`, so a new watch reports what changes from now on instead of replaying the feed's back-catalogue (the same idea as `page_watch`'s first-observation baseline). It is keyed on `baselined_at` rather than `last_polled_at`, so a failed first fetch can't forfeit it; the claim and the recording are one transaction (a compare-and-swap on the stamp plus the rows, all-or-nothing), so of two overlapping scans exactly one records the back-catalogue and a failure part-way leaves nothing behind to replay; the other scan promotes only entries dated after that stamp (undated entries count as baseline, since the feed controls the date; entries dated more than a few minutes past its own clock are deferred rather than recorded); and baseline rows don't count against `max_signals_per_scan`, so a large feed can't be half-baselined. `vendor_status` used to sit outside both gates for a structural reason: its dedup key was `sha256(slug, entry id)`, and an incident's id never changes across its updates, so any suppressed insert muted that incident for good. Keying on `(entry id, <updated>)` instead (issue #90) makes a suppression cost one *state* of an incident rather than the incident, so both gates now apply to vendor feeds too — and an incident moving Investigating → Resolved mints a new key and surfaces, while re-polling an unchanged feed still dedups. Because a history feed's archive is mostly incidents resolved months ago, the adapter also carves live news out of its own baseline: it reads each incident's current status from the entry body (Statuspage renders the newest update first as `<strong>Resolved</strong>` / `Investigating` / `Monitoring` / … — the body is parsed by a real HTML parser, off the event loop, and the reading is deliberately asymmetric: any sign that the incident is over closes it, wherever it appears, while only a marked-up label can say it is still open. Working out which update is newest turned out to be something tag soup cannot be trusted to express, and every attempt reported a long-resolved incident as live) and exempts the ones still OPEN via the optional `promote_on_baseline` hook, so a watch added during an outage reports that outage on its first poll while the resolved archive is recorded as `suppressed_baseline`. An unrecognised status counts as closed — a vendor changing feed format must not be able to promote its whole archive at HIGH, and nothing is lost, since the next `<updated>` bump surfaces normally. An exempt entry must still pass the row's trigger filter (one that misses stays in the baseline, so widening a trigger later cannot resurface it) and is still judged by the stale gate below: the exemption buys an entry past the baseline, never past its own timestamp, because \"this is live\" is a reading of vendor-controlled markup and an entry the feed dates outside the age window is not news whatever that reading says. **Stale:** a signal whose `published_at` is older than `EXTERNAL_MONITOR_MAX_SIGNAL_AGE_DAYS` (default 7; `0` disables) at capture time is recorded as `suppressed_stale` and never promoted — a January article a feed resurfaces in September is not September news. An entry dated more than `EXTERNAL_MONITOR_MAX_FUTURE_SKEW_HOURS` ahead (default 24; `0` disables; `config_json.max_future_skew_hours` overrides it per row for calendar or maintenance feeds that legitimately date entries ahead) is deferred instead: skipped for the tick and not recorded (recording would burn its dedup key and let a feed mute an announcement for good by post-dating it), with one aggregated `external_signal_deferred` audit row per poll — carrying each held-back entry's summary and link, and emitted even if the poll later raises — then judged normally once the date passes. Inside the window, the alert body handed to triage carries `Published:` and `Discovered:` lines so the item is judged on when it happened. Adapters prefer a plausible date key over one more than a day in the future (and keep the future value when every key is implausible, so the pipeline defers it rather than waving an undated entry through), and the alert body collapses whitespace in the summary so no source can forge its own labeled body line.\n\nThe `query` adapter is a special case: it emits every web hit flat-LOW (it can't judge materiality per-hit), so for query signals enrichment runs BEFORE the floor gate and `_grade_query_severity` regrades from the relevance read (≥0.8 HIGH, ≥0.5 MEDIUM, else LOW). Without this, any query watch item with a `severity_floor` above LOW would suppress every hit — which is what left the Monitoring section empty even while standing queries were returning material findings.\n\nWhich lane a proposal lands in is decided by `briefing.ranking.categorize`: an unrouted, low/medium signal from a monitoring source (`stock`, `vendor_status`, `rss`, `query`, `edgar`, `page_watch`, or any `external:*` topic tag) is `monitoring` (the collapsible Monitoring section); a routed or high/urgent one is `action` (the \"Needs you\" queue). The triage prompt's External Signals rule covers all six source kinds so it trusts the source and emits the `external:*` tags that drive this split.\n\nThe watchlist is editable from chat (`add_watchlist_entry`, `tune_watchlist_entry`) and HTTP (`/watchlist`); the `executive_research` workflow proposes what to watch through a deterministic policy (next section). Because that workflow is LLM-driven and historically proposed feed URLs it never verified (most were dead — 404 / 403 / not-actually-a-feed), every `rss` target is validated at insert time (`monitoring.target_validation`): a URL that fetches and parses as a feed is kept; a public page that isn't a feed is converted to a scrape-backed `page_watch` when xcrawl can read it, otherwise rejected (HTTP 422 / tool error); SSRF-blocked or unparseable URLs are rejected outright and never handed to xcrawl. Non-`rss` types insert unchanged with no network I/O.\n\n### One watch, one card — and dismissals teach the watch\n\n`promote_signal_to_alert` stamps the `AlertEvent` with `dedup_hint=\"watch:<slug>\"`, which `alerts.pipeline` uses as the *alert* dedup key. A repeat from the same watch coalesces into the open card (`occurrence_count`, `last_seen_at`, severity max) rather than minting another, and re-pings only when severity rose into high/urgent — so a ticker that stays over its threshold or an incident that keeps updating no longer produces a new \"Needs you\" item every day. The signal-level `dedup_key` (stock's UTC-date bucket, vendor_status's `<updated>`) is untouched, so every observation still lands in `external_signals`. Dismissing a watch-sourced alert calls `store.record_dismissal(slug)` (`dismiss_count += 1`, `trust_score = max(0.2, trust × 0.8)`); approving calls `record_confirmation` (+0.05). `trust_score` discounts the briefing ranking and is shown to the Executive's alert review as evidence, alongside the newer signals for that watch (a \"Resolved\" incident state, a reversed move) that let it close the card with evidence.\n\n### What the research pass may put on the watchlist\n\nEvery watchlist row carries an `origin`: `manual` (the principal, via UI/API), `executive` (the chat tool acting on a request), `research` (the research pass added it on its own) or `research_proposed` (a pending suggestion). The `executive_research` workflow's watchlist pass no longer calls `add_watchlist_entry`; its only tool is `propose_watch` (slug, signal_type, target, `grounding_entity`, `rationale`, `certainty`), and `monitoring.research.watch_policy` decides what happens to each proposal from company data, not from the model's confidence in itself:\n\n- **Direct add** — the row lands live, `origin=research`, with quiet defaults the model cannot loosen (daily cadence — hourly for `vendor_status`, weekly for `page_watch`/`query` — `severity_floor=medium`, a keyword trigger of material-event words + the current-year priority terms for feeds — never the entity's own name, which appears in every entry's feed label and would fire on everything — and `abs_change_pct_gte=5` for stocks). Requires the `grounding_entity` to name an external entity in company data — the company itself, a `competitive_landscape.primary_competitors` entry, or one of the profile's `vendors` / `tickers` (an initiative title or a current-year priority also grounds a proposal, but only ever to a suggestion: they are bags of common words a planted finding can echo) — *and* a score ≥ 4 on a fixed ledger: +2 entity in company data (mandatory), +1 entity already watched under another source, +1 target is the entity's own source (the entity's ticker or one the profile tracks; a URL whose site label — `acme` in `status.acme.com` / `acme.co.uk`, never a subdomain or TLD — is the entity's; or a primary-source host such as sec.gov), +1 finding confidence high, +1 verification confirmed, +1 cross-specialist consensus, ±1 from the policy's own approval history for that `(signal_type, grounding kind)` once it has ≥5 samples. The model's `certainty` can only downgrade a direct add to a suggestion; a `query` watch is always a suggestion. At most `WATCHLIST_RESEARCH_MAX_DIRECT_ADDS` (2) per run. When one term appears in several sources the strongest kind wins (company > competitor > vendor > ticker > initiative > priority > watch label).\n- **Suggestion** — anything that validates, has a linked finding and scores at least 1 but misses the bar is inserted in `dry_run` (polls and records signals, never alerts) with `origin=research_proposed` and the rationale in `notes`, at most `WATCHLIST_RESEARCH_MAX_PROPOSALS` (2) per run. `/watchlist` shows them in a \"Suggested by the Executive\" section with Approve (`POST /watchlist/{slug}/approve` → `active`, `origin=research`) and Decline (`POST /watchlist/{slug}/decline` with a reason: `not_relevant` blacklists the entity, `wrong_source` blacklists only this target, `too_noisy` keeps the source live with `severity_floor=high` — the one way a suggestion goes live without an approve — and counts as a decline for calibration). A suggestion nobody reviews within `WATCHLIST_PROPOSAL_TTL_DAYS` (14) is removed. The morning brief mentions the pending count in one line; a `watchlist_suggestions` alert nudges only once ≥3 suggestions have waited ≥7 days — one card for the whole pile (an open card is refreshed in place; a dismissed one is not re-minted until the next ISO week), so acting on a suggestion never spawns another nudge.\n- **Reject** — an invalid target, a second watch on the same site + signal type (disabled rows included), a declined target or entity, nothing vouching for it (no linked finding, score 0), the enabled-watch ceiling `WATCHLIST_MAX_ENABLED` (40; suggestions poll too, so the ceiling stops them as well), or a spent budget. Every decision is audited (`watchlist_research_added` / `_suggested` / `_rejected`) with the score and reasons; the stamp also lives in the row's `config_json._policy` so approve/decline/auto-disable can attribute the outcome.\n\n**Declines are remembered and enforced.** `watchlist_declines` is keyed by the normalized target (upper-cased ticker; URL with `https` forced, `www.` dropped, host and path lower-cased, query, fragment and trailing slash removed; free-text queries case- and whitespace-folded). A `not_relevant` decline also blacklists the *entity*: any later proposal whose `grounding_entity` names it is refused whatever the target. An explicit decline — the Decline button, \"Stop watching…\" on a research-added card, `remove_watchlist_entry` or `DELETE /watchlist/{slug}` on a research-origin row — is permanent; an unreviewed expiry may be re-proposed once after 90 days. The `propose_watch` handler refuses a declined target or entity before anything is fetched, so a new slug cannot route around a decline; the list is also rendered to the model as DECLINED. The routing pass that runs before the watchlist pass has no watchlist write tools at all (`add_watchlist_entry`, `tune_watchlist_entry`, `remove_watchlist_entry` are withheld from synthesis), and `tune_watchlist_entry` refuses `mode` / `enabled` changes on a pending suggestion — only the principal's approve or decline moves one out of review. Every URL-typed target (`rss`, `vendor_status`, `page_watch`) is checked against the SSRF guard at insert time, and a suggestion's `source_url` link is kept only when it is a public http(s) URL.\n\n**The policy learns from outcomes.** Approve, decline, expiry and auto-disable write `watchlist_policy_outcomes` rows keyed by `(signal_type, grounding kind, specialist)`; the pass renders the tallies (\"stock watches grounded in a competitor: 4 approved / 1 declined\"; \"proposals from cso: …\") and the score ledger reads them. The research turn also shows each existing watch's `origin`, `fired_count`, `dismiss_count` and `trust_score`.\n\n**Research watches retire themselves.** The scheduler's 15-minute sweep (`watch_policy.sweep`, alongside the alert expiry sweep) disables a `research`-origin watch — audited as `watchlist_auto_disabled`, re-enable from `/watchlist` — when it fired ≥5 alerts of which ≥2 were dismissed and trust ≤ 0.5, or after 3 consecutive poll failures (silence is deliberately not a rule: an unchanged page or a healthy vendor is a working watch); the retired target is also recorded as a 90-day decline so the next run cannot re-add it under a new slug with fresh counters (a disabled row already counts as \"same source watched\"). Approve, decline and expiry are compare-and-act on \"still pending\", so a concurrent approve always wins over a decline or the sweep. Direct adds and auto-disables appear in the brief's \"handled overnight\" block as `watching` / `stopped_watching`. The research skip-if-unchanged fingerprint hashes only enabled, `active` rows, so approving or declining a suggestion never triggers a fresh 7-specialist run.\n\n### Invariants\n\n- Adapters are read-only — they never write upstream and never auto-execute.\n- Every `Signal` carries a deterministic `dedup_key` and a mandatory `provenance_url`.\n- Fetches are SSRF-guarded and bounded by `external_monitor_max_fetch_bytes`; xcrawl scrape (off by default, gated by `XCRAWL_ENABLED` + `XCRAWL_API_KEY`) is the one path that delegates the fetch to an external API.\n- Suppressed signals are still persisted so audits show the full picture.\n- A repeat from the same watch never becomes a second open card: the alert-level `watch:<slug>` key coalesces it, and only a severity escalation re-dispatches.\n- The research model never writes the watchlist: it proposes, deterministic policy adds (only when grounded in company data) or suggests, and a target the principal declined is refused at the handler.",+ "markdown": "`openexecutive.monitoring` watches the outside world on a heartbeat and turns detected changes into briefing proposals via the same alert pipeline that handles inbound email and Slack.\n\nThe `external_monitor_scan` heartbeat (`__internal__` channel, default every 5 min) walks `list_watchlist(enabled_only=True)`, skipping rows fresher than their per-source cadence floor. For each due row it fires a read-only source adapter resolved from `_REGISTRY` by `signal_type`:\n\n- `vendor_status` — Statuspage Atom/RSS incident feeds (AWS, Stripe, GitHub, …). Reads each incident's current status out of the entry body, parses `<updated>` into `published_at`, and keys its dedup on `(entry id, <updated>)`; a **seeding** source (see below).\n- `rss` — generic Atom/RSS via feedparser (changelogs, layoffs.fyi, filings). Parses each entry's `<pubDate>`/`<updated>` into `published_at`; a **seeding** source (see below).\n- `stock` — Yahoo Finance chart endpoint; fires on `abs_change_pct_gte` moves.\n- `page_watch` — change-detection on a feed-less page. Fetches via the keyless httpx fetcher by default, or via xcrawl's scrape API when the row carries `config.fetch = \"xcrawl\"` — so JS-rendered / bot-blocked pages that publish no RSS (most modern news / marketing sites) are still monitorable.\n- `edgar` and the BILLED `query` web-search adapter.\n\nEach `Signal` is trigger-filtered, severity-clamped to the row's `[floor, ceiling]`, and INSERTed into `external_signals` where `UNIQUE(dedup_key)` drops replays. Survivors pass a suppression cascade (`baseline` → `stale` → `dry_run` → `below_floor` → capture-time relevance enrichment → promote), then `promote_signal_to_alert` builds an `AlertEvent` handed to `alerts.pipeline.schedule_evaluation` and surfaced as a `/today` proposal.\n\nEvery signal carries two timestamps that are never conflated: `captured_at` (when the monitor first saw it) and `published_at` (when the upstream says it happened — RSS `<pubDate>`, EDGAR filing date; null for `stock`, `page_watch`, `query`). Two freshness gates run first in the cascade, before anything that costs an LLM call. **Baseline:** the first poll that returns entries for a row whose adapter declares `seed_on_first_poll` (`rss`, `edgar`) records every entry already in the feed — trigger misses included, so the first entry that ever matches a keyword is news and a later, wider trigger can't resurface old ones — as `suppressed_baseline`, promotes nothing, and stamps `watchlist.baselined_at`, so a new watch reports what changes from now on instead of replaying the feed's back-catalogue (the same idea as `page_watch`'s first-observation baseline). It is keyed on `baselined_at` rather than `last_polled_at`, so a failed first fetch can't forfeit it; the claim and the recording are one transaction (a compare-and-swap on the stamp plus the rows, all-or-nothing), so of two overlapping scans exactly one records the back-catalogue and a failure part-way leaves nothing behind to replay; the other scan promotes only entries dated after that stamp (undated entries count as baseline, since the feed controls the date; entries dated more than a few minutes past its own clock are deferred rather than recorded); and baseline rows don't count against `max_signals_per_scan`, so a large feed can't be half-baselined. `vendor_status` used to sit outside both gates for a structural reason: its dedup key was `sha256(slug, entry id)`, and an incident's id never changes across its updates, so any suppressed insert muted that incident for good. Keying on `(entry id, <updated>)` instead (issue #90) makes a suppression cost one *state* of an incident rather than the incident, so both gates now apply to vendor feeds too — and an incident moving Investigating → Resolved mints a new key and surfaces, while re-polling an unchanged feed still dedups. Because a history feed's archive is mostly incidents resolved months ago, the adapter also carves live news out of its own baseline: it reads each incident's current status from the entry body (Statuspage renders the newest update first as `<strong>Resolved</strong>` / `Investigating` / `Monitoring` / … — the body is parsed by a real HTML parser, off the event loop, and the reading is deliberately asymmetric: any sign that the incident is over closes it, wherever it appears, while only a marked-up label can say it is still open. Working out which update is newest turned out to be something tag soup cannot be trusted to express, and every attempt reported a long-resolved incident as live) and exempts the ones still OPEN via the optional `promote_on_baseline` hook, so a watch added during an outage reports that outage on its first poll while the resolved archive is recorded as `suppressed_baseline`. An unrecognised status counts as closed — a vendor changing feed format must not be able to promote its whole archive at HIGH, and nothing is lost, since the next `<updated>` bump surfaces normally. An exempt entry must still pass the row's trigger filter (one that misses stays in the baseline, so widening a trigger later cannot resurface it) and is still judged by the stale gate below: the exemption buys an entry past the baseline, never past its own timestamp, because \"this is live\" is a reading of vendor-controlled markup and an entry the feed dates outside the age window is not news whatever that reading says. **Stale:** a signal whose `published_at` is older than `EXTERNAL_MONITOR_MAX_SIGNAL_AGE_DAYS` (default 7; `0` disables) at capture time is recorded as `suppressed_stale` and never promoted — a January article a feed resurfaces in September is not September news. An entry dated more than `EXTERNAL_MONITOR_MAX_FUTURE_SKEW_HOURS` ahead (default 24; `0` disables; `config_json.max_future_skew_hours` overrides it per row for calendar or maintenance feeds that legitimately date entries ahead) is deferred instead: skipped for the tick and not recorded (recording would burn its dedup key and let a feed mute an announcement for good by post-dating it), with one aggregated `external_signal_deferred` audit row per poll — carrying each held-back entry's summary and link, and emitted even if the poll later raises — then judged normally once the date passes. Inside the window, the alert body handed to triage carries `Published:` and `Discovered:` lines so the item is judged on when it happened. Adapters prefer a plausible date key over one more than a day in the future (and keep the future value when every key is implausible, so the pipeline defers it rather than waving an undated entry through), and the alert body collapses whitespace in the summary so no source can forge its own labeled body line.\n\nThe `query` adapter is a special case: it emits every web hit flat-LOW (it can't judge materiality per-hit), so for query signals enrichment runs BEFORE the floor gate and `_grade_query_severity` regrades from the relevance read (≥0.8 HIGH, ≥0.5 MEDIUM, else LOW). Without this, any query watch item with a `severity_floor` above LOW would suppress every hit — which is what left the Monitoring section empty even while standing queries were returning material findings.\n\nWhich lane a proposal lands in is decided by `briefing.ranking.categorize`: an unrouted, low/medium signal from a monitoring source (`stock`, `vendor_status`, `rss`, `query`, `edgar`, `page_watch`, or any `external:*` topic tag) is `monitoring` (the collapsible Monitoring section); a routed or high/urgent one is `action` (the \"Needs you\" queue). The triage prompt's External Signals rule covers all six source kinds so it trusts the source and emits the `external:*` tags that drive this split.\n\nThe watchlist is editable from chat (`add_watchlist_entry`, `tune_watchlist_entry`) and HTTP (`/watchlist`); the `executive_research` workflow proposes what to watch through a deterministic policy (next section). Because that workflow is LLM-driven and historically proposed feed URLs it never verified (most were dead — 404 / 403 / not-actually-a-feed), every `rss` target is validated at insert time (`monitoring.target_validation`): a URL that fetches and parses as a feed is kept; a public page that isn't a feed is converted to a scrape-backed `page_watch` when xcrawl can read it, otherwise rejected (HTTP 422 / tool error); SSRF-blocked or unparseable URLs are rejected outright and never handed to xcrawl. Non-`rss` types insert unchanged with no network I/O.\n\n### One watch, one card — and dismissals teach the watch\n\n`promote_signal_to_alert` stamps the `AlertEvent` with `dedup_hint=\"watch:<slug>\"`, which `alerts.pipeline` uses as the *alert* dedup key. A repeat from the same watch coalesces into the open card (`occurrence_count`, `last_seen_at`, severity max) rather than minting another, and re-pings only when severity rose into high/urgent — so a ticker that stays over its threshold or an incident that keeps updating no longer produces a new \"Needs you\" item every day. The signal-level `dedup_key` (stock's UTC-date bucket, vendor_status's `<updated>`) is untouched, so every observation still lands in `external_signals`. Dismissing a watch-sourced alert calls `store.record_dismissal(slug)` (`dismiss_count += 1`, `trust_score = max(0.2, trust × 0.8)`); approving calls `record_confirmation` (+0.05). `trust_score` discounts the briefing ranking and is shown to the Executive's alert review as evidence, alongside the newer signals for that watch (a \"Resolved\" incident state, a reversed move) that let it close the card with evidence.\n\n### What the research pass may put on the watchlist\n\nEvery watchlist row carries an `origin`: `manual` (the principal, via UI/API), `executive` (the chat tool acting on a request), `research` (the research pass added it on its own) or `research_proposed` (a pending suggestion). The `executive_research` workflow's watchlist pass no longer calls `add_watchlist_entry`; its only tool is `propose_watch` (slug, signal_type, target, `grounding_entity`, `rationale`, `certainty`), and `monitoring.research.watch_policy` decides what happens to each proposal from company data, not from the model's confidence in itself:\n\n- **Direct add** — the row lands live, `origin=research`, with quiet defaults the model cannot loosen (daily cadence — hourly for `vendor_status`, weekly for `page_watch`/`query` — `severity_floor=medium`, a keyword trigger of material-event words + the current-year priority terms for feeds — never the entity's own name, which appears in every entry's feed label and would fire on everything — and `abs_change_pct_gte=5` for stocks). Requires the `grounding_entity` to name an external entity in company data — the company itself, a `competitive_landscape.primary_competitors` entry, or one of the profile's `vendors` / `tickers` (an initiative title or a current-year priority also grounds a proposal, but only ever to a suggestion: they are bags of common words a planted finding can echo) — *and* a score ≥ 4 on a fixed ledger: +2 entity in company data (mandatory), +1 entity already watched under another source, +1 target is the entity's own source (the entity's ticker or one the profile tracks; a URL whose site label — `acme` in `status.acme.com` / `acme.co.uk`, never a subdomain or TLD — is the entity's; or a primary-source host such as sec.gov), +1 finding confidence high, +1 verification confirmed, +1 cross-specialist consensus (the three finding points count only when the cited finding concerns this source: a URL target must share its site with one of the finding's cited URLs, a ticker must appear in its text — a strong finding cannot be borrowed for an unrelated page), ±1 from the policy's own approval history for that `(signal_type, grounding kind)` once it has ≥5 samples. A direct add is further reserved for the entity's **own** source (its ticker, its site, its status page): a well-corroborated third-party page about a competitor is the principal's call. The model's `certainty` can only downgrade a direct add to a suggestion; a `query` watch is always a suggestion. At most `WATCHLIST_RESEARCH_MAX_DIRECT_ADDS` (2) per run. When one term appears in several sources the strongest kind wins (company > competitor > vendor > ticker > initiative > priority > watch label).\n- **Suggestion** — anything that validates, has a linked finding and scores at least 1 but misses the bar is inserted in `dry_run` (polls and records signals, never alerts) with `origin=research_proposed` and the rationale in `notes`, at most `WATCHLIST_RESEARCH_MAX_PROPOSALS` (2) per run. `/watchlist` shows them in a \"Suggested by the Executive\" section with Approve (`POST /watchlist/{slug}/approve` → `active`, `origin=research`) and Decline (`POST /watchlist/{slug}/decline` with a reason: `not_relevant` blacklists the entity, `wrong_source` blacklists only this target, `too_noisy` keeps the source live with `severity_floor=high` — the one way a suggestion goes live without an approve — and counts as a decline for calibration). A suggestion nobody reviews within `WATCHLIST_PROPOSAL_TTL_DAYS` (14) is removed. The morning brief mentions the pending count in one line; a `watchlist_suggestions` alert nudges only once ≥3 suggestions have waited ≥7 days — one card for the whole pile (an open card is refreshed in place; a dismissed one is not re-minted until the next ISO week), so acting on a suggestion never spawns another nudge.\n- **Reject** — an invalid target, a second watch on the same site + signal type (disabled rows included), a declined target or entity, nothing vouching for it (no linked finding, score 0), the enabled-watch ceiling `WATCHLIST_MAX_ENABLED` (40; suggestions poll too, so the ceiling stops them as well), or a spent budget. Every decision is audited (`watchlist_research_added` / `_suggested` / `_rejected`) with the score and reasons; the stamp also lives in the row's `config_json._policy` so approve/decline/auto-disable can attribute the outcome.\n\n**Declines are remembered and enforced.** `watchlist_declines` is keyed by the normalized target (upper-cased ticker; URL with `https` forced, `www.` dropped, host and path lower-cased, query, fragment and trailing slash removed; free-text queries case- and whitespace-folded). A `not_relevant` decline also blacklists the *entity*: any later proposal whose `grounding_entity` names it is refused whatever the target. An explicit decline — the Decline button, \"Stop watching…\" on a research-added card, `remove_watchlist_entry` or `DELETE /watchlist/{slug}` on a research-origin row — is permanent; an unreviewed expiry may be re-proposed once after 90 days. The `propose_watch` handler refuses a declined target or entity before anything is fetched, so a new slug cannot route around a decline (URL keys also fold percent-encoding, dot segments and a trailing host dot); the list is also rendered to the model as DECLINED. The routing pass that runs before the watchlist pass has no watchlist write tools at all (`add_watchlist_entry`, `tune_watchlist_entry`, `remove_watchlist_entry` are withheld from synthesis), and `tune_watchlist_entry` accepts only `notes` on a pending suggestion — never `mode` / `enabled` (only the principal's approve or decline moves one out of review) nor cadence / floor / trigger (it goes live with the quiet defaults policy gave it). Every URL-typed target (`rss`, `vendor_status`, `page_watch`) is checked against the SSRF guard at insert time, and a suggestion's `source_url` link is kept only when it is a public http(s) URL.\n\n**The policy learns from outcomes.** Approve, decline, expiry and auto-disable write `watchlist_policy_outcomes` rows keyed by `(signal_type, grounding kind, specialist)`; the pass renders the tallies (\"stock watches grounded in a competitor: 4 approved / 1 declined\"; \"proposals from cso: …\") and the score ledger reads them. The research turn also shows each existing watch's `origin`, `fired_count`, `dismiss_count` and `trust_score`.\n\n**Research watches retire themselves.** The scheduler's 15-minute sweep (`watch_policy.sweep`, alongside the alert expiry sweep) disables a `research`-origin watch — audited as `watchlist_auto_disabled`, re-enable from `/watchlist` — when it fired ≥5 alerts of which ≥2 were dismissed and trust ≤ 0.5, or after 3 consecutive poll failures (silence is deliberately not a rule: an unchanged page or a healthy vendor is a working watch); the retired target is also recorded as a 90-day decline so the next run cannot re-add it under a new slug with fresh counters (a disabled row already counts as \"same source watched\"). Approve, decline and expiry are compare-and-act on \"still pending\", so a concurrent approve always wins over a decline or the sweep. Direct adds and auto-disables appear in the brief's \"handled overnight\" block as `watching` / `stopped_watching`. The research skip-if-unchanged fingerprint hashes only enabled, `active` rows, so approving or declining a suggestion never triggers a fresh 7-specialist run.\n\n### Invariants\n\n- Adapters are read-only — they never write upstream and never auto-execute.\n- Every `Signal` carries a deterministic `dedup_key` and a mandatory `provenance_url`.\n- Fetches are SSRF-guarded and bounded by `external_monitor_max_fetch_bytes`; xcrawl scrape (off by default, gated by `XCRAWL_ENABLED` + `XCRAWL_API_KEY`) is the one path that delegates the fetch to an external API.\n- Suppressed signals are still persisted so audits show the full picture.\n- A repeat from the same watch never becomes a second open card: the alert-level `watch:<slug>` key coalesces it, and only a severity escalation re-dispatches.\n- The research model never writes the watchlist: it proposes, deterministic policy adds (only when grounded in company data) or suggests, and a target the principal declined is refused at the handler.","mermaid": "flowchart TD\n ADD[\"add (chat tool / POST /watchlist / research)\"]\n VAL[\"target_validation: rss feed? → keep / convert→page_watch(xcrawl) / reject\"]\n WL[(\"watchlist\")]\n HB[\"external_monitor_scan heartbeat (~5 min)\"]\n AD[\"read-only adapters: vendor_status / rss / stock / query / edgar / page_watch (httpx | xcrawl)\"]\n SIG[(\"external_signals UNIQUE(dedup_key)\")]\n ENRICH[\"capture-time enrichment<br/>(relevance score + why_it_matters)\"]\n PROMO[\"promote_signal_to_alert\"]\n PIPE[\"alert pipeline (triage)\"]\n TODAY[\"/today proposals\"]\n ADD --> VAL\n VAL -->|\"insert valid rows\"| WL\n HB -->|\"walk enabled rows\"| WL\n WL -->|\"poll due rows\"| AD\n AD -->|\"emit Signal\"| SIG\n SIG -->|\"baseline / stale / dry_run / floor gates\"| ENRICH\n ENRICH -->|\"≥ relevance floor\"| PROMO\n PROMO --> PIPE\n PIPE --> TODAY\n class HB hot\n class WL storage\n class VAL compute\n class AD external\n class SIG storage\n class ENRICH compute\n class PROMO compute\n class PIPE compute\n class TODAY entry\n class ADD compute",- "generated_at": "2026-09-12T11:06:42.982912+00:00"+ "generated_at": "2026-09-12T11:10:47.561830+00:00"}diff --git a/packages/core/openexecutive/monitoring/research/watch_policy.py b/packages/core/openexecutive/monitoring/research/watch_policy.pyindex f6af6613..b433b6ad 100644--- a/packages/core/openexecutive/monitoring/research/watch_policy.py+++ b/packages/core/openexecutive/monitoring/research/watch_policy.py@@ -388,6 +388,31 @@ def _site_label(host: str) -> str:return labels[-2]+def _finding_supports(proposal: WatchProposal, finding: ResearchFinding, entity_term: str) -> bool:+ """Does the cited finding actually concern this target? A URL target+ must share its site with one of the finding's cited URLs; a ticker or+ query target must appear in the finding's text or be about the entity+ the finding names."""+ text = _norm(f"{finding.title} {finding.summary}")+ text_tokens = set(text.split())+ entity_tokens = {+ t for t in entity_term.split() if len(t) >= _MIN_PARTIAL_TOKEN and t not in _STOPWORDS+ }+ names_entity = bool(entity_term) and (entity_term in text or bool(entity_tokens & text_tokens))+ if proposal.signal_type in (SOURCE_KIND_STOCK, SOURCE_KIND_EDGAR):+ return _norm(proposal.target) in text_tokens or names_entity+ if proposal.signal_type == SOURCE_KIND_QUERY:+ return names_entity+ # A URL target must share its site with a cited URL: a finding that+ # merely names the entity cannot vouch for an arbitrary page about it.+ host = registrable_domain(proposal.target)+ cited = {registrable_domain(u) for u in finding.relevant_urls}+ cited.discard("")+ return bool(host) and any(+ host == c or host.endswith("." + c) or c.endswith("." + host) for c in cited+ )++def _history_adjustment(signal_type: str, grounding_kind: str, counts: dict[tuple[str, str], dict[str, int]],) -> tuple[int, str]:@@ -430,10 +455,12 @@ def classify(+1 cross-specialist consensus on the finding±1 policy history for (signal_type, grounding kind) at >=5 samples- Direct at >= DIRECT_THRESHOLD with the mandatory entity match, and only- when the entity is a named competitor / vendor / ticker / the company- (STRONG_GROUNDING_KINDS); the model's own ``certainty`` can only- downgrade. ``query`` is never direct.+ Finding points count only when the cited finding concerns this source+ (shares its site with a cited URL, or names the entity). Direct at+ >= DIRECT_THRESHOLD with the mandatory entity match, only for the+ entity's OWN source, and only when the entity is a named competitor /+ vendor / ticker / the company (STRONG_GROUNDING_KINDS); the model's own+ ``certainty`` can only downgrade. ``query`` is never direct."""reasons: list[str] = []score = 0@@ -449,10 +476,17 @@ def classify(else:reasons.append(f"entity '{proposal.grounding_entity}' is not in company data")- if entity_term and _is_own_source(proposal, entity_term, ctx.vocabulary):+ own_source = bool(entity_term) and _is_own_source(proposal, entity_term, ctx.vocabulary)+ if own_source:score += 1reasons.append("target is the entity's own source")- if finding is not None:+ supported = finding is not None and _finding_supports(proposal, finding, entity_term)+ if finding is not None and not supported:+ # The cited finding says nothing about THIS source, so it lends it+ # no credit — the model cannot borrow a strong finding's points for+ # an unrelated URL. (Company-data grounding still counts.)+ reasons.append("cited finding does not mention this source")+ if finding is not None and supported:if finding.confidence == "high":score += 1reasons.append("finding confidence high")@@ -487,12 +521,18 @@ def classify(tier = TIER_SUGGESTif grounded and score >= DIRECT_THRESHOLD:tier = TIER_DIRECT- if tier == TIER_DIRECT and kind not in STRONG_GROUNDING_KINDS:- tier = TIER_SUGGEST- reasons.append(f"grounded only in a {kind} — needs a named competitor, vendor or ticker")if tier == TIER_DIRECT and proposal.signal_type == SOURCE_KIND_QUERY:tier = TIER_SUGGESTreasons.append("standing web queries are always suggestions")+ if tier == TIER_DIRECT and not own_source:+ # Adding on its own is reserved for the entity's OWN source (its+ # ticker, its site, its status page); a third-party page about a+ # competitor, however well corroborated, is the principal's call.+ tier = TIER_SUGGEST+ reasons.append("not the entity's own source")+ if tier == TIER_DIRECT and kind not in STRONG_GROUNDING_KINDS:+ tier = TIER_SUGGEST+ reasons.append(f"grounded only in a {kind} — needs a named competitor, vendor or ticker")if tier == TIER_DIRECT and proposal.certainty != "confident":tier = TIER_SUGGESTreasons.append("model marked it unsure")diff --git a/packages/core/openexecutive/monitoring/store.py b/packages/core/openexecutive/monitoring/store.pyindex ea38016a..cb2f8a23 100644--- a/packages/core/openexecutive/monitoring/store.py+++ b/packages/core/openexecutive/monitoring/store.py@@ -610,17 +610,27 @@ def delete_pending_suggestion(item_id: int, db_path: Path | None = None) -> bool(compare-and-delete, with its signal history). False when it wasapproved, declined or removed in the meantime."""with _get_conn(db_path) as conn:- row = conn.execute(- "SELECT 1 FROM watchlist WHERE id = ? AND origin = ? AND mode = ?",- (item_id, ORIGIN_RESEARCH_PROPOSED, MODE_DRY_RUN),- ).fetchone()- if row is None:- return False- conn.execute("DELETE FROM external_signals WHERE watchlist_id = ?", (item_id,))- cursor = conn.execute(- "DELETE FROM watchlist WHERE id = ? AND origin = ? AND mode = ?",- (item_id, ORIGIN_RESEARCH_PROPOSED, MODE_DRY_RUN),- )+ # Take the write lock up front so the check and the two deletes are+ # one unit: an approve landing in between must not lose the now-live+ # watch's signal history.+ conn.execute("BEGIN IMMEDIATE")+ try:+ row = conn.execute(+ "SELECT 1 FROM watchlist WHERE id = ? AND origin = ? AND mode = ?",+ (item_id, ORIGIN_RESEARCH_PROPOSED, MODE_DRY_RUN),+ ).fetchone()+ if row is None:+ conn.execute("ROLLBACK")+ return False+ conn.execute("DELETE FROM external_signals WHERE watchlist_id = ?", (item_id,))+ cursor = conn.execute(+ "DELETE FROM watchlist WHERE id = ? AND origin = ? AND mode = ?",+ (item_id, ORIGIN_RESEARCH_PROPOSED, MODE_DRY_RUN),+ )+ conn.execute("COMMIT")+ except Exception:+ conn.execute("ROLLBACK")+ raisereturn cursor.rowcount > 0diff --git a/packages/core/openexecutive/monitoring/validation.py b/packages/core/openexecutive/monitoring/validation.pyindex 3d23f62f..cf39e23b 100644--- a/packages/core/openexecutive/monitoring/validation.py+++ b/packages/core/openexecutive/monitoring/validation.py@@ -13,7 +13,7 @@ there.from __future__ import annotationsimport re-from urllib.parse import urlsplit, urlunsplit+from urllib.parse import unquote, urlsplit, urlunsplitfrom openexecutive.alerts.models import AlertSeverity@@ -43,23 +43,39 @@ def normalize_target(signal_type: str, target: str) -> str:raw = (target or "").strip()if signal_type in ("stock", "edgar"):return raw.upper()- if "://" not in raw:+ if signal_type == "query" or "://" not in raw:# Free-text targets (standing queries): collapse case + whitespace.return " ".join(raw.lower().split())try:parts = urlsplit(raw)except ValueError:return raw.lower()- # Scheme, www., query string, fragment, path case and a trailing slash- # are all ways to spell the same source; none of them may defeat a- # decline or the duplicate-source guard.- host = (parts.hostname or "").lower()+ # Scheme, www., a trailing host dot, query string, fragment, path case,+ # percent-encoding, dot segments and a trailing slash are all ways to+ # spell the same source; none of them may defeat a decline or the+ # duplicate-source guard.+ host = (parts.hostname or "").lower().rstrip(".")if host.startswith("www."):host = host[4:]- path = parts.path.lower().rstrip("/") if parts.path not in ("", "/") else ""+ path = _canonical_path(parts.path)return urlunsplit(("https", host, path, "", ""))+def _canonical_path(path: str) -> str:+ """Lower-cased, percent-decoded path with dot segments resolved and no+ trailing slash ("" for the root)."""+ segments: list[str] = []+ for seg in unquote(path).split("/"):+ if seg in ("", "."):+ continue+ if seg == "..":+ if segments:+ segments.pop()+ continue+ segments.append(seg.lower())+ return "/" + "/".join(segments) if segments else ""++def registrable_domain(url: str) -> str:"""Host with a leading ``www.`` stripped (``""`` for non-URL targets).Good enough to say "same site" for the duplicate-source guard."""diff --git a/packages/core/openexecutive/orchestrator/watchlist_tools.py b/packages/core/openexecutive/orchestrator/watchlist_tools.pyindex 86ff72df..a5e6712f 100644--- a/packages/core/openexecutive/orchestrator/watchlist_tools.py+++ b/packages/core/openexecutive/orchestrator/watchlist_tools.py@@ -694,13 +694,17 @@ async def handle_tune_watchlist_entry(tool_input: dict[str, Any]) -> str:fields: dict[str, Any] = {}changes: list[str] = []- if item.origin == ORIGIN_RESEARCH_PROPOSED and ("mode" in tool_input or "enabled" in tool_input):+ if item.origin == ORIGIN_RESEARCH_PROPOSED and any(+ k in tool_input for k in ("mode", "enabled", "cadence", "severity_floor", "severity_ceiling", "trigger")+ ):# A pending research suggestion leaves the pending state only through- # the principal's approve / decline — never by a tune from a model.+ # the principal's approve / decline — never by a tune from a model —+ # and it goes live with the quiet defaults policy gave it, not with+ # a cadence / floor / trigger loosened while it waited.return _err(tool,f"{slug!r} is a pending research suggestion; the principal approves or "- "declines it on the watch list",+ "declines it on the watch list (only notes can be edited meanwhile)",)if "enabled" in tool_input:enabled = bool(tool_input["enabled"])diff --git a/packages/core/tests/unit/test_executive_research_watchlist.py b/packages/core/tests/unit/test_executive_research_watchlist.pyindex 6c2d2a86..93adafd3 100644--- a/packages/core/tests/unit/test_executive_research_watchlist.py+++ b/packages/core/tests/unit/test_executive_research_watchlist.py@@ -49,14 +49,14 @@ def db(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:return db_path-def _finding(title: str = "Tesla cut prices") -> ResearchFinding:+def _finding(title: str = "Tesla cut prices", url: str = "https://example.com/feed.xml") -> ResearchFinding:return ResearchFinding(title=title,summary="Detail with a source.",severity_hint="high",suggested_audience="principal",confidence="high",- relevant_urls=["https://example.com/feed.xml"],+ relevant_urls=[url],source_specialist="cfo",)@@ -158,7 +158,8 @@ async def test_watchlist_pass_files_uncertain_proposal_as_suggestion(certainty="unsure")]),])calls = await er._watchlist_analysis_loop(- [_finding()], existing_watchlist=[], profile=_profile(), initiatives=[],+ [_finding("Initech raised", url="https://initech.com/blog/series-b")],+ existing_watchlist=[], profile=_profile(), initiatives=[],)assert [c["outcome"] for c in calls] == ["suggested"]row = monitoring_store.get_watchlist_item_by_slug("rss-initech", db_path=db)@@ -170,7 +171,7 @@ async def test_watchlist_pass_files_uncertain_proposal_as_suggestion(@pytest.mark.asyncioasync def test_watchlist_pass_respects_proposal_cap(db: Path, monkeypatch: pytest.MonkeyPatch) -> None:over = [- _propose(f"stock-x{i}", "stock", f"X{i}", entity="Nobody", certainty="unsure")+ _propose(f"stock-x{i}", "stock", f"X{i}", entity="Tesla", certainty="unsure")for i in range(er._MAX_WATCHLIST_PROPOSALS_PER_RUN + 3)]_stub_provider(monkeypatch, [_resp(over, stop_reason="tool_use")])diff --git a/packages/core/tests/unit/test_watch_policy.py b/packages/core/tests/unit/test_watch_policy.pyindex e0faa0c1..0e40d5ea 100644--- a/packages/core/tests/unit/test_watch_policy.py+++ b/packages/core/tests/unit/test_watch_policy.py@@ -138,6 +138,10 @@ def test_priority_terms_drop_stopwords() -> None:def test_normalize_target_and_domain() -> None:assert normalize_target("stock", " acme ") == "ACME"+ # Respellings of one path collapse: dot segments, percent-encoding, a+ # trailing host dot.+ assert normalize_target("rss", "https://competitor.example./x/../blog/./%66eed") == "https://competitor.example/blog/feed"+ assert normalize_target("query", "site:https://acme.com Acme Pricing") == "site:https://acme.com acme pricing"# scheme, www., query, fragment, path case and trailing slash never# distinguish two spellings of one source.assert normalize_target("rss", "HTTP://www.Acme.com/Feed/?x=1#top") == "https://acme.com/feed"@@ -165,18 +169,30 @@ def test_ticker_in_profile_is_own_source_for_stock() -> None:assert d.tier == wp.TIER_DIRECT+def _stripe_finding(**kw: Any) -> ResearchFinding:+ return _finding(title="Stripe incident", summary="Stripe reported degraded payments on 2026-09-02.",+ relevant_urls=["https://status.stripe.com/incidents/abc"], source_specialist="coo", **kw)++def test_vendor_status_page_is_direct() -> None:p = _proposal(slug="vendor-stripe", signal_type="vendor_status",target="https://status.stripe.com/feed.atom", grounding_entity="Stripe",)- d = wp.classify(p, _finding(), _ctx())+ d = wp.classify(p, _stripe_finding(), _ctx())assert d.tier == wp.TIER_DIRECT and "own source" in " ".join(d.reasons)+def _initech_finding(**kw: Any) -> ResearchFinding:+ base: dict[str, Any] = dict(title="Initech raised", summary="Initech raised a Series B on 2026-09-03.",+ relevant_urls=["https://initech.com/blog/series-b"])+ base.update(kw)+ return _finding(**base)++def test_entity_not_in_company_data_is_never_direct() -> None:p = _proposal(grounding_entity="Initech", target="https://initech.com/feed.xml")- d = wp.classify(p, _finding(verification="confirmed", source_specialist="cso,cfo"), _ctx())+ d = wp.classify(p, _initech_finding(verification="confirmed", source_specialist="cso,cfo"), _ctx())assert d.tier == wp.TIER_SUGGESTassert d.score == 3 # own-source +1 needs an entity; high +1, verified +1, consensus +1@@ -226,8 +242,8 @@ def test_nothing_vouching_is_rejected_not_suggested() -> None:finding_index=None)assert wp.classify(bare, None, _ctx()).tier == wp.TIER_REJECTweak = _proposal(grounding_entity="Initech", target="https://initech.com/feed.xml", certainty="unsure")- assert wp.classify(weak, _finding(confidence="medium"), _ctx()).tier == wp.TIER_REJECT- assert wp.classify(weak, _finding(confidence="high"), _ctx()).tier == wp.TIER_SUGGEST+ assert wp.classify(weak, _initech_finding(confidence="medium"), _ctx()).tier == wp.TIER_REJECT+ assert wp.classify(weak, _initech_finding(confidence="high"), _ctx()).tier == wp.TIER_SUGGESTdef test_own_source_uses_the_site_label_only() -> None:@@ -282,7 +298,7 @@ def test_quiet_defaults_add_keywords_and_medium_floor() -> None:def test_apply_adds_direct_and_files_suggestion(db: Path) -> None:- findings = [_finding(), _finding(title="Initech raised", summary="Initech raised.", confidence="high")]+ findings = [_finding(), _initech_finding(confidence="high")]proposals = [_proposal(),_proposal(slug="rss-initech", target="https://initech.com/feed.xml",@@ -300,14 +316,15 @@ def test_apply_adds_direct_and_files_suggestion(db: Path) -> None:def test_apply_honours_budgets_and_duplicate_targets(db: Path) -> None:- findings = [_finding()]+ findings = [_finding(), _stripe_finding(), _initech_finding(confidence="high")]proposals = [_proposal(slug="stock-acme", signal_type="stock", target="ACME"),_proposal(slug="stock-acme-2", signal_type="stock", target="acme"), # same target_proposal(slug="vendor-stripe", signal_type="vendor_status",- target="https://status.stripe.com/feed.atom", grounding_entity="Stripe"),+ target="https://status.stripe.com/feed.atom", grounding_entity="Stripe", finding_index=1),_proposal(slug="rss-acme-blog"), # third direct → budget → suggestion- _proposal(slug="rss-initech", target="https://initech.com/feed.xml", grounding_entity="Initech"),+ _proposal(slug="rss-initech", target="https://initech.com/feed.xml", grounding_entity="Initech",+ finding_index=2),_proposal(slug="rss-globex", target="https://globex.com/feed.xml", grounding_entity="Globex",certainty="unsure"), # suggestion budget spent → rejected]@@ -505,12 +522,33 @@ def test_sweep_nudges_once_suggestions_pile_up(db: Path) -> None:assert len(alerts) == 1 and "4 watch suggestions" in alerts[0].headline-def test_initiative_or_priority_grounding_is_never_direct() -> None:- p = _proposal(- slug="rss-helios", target="https://helios-news.example/feed.xml",- grounding_entity="Helios API",- )+def test_finding_points_need_a_finding_about_this_source() -> None:+ # A strong finding about Acme lends nothing to an unrelated attacker URL.+ p = _proposal(target="https://totally-unrelated.attacker.net/feed", grounding_entity="Acme Corp")d = wp.classify(p, _finding(verification="confirmed", source_specialist="cso,cfo"), _ctx())+ assert d.score == 2 and d.tier == wp.TIER_SUGGEST+ assert "does not mention this source" in " ".join(d.reasons)+ # A finding that names the entity does support a ticker watch on it.+ p2 = _proposal(slug="stock-acme", signal_type="stock", target="ACME", grounding_entity="Acme Corp")+ assert wp.classify(p2, _finding(), _ctx()).tier == wp.TIER_DIRECT+++def test_direct_add_requires_the_entitys_own_source() -> None:+ # A well-corroborated third-party page about a competitor is the+ # principal's call, never a direct add.+ p = _proposal(target="https://news.example.com/acme-feed.xml", grounding_entity="Acme Corp")+ f = _finding(verification="confirmed", source_specialist="cso,cfo",+ relevant_urls=["https://news.example.com/acme-pricing"])+ d = wp.classify(p, f, _ctx())+ assert d.score >= wp.DIRECT_THRESHOLD and d.tier == wp.TIER_SUGGEST+ assert "not the entity's own source" in d.reasons+++def test_initiative_or_priority_grounding_is_never_direct() -> None:+ p = _proposal(slug="rss-helios", target="https://helios.com/feed.xml", grounding_entity="Helios API")+ f = _finding(title="Helios API launch", summary="Launch Helios API shipped.",+ verification="confirmed", relevant_urls=["https://helios.com/launch"])+ d = wp.classify(p, f, _ctx())assert d.grounding_kind == wp.KIND_INITIATIVE and d.score >= wp.DIRECT_THRESHOLDassert d.tier == wp.TIER_SUGGEST and "needs a named competitor" in d.reasons[-1]diff --git a/packages/core/tests/unit/test_watchlist_tools.py b/packages/core/tests/unit/test_watchlist_tools.pyindex 53ce007f..08f0e919 100644--- a/packages/core/tests/unit/test_watchlist_tools.py+++ b/packages/core/tests/unit/test_watchlist_tools.py@@ -281,6 +281,9 @@ async def test_tune_cannot_move_a_pending_suggestion_out_of_review(db: Path) ->assert "pending research suggestion" in out["error"]out2 = json.loads(await wt.handle_tune_watchlist_entry({"slug": "rss-sugg", "enabled": False}))assert "error" in out2+ # Nor can its quiet defaults be loosened while it waits.+ out_floor = json.loads(await wt.handle_tune_watchlist_entry({"slug": "rss-sugg", "severity_floor": "low"}))+ assert "error" in out_floor# Other tunables stay allowed.out3 = json.loads(await wt.handle_tune_watchlist_entry({"slug": "rss-sugg", "notes": "hi"}))assert out3.get("ok") is True