Repository navigation
Conversation
iPeluwa
marked this pull request as ready for review
October 16, 2026 07:44
Author
|
Closing — keeping these fixes local rather than upstreaming. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ZCode (Z.ai's desktop coding agent) never runs the wrapped terminal commands, so its sessions were invisible to vibetime. It does have lifecycle hooks, so this tracks it the same way as the Claude Code, Codex and Cursor desktop apps.
Where the hooks go. ZCode reads user hooks from
~/.zcode/cli/config.jsonunderhooks.events, as matcher groups.src/zcode-hooks.tsmerges ours in next to whatever else is in that file (it already holds the plugin settings) and removes them again on uninstall, matching on__hooklike the other installers.vibe init,vibe hooks install,vibe hooks uninstall,vibe uninstalland the session-start repair inreconcile.tsall cover it.ZCode keeps new hooks off. ZCode loads hooks only at startup and lists new ones under Settings → Hooks switched off; the user switches them on there, and ZCode records that by writing
enabled: trueonto each hook (andhooks.enabled), rewritingtimeoutMstotimeoutin seconds as it saves. So the installer writestimeout: 10in that form, and a vibe hook whose command already matches is left exactly as ZCode saved it. Without that, the session-start repair would rewrite the group on every session and switch tracking back off. A changed command (a moved Node or CLI) is written fresh withoutenabled, so ZCode asks the user to switch it on again rather than vibetime approving new code to run. The README walks through the switch-on.Events.
SessionStartopens the session, andUserPromptSubmit,PostToolUseandStopare activity. ZCode has no session-end event, so a ZCode session closes through the reaper after 30 idle minutes, the same path that closes a desktop session the editor never ended.Session ids. ZCode names sessions
sess_<uuid>, whichUUID_RErejected, so every event was dropped.resolveSessionIdnow takes the uuid inside that prefix. Sub-agents aresess_subagent_agent_<uuid>; they still fail the check, so a sub-agent never opens a session of its own beside the one that spawned it.Tool tag. Sessions are tagged
zcode, which passes the server'sVALID_TOOLS_RE.Checks:
npm testpasses, 157 of 157. New tests cover the installer (non-destructive merge that keeps other config keys, idempotent reinstall, a hook the user switched on left byte-identical, stale command refresh that does not carry the switch-on over, removal, invalid JSON left untouched, fresh config) and the hook path (asess_id opens one session under the bare uuid, taggedzcode; a sub-agent id opens none).Verified live with ZCode 3.15.3 (agent 0.16.9) on macOS: after switching the hooks on, a new ZCode task
sess_ab348fec-…was recorded in~/.vibe/sessions.jsonas sessionab348fec-…, toolzcode, measuring the workspace's repos, with activity updating after the reply. ZCode logged the SessionStart hooks at 1.5 s and the prompt hooks at 0.1 s. The payload carriescwd(the task's working directory) andsession_id, which is all the hook reads.