-
Notifications
You must be signed in to change notification settings - Fork 28
Zed Codex heartbeats lose editor and project context #113
Description
Summary
When Codex is used inside Zed with the zed-wakatime extension enabled, some emitted heartbeats arrive as low-context app events such as type=app, entity="Codex", with no project, branch, language, or explicit editor, which makes Waka-compatible backends classify them as unknown activity instead of attributing them to the active file or project.
Impact
This makes downstream analytics noisy and misleading for users who rely on Waka-compatible servers outside the hosted WakaTime backend. Instead of seeing file/project-level activity from Zed, they receive repeated generic Codex app heartbeats that cannot be grouped correctly by project, language, or editor.
Current Behavior
- Install Zed with the
zed-wakatimeextension enabled. - Use Codex from inside Zed.
- Inspect emitted heartbeats on a Waka-compatible backend.
- Some heartbeats arrive with payloads similar to:
{
"time": 1775101100,
"type": "app",
"branch": "",
"entity": "Codex",
"project": "",
"category": "ai coding",
"is_write": false,
"user_agent": "wakatime/v2.0.13 (darwin-24.6.0-arm64) go1.25.5 Zed/0.229.0+dev.27f70d2f56eb01f18b2a10131663c9fd4de4b37d Zed-wakatime/0.1.10 Codex/0.117.0"
}Observed result:
projectis emptybranchis emptylanguageis absenteditoris absent from the heartbeat bodyentityis justCodex
Expected Behavior
When Codex activity is tracked through Zed, emitted heartbeats should preserve enough source context for Waka-compatible backends to attribute the activity meaningfully. At minimum, the emitted data should make it possible to identify the editor and, when applicable, the active file/project context rather than collapsing to a generic Codex app heartbeat.
Root Cause
Root cause not fully confirmed from the extension side yet, but the current emitted heartbeat shape appears to rely on downstream WakaTime-specific interpretation of user_agent / plugin metadata rather than sending explicit editor or file/project context in the heartbeat body.
Proposed Resolution
- Review how
zed-wakatimeemits heartbeats for Codex-driven activity and identify why they fall back to generictype=app/entity="Codex"payloads. - Ensure the extension includes sufficient explicit context in the emitted heartbeat body, especially
editor, and preserve file/project/language context whenever it exists in Zed. - If generic app-level Codex heartbeats are intentional, document that behavior and clarify how non-WakaTime backends are expected to interpret them.
Test Plan
- Unit: add coverage for Codex-related heartbeat shaping so editor/context fields are asserted explicitly.
- Integration: verify heartbeats captured from Zed while using Codex against a Waka-compatible backend that stores raw payloads.
- Manual smoke:
- Enable
zed-wakatime, use Codex in Zed, and inspect the raw emitted heartbeat. - Confirm that project/editor/language/file context is present when available.
- Enable
- Commands:
cargo testcargo fmt --check
Acceptance Criteria
- Codex-related heartbeats emitted by
zed-wakatimeno longer collapse to genericentity="Codex"payloads when richer editor/file/project context is available. - Emitted heartbeats include enough explicit context for a Waka-compatible backend to classify the activity without relying solely on
user_agentparsing. - Expected behavior for intentional app-level Codex heartbeats is documented if full file/project attribution is not possible.
- Regression coverage is added for the Codex heartbeat shape.
Definition of Done
- Implementation merged
- Required checks are green
- Docs updated if behavior/contract changed