Skip to content

feat(router): stable hash session without repo - #62

Merged
mrsimpson merged 3 commits into
mainfrom
fix/stable-hash-session-without-repo
May 13, 2026
Merged

feat(router): stable hash session without repo#62
mrsimpson merged 3 commits into
mainfrom
fix/stable-hash-session-without-repo

Conversation

@mrsimpson

Copy link
Copy Markdown
Owner

No description provided.

## Intent
For sessions without a repo URL, getSessionHash uses crypto.randomUUID() so
each call produces a different hash. Calling ensurePVC and ensurePod
independently meant each got a distinct hash — the Pod referenced a PVC
that didn't exist.
## Decisions
- Hash is the first required parameter of ensurePVC/ensurePod (hash = identity,
SessionKey = data). Callers must compute the hash once and pass it in; the
functions no longer call getSessionHash internally.
- startSession (new export) freezes the hash exactly once for no-repo sessions
then passes it to both ensurePVC and ensurePod. api.ts no-repo path now
calls startSession instead of ensurePVC + ensurePod directly.
- Git-repo sessions remain deterministic; api.ts still calls ensurePVC/ensurePod
directly with a pre-computed hash.
- Hash is kept internal to pod-manager — not accepted from untrusted callers,
preventing a malicious consumer from targeting another user's PVC.
## Major changes
- pod-manager.ts: ensurePVC(hash, session) / ensurePod(hash, session, githubToken?, image?)
- pod-manager.ts: startSession(session, githubToken?) — new export
- pod-manager.ts: prepullImage / resumeSession updated to pre-compute hash
- api.ts: no-repo path uses startSession; git-repo path passes hash explicitly
- pod-manager.test.ts / api.test.ts: all signatures and mock index assertions updated
- Added regression tests: startSession — stable hash for no-repo session
…ssions
Two issues in the init container script:
1. setup-skills.sh ran without cd-ing to ~/.config/opencode so
experimental_install read the wrong skills-lock.json (from CWD, not the
config dir), logged 'No project skills found' and could exit non-zero.
Fixed: cd to $HOME/.config/opencode before running experimental_install.
Also added --yes flag to skip interactive prompts.
2. No-repo sessions (git init /workspace path) didn't use safe.directory so
on pod restart the pre-existing /workspace/.git caused 'fatal: detected
dubious ownership', failing the init container with set -e.
Fixed: added -c safe.directory=/workspace to all git commands in the
no-repo branch.
@mrsimpsonmrsimpson changed the title Fix/stable hash session without repofeat(router): stable hash session without repoMay 13, 2026
@mrsimpson
mrsimpson merged commit f8f16a1 into mainMay 13, 2026
3 of 4 checks passed
@mrsimpson
mrsimpson deleted the fix/stable-hash-session-without-repo branch May 13, 2026 10:23
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@mrsimpson