Skip to content

feat(agent): track terminal turn outcomes - #2428

Draft
zhoum-hub wants to merge 2 commits into
mainfrom
feat/agent-turn-terminal-analytics
Draft

feat(agent): track terminal turn outcomes#2428
zhoum-hub wants to merge 2 commits into
mainfrom
feat/agent-turn-terminal-analytics

Conversation

@zhoum-hub

Copy link
Copy Markdown
Contributor

Summary

  • capture the exact workspace UI mode (os or agent) on Agent create/send requests
  • persist submit metadata with the canonical Turn submission envelope
  • emit agent.turn_completed, agent.turn_failed, and agent.turn_cancelled from canonical Host root-turn settlements
  • exclude child sessions, Goal/provider-initiated turns, imported history, and legacy submissions without a valid mode
  • keep raw prompts, responses, paths, workspace IDs, and error messages out of terminal analytics

Why

The local desktop did not have a stable, canonical event for whether a user-submitted Agent turn completed, failed, or was cancelled. The renderer knows the UI mode, while the daemon owns the authoritative terminal outcome; without durable submission provenance, choosing either producer alone would lose settlements or create mode=null data.

This change joins those facts by persisting submission-time mode and reporting only after the canonical Turn settlement commits.

Product impact

  • every newly reported terminal event has mode=os or mode=agent; invalid or missing modes are skipped rather than guessed
  • completed measures technical Turn completion, not whether the user's goal was semantically satisfied
  • existing DataFinder dashboards are unchanged until they explicitly adopt the new event family
  • startup-reconciled interruptions remain distinguishable through startup_reconciled=true

Validation

  • pnpm check:changed — 28 lanes passed after implementation
  • pre-push pnpm check:changed -- --push-ready — 32 lanes passed
  • focused desktop adapter tests for create/send mode propagation
  • focused Host, store-sqlite, tuttid Agent/API, OpenAPI generation, and TypeScript type checks

Post-release DataFinder checks

  • verify mode contains only os and agent, with zero null
  • verify a turn_id appears in at most one event across the three terminal events
  • verify all rows have turn_origin=user_prompt and is_child_session=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant