Name local agent sessions after the issue branch and resume them #17
No reviewers
Labels
No labels
ai::retry
ai::retry_once
ai::retry_until_green
ai::validate_plan
status::blocked
status::done
status::functional_analysis
status::in_ci
status::in_development
status::in_review
status::technical_analysis
status::waiting_info
status::waiting_validation
type::analysis
type::bug
type::question
type::task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Alchemic.Studio/Alfred!17
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-7-add-a-name-on-ai-client-and-resume-from"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Every local-agent run of an issue mailbox (analysis, development,
ci_fix,review_fix,conflict_resolution,answer) names its CLI session after the issue branch and resumes the session the previous run of the same adapter left (spec §16.5).How
SessionRef, theResumeFallbackenum,LlmRequest::$session,LlmResult::$sessionId/$resumed/$resumeFallback, andLlmCapabilities::$resumableSessions/$sessionStatePath(the path must be inside/home/agent).AGENT_SESSION_RESUME, defaulttrue, organization and project scope.alfred.agents.{id}.resume_versionsand is never granted on the host runner. It is stored inagent_installations.resumable_sessionsand shown on the agents screen.--session-id <random uuid>for a fresh session,--resume <id>to resume,--name <branch>on verified versions. "No conversation found" leads to a fallback withstate_missing.exec resume <id>, with the id taken fromthread.started.SessionResolverapplies resume only for an issue mailbox, a container runner, a local adapter, an installed version that resumes, the setting on, and no credential mount overlapping the session directory.llm_sessionsby mailbox and adapter only. Provider and model are not part of the key.AgentSessionStorekeeps it in{base}/.agent-sessions/{org}-{project}-issue-{iid}/{adapter}(mode 0700). It is mounted read-write atsessionStatePath, under a tmpfs owned by the worker uid:gid, and removed byMailboxCleanup.branch_nameis frozen at the first run, whatever the phase. A read-only run uses the branch only once it exists on the remote, otherwise a temporary branch, so analysis creates no branch.llm_sessionsgainssession_name,native_session_id,resumedandresume_fallback, recorded whatever the outcome.Tests
LlmCapabilitiesvalidation, the sandbox mount and tmpfs.no_prior_session;adapter_changed; a model change still resumes; refused resume falls back silently; a failed run's session is recorded; every off case (setting off at either scope, version or adapter without the capability, MR mailbox, API mode, host runner); the analysis run freezes the name without creating the branch; cleanup removes the state; detector storage; run screen rendering.php artisan testwith Playwright.Verification
To review
>=0.46 <1.0) are not verified, because Codex isn't installed on the dev host./srv/claude:/home/agent/.claude) turns resume off for that run, with a logged warning.🤖 Generated with Claude Code
Closes #7
Every local-agent run of an issue mailbox now names its CLI session after the issue branch and resumes the native session the previous run of the same adapter left (spec §16.5). - Contracts: SessionRef, ResumeFallback, LlmRequest::$session, LlmResult::$sessionId/$resumed/$resumeFallback, and the capabilities resumableSessions/sessionStatePath (a path inside the home). - AGENT_SESSION_RESUME setting (default true, organization and project). - Detection lowers resumableSessions to alfred.agents.{id}.resume_versions and never grants it on the host runner; agent_installations stores it. - LocalAgentAdapter: session modes (fresh or resume), the native id read from the output, and one silent fresh fallback, within the remaining timeout, when a resume fails in a way the adapter recognises. - Claude Code: --session-id <random uuid>, --resume <id>, --name on verified versions, "No conversation found" maps to state_missing. Codex: exec resume <id>, thread id from thread.started. OpenCode, Copilot CLI and Grok Build stay without resume. - Engine: SessionResolver (issue mailbox, container runner, local adapter, installed version, setting, no credential mount overlap), with the prior id read from llm_sessions by mailbox and adapter only. AgentSessionStore keeps state in {base}/.agent-sessions/{org}-{project}-issue-{iid}/{adapter}, mode 0700, mounted read-write at sessionStatePath under a worker-owned tmpfs. - branch_name is frozen at the first run whatever the phase; read-only runs use the branch only once it exists on the remote. - llm_sessions gains session_name, native_session_id, resumed and resume_fallback, recorded whatever the outcome. - MailboxCleanup removes the mailbox's session state. - The run screen shows the session name, native id and resumed or fresh reason; the agents screen shows which versions resume sessions. - FakeLlmAdapter gains withResumableSessions() and refuseNextResume(). Refs: #7WIP: Name local agent sessions after the issue branch and resume themto Name local agent sessions after the issue branch and resume themView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.