feat(router): stable hash session without repo#62
Merged
Conversation
## 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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.