session_start and task_classified telemetry fire once per user turn, not once per session
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
packages/opencode/src/session/prompt.ts の loop() の 364 行目付近と 498 行目付近から始め、次に 939 行目付近のテレメトリブロックと、セッションスコープの状態または以前の assistant メッセージがどのように利用可能かを調べます。3 つのメッセージで問題を再現し、テレメトリを調べます。完了条件は、各セッションが開始ターンから 1 つの session_start と 1 つの task_classified を発行し、1088 行目の意図的にループごとに記録される trace は変更されないことです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 813
- フォーク
- 134
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 67
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AltimateAI/altimate-code のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
AltimateAI/altimate-code#1359 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
AltimateAI/altimate-code#1323 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
AltimateAI/altimate-code#1288 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
AltimateAI/altimate-code#1285 ·
-
privacy: Altimate Base consent dialog no longer discloses persistent per-installation identifier オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
AltimateAI/altimate-code#1284 ·
AltimateAI/altimate-code の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bcgov/bc-wallet-mobile#4761 · コメント 1 件 ·
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100