Skip to content

feat(agent): describe agent home layouts and try every transcript candidate - #2657

Merged
hiddeco merged 4 commits into
mainfrom
hidde/agent-home-layouts
Oct 7, 2026
Merged

hiddeco merged 4 commits into
mainfrom
hidde/agent-home-layouts

Conversation

@hiddeco

@hiddeco hiddeco commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/1481

Splitting #2636 into smaller chunks.


Add an optional agent.HomeLayoutProvider capability: built-in agents with a relocatable home report it through SessionHome and list their session stores beneath it in a declarative HomeLayout. Claude Code keeps projects, Codex sessions and archived_sessions, Copilot CLI session-state, Pi sessions, and Droid sessions beneath its .factory directory.

Add agent.SessionFileCandidatesProvider for agents that may keep one session in several files: Codex and Pi list every dated copy, newest first, with Codex listing live rollouts before archived ones, and Cursor lists its nested layout before its flat one. SessionStore.SessionFileCandidatesIn resolves them, dropping any outside the store.

Attach now takes the first candidate that is a regular file instead of failing on an unusable newest copy, and searches every store of the active home when the session directory lies in one, so archived Codex rollouts are found. Symbolic link handling is unchanged.

Codex archives rollouts directly under archived_sessions, and attach now finds them. ResolveSessionFile searches only the session directory, because SessionStore refuses paths outside it. Archived rollouts are therefore listed only as attach candidates, and entire resume restores into the live store.

@hiddeco
hiddeco requested a review from a team as a code owner October 5, 2026 11:30
Copilot AI balanced review requested due to automatic review settings October 5, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Codex candidates are not globally newest-first across live and archived stores, allowing a stale rollout to be selected.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds declarative agent-home layouts and multi-file transcript discovery for reliable attachment across live, archived, nested, and restored sessions.

Changes:

  • Introduces home-layout and session-file-candidate capabilities.
  • Updates transcript discovery to select the first usable regular file.
  • Adds coverage for archived, fallback, and symlinked transcripts.
File Description
docs/​architecture/​agent-guide.md Documents new capabilities.
cmd/​entire/​cli/​transcript.go Implements candidate discovery.
cmd/​entire/​cli/​transcript_discovery_test.go Tests discovery scenarios.
cmd/​entire/​cli/​attach.go Uses candidate-based discovery.
cmd/​entire/​cli/​agent/​session_store.go Adds candidate containment API.
cmd/​entire/​cli/​agent/​session_store_test.go Tests candidate filtering.
cmd/​entire/​cli/​agent/​pi/​pi.go Lists Pi session candidates.
cmd/​entire/​cli/​agent/​home_layout.go Defines home layouts.
cmd/​entire/​cli/​agent/​home_layout_test.go Tests layout resolution.
cmd/​entire/​cli/​agent/​factoryaidroid/​factoryaidroid.go Declares Droid layout.
cmd/​entire/​cli/​agent/​cursor/​cursor.go Supports nested and flat layouts.
cmd/​entire/​cli/​agent/​copilotcli/​copilotcli.go Declares Copilot CLI layout.
cmd/​entire/​cli/​agent/​codex/​codex.go Adds live and archived candidates.
cmd/​entire/​cli/​agent/​claudecode/​claude.go Declares Claude Code layout.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/entire/cli/agent/codex/codex.go
@hiddeco hiddeco changed the title feat(agent): describe agent home layouts and try every transcript cadidate feat(agent): describe agent home layouts and try every transcript candidate Oct 5, 2026
…didate

Add an optional agent.HomeLayoutProvider capability: built-in agents with
a relocatable home report it through SessionHome and list their session
stores beneath it in a declarative HomeLayout. Claude Code keeps projects,
Codex sessions and archived_sessions, Copilot CLI session-state, Pi
sessions, and Droid sessions beneath its .factory directory.

Add agent.SessionFileCandidatesProvider for agents that may keep one
session in several files: Codex and Pi list every dated copy newest first,
and Cursor lists its nested layout before its flat one.
SessionStore.SessionFileCandidatesIn resolves them, dropping any outside
the store.

Attach now takes the first candidate that is a regular file instead of
failing on an unusable newest copy, and searches every store of the
active home when the session directory lies in one, so archived Codex
rollouts are found. Symbolic link handling is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M45WZBW88VTXXBP2FP92QND1
@hiddeco
hiddeco force-pushed the hidde/agent-home-layouts branch from 01a5f50 to da62c75 Compare October 6, 2026 20:40
hiddeco and others added 3 commits October 7, 2026 11:41
Codex archives a rollout by moving it to archived_sessions under its
original file name, not into dated subdirectories, so attach missed every
archived session: the glob only matched archived_sessions/YYYY/MM/DD.
Search each archive flat and then dated, as the live store is.

Those rollouts lie beside the session directory, not in it, and
SessionStore refuses any such path, so only ResolveSessionFileCandidates
lists them. ResolveSessionFile now searches the session directory alone;
had it kept its archive fallback, a flat archived rollout would have made
`entire resume` skip the session as resolving outside its session
directory and then fail. Resume restores the checkpoint into the live
store, where `codex resume` looks, and leaves the archive alone.

Codex's store names are now spelled once, in its home layout, and the
session directory, the candidate archives and the subagent rollout roots
derive from it, so discovery's store filter cannot drift from them. A
test covers that filter.

Document why the fallback transcript search refuses linked directories
below a store while discoverTranscript follows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M4AVT5MV68GFR7VTYEGPQ9VW
discoverTranscript dropped a SessionHome error silently, so attach
searched only the session directory, not the home's other stores such as
Codex's archived_sessions, with nothing recording why. Log it at debug
level and keep searching the session directory: failing would break
attach where it worked before the home layout existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M4B08MA09T9PCWT3NYV8A7CF
ResolveSessionFileCandidates took sessionDir's parent as the Codex home
without checking that sessionDir is that home's sessions store. A
relocated session directory, such as ENTIRE_TEST_CODEX_SESSION_DIR,
globbed an unrelated archived_sessions beside it; SessionStore dropped
those candidates, but the lookup was still wrong. List archives only
when sessionDir is <home>/sessions.

The home stays sessionDir's parent rather than CODEX_HOME: candidates
belong to the session directory the caller passed, which need not lie in
the active home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M4B0Q8X40GXQD7GW9Z7JABYM
@hiddeco
hiddeco merged commit 5b9fee4 into main Oct 7, 2026
18 checks passed
@hiddeco
hiddeco deleted the hidde/agent-home-layouts branch October 7, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants