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
{{ message }}
Repository navigation
feat(droid): open Droid sessions from Session History in a chat - #50162
Droid conversations you started outside Orca, in a droid terminal or the Factory app, already showed up in Session History, but you could only reopen them in a terminal. Now you can open them as a chat: the old messages show up, and you keep talking to the same Droid session.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$108
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$108
Prod
14
$\color{#1a7f37}{\Huge{\mathbf{+}}}$273
$\color{#cf222e}{\Huge{\mathbf{−}}}$77
$\color{#1a7f37}{\Huge{\mathbf{+}}}$196
What Changed
Before: a Droid row in Session History had no "Resume in New Chat". A running Droid terminal also couldn't "Continue in chat". The host would have refused anyway, because Droid had no transcript importer.
After: both actions work for Droid, the same way they do for Claude, Codex, Pi, OMP, Grok, Hermes and Antigravity. The chat shows the conversation's prompts, replies and tool runs. Droid's hook runs, notices and injected system reminders are left out, the same way Droid's own UI hides them. The chat then reopens the session over ACP, so new turns land in the same .jsonl.
How:
DROID_TRANSCRIPT_IMPORT finds <id>.jsonl under <account home>/.factory/sessions. It tries the workspace's own encoded folder first, then the workspace's sub-folders, then every other folder by name.
decodeDroidTranscriptLine turns Droid's records into chat messages:
It reuses the Claude-style content-block parser, since Droid writes the same text/tool_use/tool_result shapes.
It drops user_only and llm_only records and reasoning.
It strips the [Process exited with code N] line from Execute output, the same way the live Droid dialect does.
Adoption reads Droid's session_start record for the session id and cwd. A conversation from another folder is refused, and one from a sub-folder opens in that sub-folder.
Antigravity and Droid now share one record-id import helper. The isFile helper that Hermes and Antigravity each carried a copy of now lives in one place.
Why
Droid's ACP session/load only reopens a session from the folder it was saved in. Loading from any other folder fails with "Folder is not trusted". That's why the folder check reads session_start.cwd and launches the chat there, instead of always using the workspace root.
Importing the transcript, as every other adopting agent does, beats relying on Droid's session/load replay. The chat history then goes through the same journal import, retention bounds and identity checks as everyone else's, and no Droid-specific replay handling is needed.
Before, the Droid row's menu had Resume in Worktree, Copy Resume Command and Hand off to agent, but no "Resume in New Chat" (see the issue).
After, the Droid row offers "Resume in New Chat":
A terminal-started Droid session opened as a chat. Its earlier turns are shown, including the pwd tool run, and the new message continued the same session:
A session saved in ws/sub, opened from the ws workspace. Asked to run a tool, Droid's pwd printed /private/tmp/droid49905/ws/sub, so it resumed in its own folder:
Testing
macOS only, droid 1.21.1.
Real Droid sessions, no model spend: a custom model in an isolated FACTORY_HOME_OVERRIDE pointed at a local fake chat-completions server, so Droid wrote genuine session files, with text turns and an Execute tool call.
Hidden dev build (ORCA_BACKGROUND_LAUNCH=1, isolated profile) driven over CDP:
Session History listed the rows, and "Resume in New Chat" opened the chat with its history.
A new message continued the same .jsonl; no new session was created.
The sub-folder session resumed in its sub-folder.
Probed Droid's ACP directly:
session/load from the recorded folder works, including through the /tmp → /private/tmp alias.
session/load from the parent folder is refused.
Import checks against the real files: a wrong folder and a mismatched session id are refused, and the import does one JSON parse per line.
pnpm check:changed passes.
Not run: Linux, Windows, SSH. Session History's resume-in-chat is local and runtime-host only; SSH and WSL rows are blocked by the existing eligibility check.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
One decoder test, built from real Droid record shapes. It fails if the hidden-record filter is removed, which would put Droid's injected system reminders into the chat.
Performance
None on any hot path. All of this runs only when someone opens a Droid conversation as a chat, or on a usage-limit recovery read:
Lookup is one stat when the session is in the workspace's own folder. Otherwise it's one listing of ~/.factory/sessions, then one stat per folder until it hits.
The import parses each line once.
Nothing runs per hook event or per mounted row.
Risk
Level: Low
The risky part is the folder check: if it picked the wrong folder, Droid would refuse to load and the chat would fail to open. It is covered for the workspace root, a sub-folder, and a symlink alias.
A new client paired with an older remote host still shows "Continue in chat" for a Droid terminal, because the host capability isn't per agent. The older host then refuses after the terminal closes. Hermes and Antigravity have the same gap today. A plain revert removes the feature, and chats already opened keep working as normal Droid chats.
AI Disclosure
Review
Reviewed in three rounds by two independent reviewers and a perf pass. Fixed from that review:
Folder lookup now tries the workspace's own folder first.
The import parses each line once.
An over-long encoded folder name falls back to the scan.
Left as follow-ups because they live in the shared adoption path, not in Droid's part:
The import reads the whole file before trimming to the newest history.
An abort doesn't stop a pending read.
The ownership check on reservation scans every saved conversation.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Security: the session id is checked against a strict pattern before it goes into a path, and every result is admitted against the store's real path.
Windows: folder names are matched by name with a full-scan fallback, so a different cwd encoding is still found.
Mobile: no mobile code or wire change.
Older Droid versions that wrote to ~/.factory/projects aren't searched. Droid 1.21.1 writes only to sessions.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
No actionable comments were generated in the recent review.
Walkthrough
The change adds Droid transcript discovery and decoding, connects transcript import to journal adoption, and enables Droid conversations in the adoption and resume paths. It also adds a shared transcript-file check for Antigravity and Hermes and moves Antigravity record-ID imports to shared processing.
Merge Risk: Low · up to 64ce7
Resuming a Droid session in chat can fail to find the session if an unrelated folder in the Droid session store is unreadable. The impact is limited to this edge case and has a simple fix. The rest of the change looks safe to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(droid): open Droid sessions from Session History in a chat" matches the main change. The PR adds a "Resume in New Chat" action for Droid Session History rows and a "Continue in chat" a…
Description check
The description follows the repository template. It has an ELI5 section, a What Changed section with before and after behavior and the mechanism, a Why section explaining the folder-check and transcri…
Linked Issues check
Directly linked issue #49905 has three coding objectives. The PR implements each one.
1. Offer "Resume in chat" for externally started Droid sessions: droid: ['droid'] is added to `CLI_CONVERSATION…
Out of Scope Changes check
Each changed file supports the Droid import, its adoption, or a shared helper that the Droid path needs.
- droidShellResult (droid-dialect.ts): the export and rename let the Droid import strip the …
Full details: Title check
Explanation
The title "feat(droid): open Droid sessions from Session History in a chat" matches the main change. The PR adds a "Resume in New Chat" action for Droid Session History rows and a "Continue in chat" action for running Droid terminals, backed by a Droid transcript importer and record-ID import helper. The title is concise, specific, and follows a conventional commit style.
Full details: Description check
Explanation
The description follows the repository template. It has an ELI5 section, a What Changed section with before and after behavior and the mechanism, a Why section explaining the folder-check and transcript-import choices, a Linked Issue (Fixes #49905), Visual Proof with screenshots, a Testing section with manual steps and platforms, a Performance section, a Risk section with level and revert path, Notes, and a Checklist. The AI Disclosure section is empty, and the final lint/typecheck/test/build checklist item is unchecked. Those gaps are minor for a mostly complete description.
Full details: Linked Issues check
Explanation
Directly linked issue #49905 has three coding objectives. The PR implements each one.
Offer "Resume in chat" for externally started Droid sessions: droid: ['droid'] is added to CLI_CONVERSATION_ADOPTING_AGENTS (structured-agent-cli-conversation-adoption.ts). aiVaultSessionResumeInChatWorkspaceMatters treats Droid as workspace-dependent. DROID_LAUNCH_SPEC uses DROID_TRANSCRIPT_IMPORT instead of null, which removes the host refusal the issue describes.
Render prior turns: DROID_TRANSCRIPT_IMPORT finds <id>.jsonl under .factory/sessions. decodeDroidTranscriptLine maps text, tool_use, and tool_result records to chat messages. It drops user_only and llm_only records and reasoning. prepareDroidImport and prepareRecordIdTranscriptImport feed these messages into the journal import. A decoder test covers these record shapes.
Continue the same session: adoption reads session_start for the session id and cwd, then reopens the chat over ACP. The author reports manual testing with real Droid 1.21.1 files. New turns appended to the same .jsonl, and no new session was created.
The issue also asks that the chat keep the fresh-chat permission mode and model behavior. The summary does not show a permission-mode check. The reopen path reuses the existing Droid launch spec, and the summary shows no change there beyond the transcript import. This review did not inspect that path, so this detail is not separately verified. It does not show a gap. Automated coverage is one decoder test. Folder lookup, adoption refusal, and the session-id check are verified by the author's manual and probe tests, not by committed tests.
Full details: Out of Scope Changes check
Explanation
Each changed file supports the Droid import, its adoption, or a shared helper that the Droid path needs.
droidShellResult (droid-dialect.ts): the export and rename let the Droid import strip the [Process exited with code N] line. Parsing is unchanged.
DROID_LAUNCH_SPEC (droid-acp-launch-spec.ts): one-line change that enables the import. This is the core of the feature.
DROID_TRANSCRIPT_IMPORT (droid-transcript-import.ts): folder lookup and session-id pattern check. Both are needed for the Droid path.
isTranscriptFile (transcript-file-presence.ts): replaces the duplicated isFile helpers in Hermes and Antigravity. This is a refactor with no new behavior for those agents.
prepareRecordIdTranscriptImport (journal-record-id-import.ts): shared record-ID import flow. Antigravity now delegates to it. This changes Antigravity internals. The author states the intended behavior is unchanged. This review did not read the Antigravity diff line by line, so that claim rests on the summary.
adopted-transcript-source.ts: adds Droid session_start identity parsing and folder-checked transcript agent status. Droid is included in the existing folder validation.
journal-legacy-import.ts, journal-droid-import.ts: route droid to the new import path.
ai-vault-session-resume-in-chat.ts: adds a comment and Droid to the workspace-dependent check.
No unrelated feature or agent behavior was found in the summary. The shared-helper changes are disclosed in the PR description and are listed as follow-ups where they touch the shared adoption path.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Skip unreadable unrelated folders during the Droid transcript scan.
When the workspace-folder shortcut misses, the scan calls isTranscriptFile on every other folder in .factory/sessions. isTranscriptFile rethrows any error except ENOENT and ENOTDIR. If an unrelated folder is unreadable, for example with EACCES, the scan stops at that folder. A readable session in a later folder is then not found. Recovery treats this as "could not locate" and does not reopen the chat. Adoption propagates the rejection unless the caller has an explicit matched transcript path. The shortcut at line 25 already tolerates this error. Apply the same per-candidate tolerance to the scan so an unrelated folder cannot abort the lookup. Keep the handling of a missing store unchanged.
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
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.
ELI5
Droid conversations you started outside Orca, in a
droidterminal or the Factory app, already showed up in Session History, but you could only reopen them in a terminal. Now you can open them as a chat: the old messages show up, and you keep talking to the same Droid session.What Changed
Before: a Droid row in Session History had no "Resume in New Chat". A running Droid terminal also couldn't "Continue in chat". The host would have refused anyway, because Droid had no transcript importer.
After: both actions work for Droid, the same way they do for Claude, Codex, Pi, OMP, Grok, Hermes and Antigravity. The chat shows the conversation's prompts, replies and tool runs. Droid's hook runs, notices and injected system reminders are left out, the same way Droid's own UI hides them. The chat then reopens the session over ACP, so new turns land in the same
.jsonl.How:
DROID_TRANSCRIPT_IMPORTfinds<id>.jsonlunder<account home>/.factory/sessions. It tries the workspace's own encoded folder first, then the workspace's sub-folders, then every other folder by name.decodeDroidTranscriptLineturns Droid's records into chat messages:text/tool_use/tool_resultshapes.user_onlyandllm_onlyrecords and reasoning.[Process exited with code N]line fromExecuteoutput, the same way the live Droid dialect does.session_startrecord for the session id and cwd. A conversation from another folder is refused, and one from a sub-folder opens in that sub-folder.isFilehelper that Hermes and Antigravity each carried a copy of now lives in one place.Why
Droid's ACP
session/loadonly reopens a session from the folder it was saved in. Loading from any other folder fails with "Folder is not trusted". That's why the folder check readssession_start.cwdand launches the chat there, instead of always using the workspace root.Importing the transcript, as every other adopting agent does, beats relying on Droid's
session/loadreplay. The chat history then goes through the same journal import, retention bounds and identity checks as everyone else's, and no Droid-specific replay handling is needed.Linked Issue
Fixes #49905
Visual Proof
Before, the Droid row's menu had Resume in Worktree, Copy Resume Command and Hand off to agent, but no "Resume in New Chat" (see the issue).
After, the Droid row offers "Resume in New Chat":
A terminal-started Droid session opened as a chat. Its earlier turns are shown, including the
pwdtool run, and the new message continued the same session:A session saved in
ws/sub, opened from thewsworkspace. Asked to run a tool, Droid'spwdprinted/private/tmp/droid49905/ws/sub, so it resumed in its own folder:Testing
macOS only, droid 1.21.1.
FACTORY_HOME_OVERRIDEpointed at a local fake chat-completions server, so Droid wrote genuine session files, with text turns and anExecutetool call.ORCA_BACKGROUND_LAUNCH=1, isolated profile) driven over CDP:.jsonl; no new session was created.session/loadfrom the recorded folder works, including through the/tmp→/private/tmpalias.session/loadfrom the parent folder is refused.pnpm check:changedpasses.Not run: Linux, Windows, SSH. Session History's resume-in-chat is local and runtime-host only; SSH and WSL rows are blocked by the existing eligibility check.
One decoder test, built from real Droid record shapes. It fails if the hidden-record filter is removed, which would put Droid's injected system reminders into the chat.
Performance
None on any hot path. All of this runs only when someone opens a Droid conversation as a chat, or on a usage-limit recovery read:
statwhen the session is in the workspace's own folder. Otherwise it's one listing of~/.factory/sessions, then onestatper folder until it hits.Nothing runs per hook event or per mounted row.
Risk
Level: Low
The risky part is the folder check: if it picked the wrong folder, Droid would refuse to load and the chat would fail to open. It is covered for the workspace root, a sub-folder, and a symlink alias.
A new client paired with an older remote host still shows "Continue in chat" for a Droid terminal, because the host capability isn't per agent. The older host then refuses after the terminal closes. Hermes and Antigravity have the same gap today. A plain revert removes the feature, and chats already opened keep working as normal Droid chats.
AI Disclosure
Review
Reviewed in three rounds by two independent reviewers and a perf pass. Fixed from that review:
Left as follow-ups because they live in the shared adoption path, not in Droid's part:
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
~/.factory/projectsaren't searched. Droid 1.21.1 writes only tosessions.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)