Wizard AI-Obs: instrument skill on traces; fix Pattern-A subagent context grind (track active time, not wall-clock)
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- ai, observability
Direzione di ricerca
Inizia da src/utils/analytics.ts e dal percorso agent-runner che avvia un'esecuzione del wizard; esamina come le proprietà di trace esistenti ai_product e variant vengono valorizzate dalla sessione. Usa la query SQL fornita e gli esempi di trace per verificare che i dati skill, program, command, framework, active-time, cost, generation e human-wait siano interrogabili per ogni esecuzione. Il lavoro è completato quando è possibile effettuare analisi per skill e il context grind del subagent di Pattern A è stato affrontato senza trattare Pattern B come un problema.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Two different things make a wizard run "long" in AI Observability. Only one is a problem.
- ⚠️ Pattern A — subagent Bash-grind (the problem). A run spawns a subagent that grinds through hundreds of
Bashcalls with a context that balloons to ~229K tokens. ~350 generations, ~20–28 min of real LLM compute, $15–22 per run. - ✅ Pattern B — waiting on the human (expected, not a problem). The run is idle on
wizard_askwhile the user runs a build / clicks a test button / verifies in PostHog. Wall-clock looks huge (~58 min) but active LLM time is ~3 min. This is by design — do not optimize or alarm on it.
Two asks:
- Track active LLM time + cost + generations per skill — not wall-clock. Wall-clock conflates expected human waiting (B) with real slowness (A) and overstates the problem.
- Attack Pattern A (the subagent context grind).
There's also a blocking instrumentation gap (below): we can't slice any of this by skill today.
Headline numbers (project 2, ai_product = wizard, last 30d, n=19,959)
| Metric | P50 | P95 | P99 |
|---|---|---|---|
| Wall-clock | 5.7 min | 15.4 min | 35 min |
| Active LLM time | 3.1 min | 7.5 min | – |
| Generations | 54 | 120 | – |
| Cost | – | $5.82 | – |
Slow tail (wall > 20 min), by pattern:
| Pattern | Traces | Wall P50/P95 | Active LLM P50/P95 | Median gens | Verdict |
|---|---|---|---|---|---|
| A — subagent grind | 115 | 38 / 51 min | 20 / 28 min | 350 | ⚠️ real cost |
| B — human-wait | 383 | 28 / 58 min | 6 / 14 min | 97 | ✅ expected, ignore |
2.4% of all runs spawn a subagent; 9.2% are idle-dominated (wall > 2× active).
Instrumentation gap (blocks per-skill analysis)
Wizard runs are tagged only with ai_product = wizard. No event/trace property records which skill produced the run (self-driving-setup, error-tracking-setup, integration-*, audit-*). The skill id lives only inside the install_skill tool-call payload, and that blob is NULL in ClickHouse (length(toString(properties.$ai_input)) → None) — served by the trace API but not queryable. Worse, the slowest runs (383–534 gens, ~20–40 MB) exceed the trace-API size limit, so the worst offenders can't even be labeled by fetching+grepping.
Fix (small, at the source): when the agent run starts, set trace properties from session — wizard_skill_id, wizard_program_id, wizard_command, wizard_framework — on the same trace-property bag that already carries ai_product/variant (src/utils/analytics.ts + agent-runner). Also emit a wizard_waiting_on_human marker (or wizard_ask count) so human-wait time can be subtracted. Then per-skill latency/cost is a GROUP BY.
Referenced traces
Deep link: https://us.posthog.com/project/2/ai-observability/traces/<id>. Raw payloads + per-generation timeline saved locally under /tmp/wizard-traces/.
⚠️ Pattern A — subagent Bash-grind — 92def4a3
383 gens · 51 min wall · ~28 min active · $17.64. From the timeline:
- Main agent reads repo; context climbs 1.3K → 158K tokens.
- At 158K it calls
Agent→ subagent starts fresh at ~18K tokens. - Subagent runs hundreds of sequential
Bashcalls, context growing 18K → 229K (near the 200K window), with periodic 22–33 sWrites; one generation stalls 285 s. - Cost driver: 383 generations each re-reading a 100–229K-token cached context.
Same-shape cohort (30d, has_agent=1, 340–534 gens, $13–22): a0087986 ($22.13), a6880647 ($20.86), 0e512d5f ($19.32), 2391e836 ($18.82), e2355d41 ($17.68), a0ba73d7 ($17.31), 9d4c94c1 ($16.65), e69d1361 ($16.61), 06b24f46 ($16.52), 962c4c16 ($15.40), d4b4358b ($19.29), 5bcf496e ($14.16).
✅ Pattern B — human-wait (EXPECTED) — a4c8a3ad
skill error-tracking-upload-source-maps-nextjs · 46 gens · 58.3 min wall · 3.2 min active · $1.98. 55 of 58 min are idle on wizard_ask while the user builds, triggers a test error, and verifies the stack trace. Working as designed. Included only to show why the "error-tracking ~47 min" wall-clock figure is misleading — that's the human, not the wizard.
Baseline — healthy run — fa7764c8
skill integration-nextjs-app-router · 70 gens · 10.9 min wall ≈ active · $3.18 · 0 errors. LLM-bound, no idle, no subagent grind.
Reproduce
SELECT properties.$ai_trace_id AS tid,
dateDiff('second', min(timestamp), max(timestamp)) AS wall_s,
sum(toFloat(properties.$ai_latency)) AS active_s,
count() AS gens,
sum(toFloat(properties.$ai_total_cost_usd)) AS cost,
max(position(toString(properties.$ai_tools_called), 'Agent') > 0) AS subagent
FROM events
WHERE event = '$ai_generation' AND properties.ai_product = 'wizard'
AND timestamp > now() - INTERVAL 30 DAY
GROUP BY tid ORDER BY active_s DESC;
- Lingua principale
- TypeScript
- Stelle
- 208
- Fork
- 58
- Merge medio
- 2g 7h
- PR unite (30g)
- 76
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PostHog/wizard
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 2 giorni
-
wizard --version prints unknown when run through npxForse già presa @bryanlundberg l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
PostHog/wizard#1460 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
Self-driving setup: checkbox labels and Confirm button overlap wrapped description textForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PostHog/wizard#986 · 4 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di PostHog/wizard
Issue simili
-
bug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
scottbenton/Iron-Link#541 ·
I maintainer di solito rispondono entro 1 giorno
-
hosts settings: the SSH address field and the separate User field are two ways to name one SSH userAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
prime-radiant-inc/evener#8161 ·
I maintainer di solito rispondono entro 1 giorno
-
Ignore Rules is not workingApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nicobailon/pi-subagents#3420 ·
I maintainer di solito rispondono entro 1 giorno
-
Edit content TabList: selected tab's icon/label are hidden by its own selection indicator - a11yAperta01 type: bug 99 tag: UX Accessibility
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni