A session keeps its conversation when its Job is replaced #3

Merged
mikluko merged 2 commits from feat/session-resume into main 2026-11-17 14:40:46 +00:00
Owner

An agent's claude_claim (e.g. claude-{agent}, with {agent}/{session} replaced) names a PersistentVolumeClaim. The Job mounts it at /var/lib/akephalos/claude, sets fsGroup to the pod user, and gives the host AKEPHALOS_CLAUDE_CONFIG_DIR, which becomes claudeacp's ConfigDir. The host keeps the ACP session id in a file there; on a later start it calls session/resume (session/load where resume is not offered) with that id and gc's working directory. session/new is used when there is no id, the agent has no conversation for it (resourceNotFound), or it offers neither. Any other resume error fails the start.

The city must provide: a PVC (ReadWriteOnce is enough) in kube.namespace for each agent with claude_claim, and claude_claim in that agent's table of akephalos.toml. One-shot agents set nothing. The server does not create the claim. gc must give the session the same work_dir at each start.

Tests: Job replaced then resumed with --resume=<id> and a continued turn; another session or no volume starts new; missing transcript falls back to new and keeps the new id; load fallback; Job volume, mount, env, fsGroup; config validation.

An agent's `claude_claim` (e.g. `claude-{agent}`, with `{agent}`/`{session}` replaced) names a PersistentVolumeClaim. The Job mounts it at `/var/lib/akephalos/claude`, sets `fsGroup` to the pod user, and gives the host `AKEPHALOS_CLAUDE_CONFIG_DIR`, which becomes claudeacp's ConfigDir. The host keeps the ACP session id in a file there; on a later start it calls `session/resume` (`session/load` where resume is not offered) with that id and gc's working directory. `session/new` is used when there is no id, the agent has no conversation for it (resourceNotFound), or it offers neither. Any other resume error fails the start. **The city must provide:** a PVC (ReadWriteOnce is enough) in `kube.namespace` for each agent with `claude_claim`, and `claude_claim` in that agent's table of akephalos.toml. One-shot agents set nothing. The server does not create the claim. gc must give the session the same work_dir at each start. Tests: Job replaced then resumed with `--resume=<id>` and a continued turn; another session or no volume starts new; missing transcript falls back to new and keeps the new id; load fallback; Job volume, mount, env, fsGroup; config validation.
A session keeps its conversation when its Job is replaced
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 51s
237364728e
An agent's claude_claim names a PersistentVolumeClaim that the Job mounts
as Claude's config directory. The host keeps the ACP session id there and
calls session/resume (session/load where resume is not offered) when it
finds one, session/new otherwise.

Assisted-By: Claude <noreply@anthropic.com>
Fix fresh starts and resumed Job replacement
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 55s
49060330e3
Recognize successful resume/load responses so replacement Jobs become Running, and fail startup when configured session-id storage cannot be read or written.

Use gc's staged --session-id as the fresh-start signal: resolveSessionCommand emits it for firstStart or forceFresh and resumes otherwise. GC_CONTINUATION_EPOCH identifies an incarnation, not this choice.

Assisted-By: goose (Kimi)
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascity-ak6s-pack!3
No description provided.