You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user sends a message to an existing session (one that was created before the current plugin process started), the session.created event never fires for that session. The sessionTotals Map — which tracks per-session agent, token, and cost metadata — therefore has no entry for that session.
The chat.message hook receives the correct input.agent from the user's request, but only mutates an existing sessionTotals entry; it does not create one when absent. As a result, all subsequent event handlers fall through to "unknown".
This affects all OTel signals that carry agent attributes:
Start opencode and send several messages to create a session
Restart opencode (or the plugin process)
Continue the existing session by sending a new message
Export telemetry via the plugin to any OTLP backend (e.g., Grafana Alloy + Prometheus/Loki/Tempo)
Observe that all agent-related labels/attributes for this session's metrics, logs, and traces show "unknown" instead of the correct agent name (e.g., "build")
Expected behavior
When a user message is sent to an existing session, the agent attribute in all telemetry signals should reflect the actual agent name from the request (e.g., "build", "plan", "explore").
Actual behavior
Agent attributes are reported as "unknown" for messages sent to sessions that existed before the current plugin process started.
Plugin version
v1.2.0 (latest)
Configuration
N/A
Relevant log output
Checklist
I have searched existing issues to ensure this hasn't been reported
I have redacted any sensitive information (API keys, tokens, etc.)
Activity
chingjustwe commentedon Jun 27, 2026
Yes, the agent name label showing correctly on an existing session metrics: