agnes-the-ai-analyst/cli/commands
ZdenekSrotyr 0a16e8f44e
feat(diagnose): role-aware overall status (#345 B) (#355)
Reading `Overall: degraded` on a fresh analyst install — driven by
server-side operator warnings (stale tables, session-pipeline cadence,
BQ billing-project config) that the analyst can't act on — erodes trust
in the install. The role-aware headline routes operator-only warnings
through a secondary line so they're not invisible, but they no longer
drive the headline an analyst sees.

Server-side (`app/api/health.py`):
- Per-check `audience: "analyst" | "operator"` tag on every entry in
  `/api/health/detailed` services dict.
- New top-level `caller_role` field (derived from `user.is_admin`) so
  the client knows which aggregation to display.
- New top-level `overall_analyst` field — analyst-only aggregation
  available to clients that don't want to recompute it.

Client-side (`cli/commands/diagnose.py`):
- When the server reports `caller_role`, analyst aggregations exclude
  audience=operator checks from the headline. Analyst-side warnings
  AND server-side errors still escalate (errors are universal).
- Secondary line surfaces operator warning count so they're visible:
  "Overall: healthy (analyst-side); 2 operator-side warnings".
- Admin/operator role auto-promotes to full aggregation; analysts can
  manually opt in via `--include-operator-checks` flag.
- Legacy servers without `caller_role` keep the pre-#345-B full
  aggregation — no silent regression against older deployments.

Audience defaults (`_AUDIENCE` map in health.py):
- analyst: duckdb_state
- operator: db_schema, data, users, bq_config, session_pipeline

Tests: 4 new in TestAnalystAudienceFilter (analyst-only filtering,
admin auto-promote, --include-operator-checks opt-in, legacy server
fallback). 26/26 diagnose + health tests pass.
2026-05-19 16:53:56 +02:00
..
__init__.py
admin.py feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
admin_activity.py Activity Center: audit log + telemetry + sessions + agnes_* tables (#278) 2026-05-12 22:41:19 +02:00
admin_ask.py Activity Center: audit log + telemetry + sessions + agnes_* tables (#278) 2026-05-12 22:41:19 +02:00
admin_data_package.py feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
admin_memory_domain.py feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
admin_metrics.py feat(cli): agnes admin metrics {import,export,validate} 2026-05-04 18:39:05 +02:00
admin_news.py feat(home): state-aware /home + /setup-advanced + schema v26 (#228) 2026-05-08 18:28:47 +02:00
admin_sessions.py Activity Center: audit log + telemetry + sessions + agnes_* tables (#278) 2026-05-12 22:41:19 +02:00
admin_store.py feat(flea): marketplace refactor — data model, attribution, UI unification (#342) 2026-05-19 02:32:41 +02:00
admin_usage.py Activity Center: audit log + telemetry + sessions + agnes_* tables (#278) 2026-05-12 22:41:19 +02:00
auth.py feat(web): consolidate the personal /me/* surface — /me/activity + /me/profile (#304) 2026-05-14 21:29:51 +02:00
capture_session.py Session capture queue, private session, and setup-prompt fixes (#242) 2026-05-11 13:31:16 +00:00
catalog.py hygiene: BQ error hint dispatch + catalog ENTITY column (#274) 2026-05-12 18:32:29 +00:00
describe.py release: 0.46.5 — agnes describe -n parses, server sanitizes NaN (#224) 2026-05-07 18:16:21 +02:00
diagnose.py feat(diagnose): role-aware overall status (#345 B) (#355) 2026-05-19 16:53:56 +02:00
disk_info.py chore(cli-rename): replace stale da verbs in active code paths 2026-05-04 21:10:43 +02:00
explore.py fix(cli): hint text 'Run: da sync' → 'Run: agnes pull' 2026-05-04 18:42:21 +02:00
init.py fix(onboarding): /home install flow + agnes init UX hardening (#350) 2026-05-19 15:26:35 +02:00
mark_private.py Session capture queue, private session, and setup-prompt fixes (#242) 2026-05-11 13:31:16 +00:00
marketplace.py feat(cli): agnes marketplace search/detail/add/remove + retire stale subcommands (#280) 2026-05-13 05:20:56 +00:00
memory_admin.py refactor(cli): hard-cutover env vars + config dir to AGNES_* 2026-05-04 16:35:44 +02:00
my_stack.py feat(cli): agnes marketplace search/detail/add/remove + retire stale subcommands (#280) 2026-05-13 05:20:56 +00:00
onboarded.py feat(home): state-aware /home + /setup-advanced + schema v26 (#228) 2026-05-08 18:28:47 +02:00
pull.py feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
push.py Session capture queue, private session, and setup-prompt fixes (#242) 2026-05-11 13:31:16 +00:00
query.py feat(cli): --json alias for --format json + remote-query exit-code regression test (#345 C+D) (#353) 2026-05-19 16:39:46 +02:00
refresh_marketplace.py feat(cli): AGNES_MARKETPLACE_URL env override for refresh-marketplace --bootstrap (#345 A) (#354) 2026-05-19 16:47:26 +02:00
sample.py release: 0.52.0 — UX/hygiene round (5 fixes from 0.51.0 retro) 2026-05-12 15:09:14 +02:00
schema.py refactor(cli): hard-cutover env vars + config dir to AGNES_* 2026-05-04 16:35:44 +02:00
self_upgrade.py Session capture queue, private session, and setup-prompt fixes (#242) 2026-05-11 13:31:16 +00:00
server.py refactor(cli): hard-cutover env vars + config dir to AGNES_* 2026-05-04 16:35:44 +02:00
setup.py fix(cli): Windows console crash on cs-CZ codepage (port + broaden #172) 2026-05-04 20:45:29 +02:00
skills.py fix(cli): Windows console crash on cs-CZ codepage (port + broaden #172) 2026-05-04 20:45:29 +02:00
snapshot.py fix(snapshot): catch httpx transport errors in --estimate path 2026-05-04 20:36:30 +02:00
stack.py feat(stack): unified Browse + My Stack for Data Packages and Memory (v49 schema) (#333) 2026-05-19 15:00:15 +02:00
status.py fix(devin-review): stale-token override + status sessions counter + lock comment 2026-05-04 21:26:30 +02:00
statusline.py Session capture queue, private session, and setup-prompt fixes (#242) 2026-05-11 13:31:16 +00:00
store.py feat(cli): agnes marketplace search/detail/add/remove + retire stale subcommands (#280) 2026-05-13 05:20:56 +00:00
tokens.py fix: address Devin Review findings — incomplete renames + estimate guard 2026-05-04 20:05:06 +02:00