session_start and task_classified telemetry fire once per user turn, not once per session
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- observability
Línea de trabajo
Comienza en packages/opencode/src/session/prompt.ts, en loop() alrededor de las líneas 364 y 498; después inspecciona el bloque de telemetría alrededor de la línea 939 y cómo están disponibles el estado específico de la sesión o los mensajes anteriores del assistant. Reproduce el problema con tres mensajes e inspecciona la telemetría. Se considera terminado cuando cada sesión emite un session_start y un task_classified desde el turno inicial, mientras que el trace intencionadamente por bucle de la línea 1088 permanece sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
session_start and task_classified are emitted once per user turn, not once per session. Session counts in telemetry are therefore inflated by roughly the average number of turns per session, and task_classified re-classifies intent on every turn instead of once from the opening message.
Detail
Both events are emitted from a if (step === 1) block in packages/opencode/src/session/prompt.ts:939:
session_start—packages/opencode/src/session/prompt.ts:953task_classified—packages/opencode/src/session/prompt.ts:1004
step is not session-scoped. It is declared inside loop():
let step = 0—packages/opencode/src/session/prompt.ts:364step++—packages/opencode/src/session/prompt.ts:498
and loop() is invoked once per prompt, i.e. once per user turn. So step === 1 means "first model step of this turn", and the block runs again for every subsequent message in the same session.
Impact
session_startovercounts sessions. A session with N user turns emits Nsession_startevents, all carrying the samesession_id.- Any funnel or retention metric built on
session_startcounts is proportionally wrong. De-duplicating bysession_idat query time recovers the true count, so historical data is salvageable, but no current dashboard is doing that unless it was written with this in mind. task_classifiedreports the intent of whatever the user most recently typed, not the task the session was opened for. Itsconfidencedistribution is also skewed by short follow-up messages ("thanks", "yes", "try again") being classified as tasks.- Cost: an extra pair of tracked events per turn, plus the
classifyTaskIntentregex sweep over up to 2000 characters per turn.
Reproduction
Start a session, send three messages, and inspect the emitted telemetry (or set a breakpoint on the step === 1 block). Three session_start events are emitted with identical session_id.
Suggested fix
Gate both events on something session-scoped rather than on step. Options, roughly in order of preference:
- Check whether the session already has prior assistant messages before emitting — a session that has already produced output is not starting.
- Keep a per-session "already emitted" claim in the telemetry module, similar to how other once-per-session state is tracked.
- Emit at session creation instead of in the prompt loop, which is where the event name says it belongs.
Note that packages/opencode/src/session/prompt.ts:1088 also uses if (step === 1), but that one is intentionally per-loop() (it traces the system prompt once per loop invocation, and the comment there says so). Only the telemetry block at line 939 is affected.
- Lenguaje dominante
- TypeScript
- Estrellas
- 813
- Forks
- 134
- Merge medio
- 2 d 2 h
- PR fusionados (30 d)
- 67
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AltimateAI/altimate-code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
AltimateAI/altimate-code#1359 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
AltimateAI/altimate-code#1323 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
AltimateAI/altimate-code#1288 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
AltimateAI/altimate-code#1285 ·
-
privacy: Altimate Base consent dialog no longer discloses persistent per-installation identifier Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
AltimateAI/altimate-code#1284 ·
Todos los issues de AltimateAI/altimate-code
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
bcgov/bc-wallet-mobile#4761 · 1 comentario ·
-
external-issue to-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
area-deployment area-integrations triage:bot-seen
Dificultad 2/5 Medio día Aptitud para principiantes 86/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100