fix(conversations): resume Droid provider sessions#2217
Conversation
Greptile SummaryThis PR wires up end-to-end Droid provider session resumption: a new
Confidence Score: 5/5Safe to merge; changes are well-scoped and the fallback paths preserve existing behaviour when no provider session ID has been captured yet. The session-capture and resume paths are logically correct, backed by new unit tests for every branch, and the config refactor is a straightforward extraction with no behavioural change. The only gap is a silent early-return in handleProviderSessionHook when none of the three candidate field names match Droid's actual response body, which would cause the feature to stop working without any diagnostic signal. src/main/core/agent-hooks/handle-provider-session-hook.ts — the field-name lookup has no warn log on the 'no matching field' path, which would make a future Droid API change very hard to diagnose.
|
| Filename | Overview |
|---|---|
| src/main/core/agent-hooks/handle-provider-session-hook.ts | New handler that extracts Droid's session UUID from the SessionStart hook body and persists it; guards against non-droid providers and invalid JSON but silently exits when no matching field name is found. |
| src/main/core/conversations/save-provider-session-id.ts | New module that persists the Droid session UUID into the JSON config column and emits a conversationChanged event; correctly validates UUID format and short-circuits on no-op updates. |
| src/main/core/conversations/resolve-agent-session-command.ts | New helper that selects the correct sessionId/isResuming pair for Droid (provider UUID vs conv ID) and passes through unchanged for all other providers. |
| src/shared/conversation-config.ts | New module centralising conversation config serialization/parsing; well-typed with explicit field extraction and UUID validation for Droid session IDs. |
| src/shared/agent-provider-registry.ts | Adds resumeFlag '--resume' to the Droid provider; sets sessionIdFlag to '--resume' as a sentinel (value unused, presence enables session-ID-as-argument logic) — documented via an inline comment. |
| src/main/core/conversations/impl/local-conversation.ts | Delegates session ID resolution to the new resolveAgentSessionCommandArgs helper before building the agent command. |
| src/main/core/conversations/impl/ssh-conversation.ts | Same delegation to resolveAgentSessionCommandArgs as local-conversation, but with requireProviderSessionId: false to preserve the existing resume-passthrough behaviour over SSH. |
| src/main/core/agent-hooks/agent-hook-service.ts | Routes 'session'-type hook events to the new handleProviderSessionHook before the generic enrichEvent/emit path. |
| src/main/core/conversations/utils.ts | Switches from raw JSON.parse to parseConversationConfig and surfaces providerSessionId on the mapped Conversation object. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/main/core/agent-hooks/handle-provider-session-hook.ts:22-24
**Silent failure when no matching session ID field is found**
If Droid's `SessionStart` hook body uses a field name that doesn't match any of `session_id`, `provider_session_id`, or `providerSessionId`, the function returns without logging anything. The entire "resume Droid sessions" feature would then silently not work — there'd be no `providerSessionId` stored, and every resume attempt would fall back to starting fresh. A `log.warn` on the early-return path would make this much easier to diagnose.
Reviews (2): Last reviewed commit: "fix(conversations): clarify Droid resume..." | Re-trigger Greptile
summary
finally droid actually resumes the last conversation