fix: isolate claudart claude runs by --session-id - #36
Merged
Conversation
…nfig dir CLAUDE_CONFIG_DIR isolation broke claudart's own auth — the OAuth token rotates and the live token lives in ~/.claude, so a copied/Keychain credential goes stale and 401s (surfaced by dogfooding claudart chat). Switch to a fresh per-run --session-id: keeps the live shared auth, gives each run its own session distinct from the user's interactive Claude Code session. 862 tests green.
There was a problem hiding this comment.
Pull request overview
This PR updates claudart’s claude CLI invocation to isolate each background run from the user’s interactive Claude Code session by passing a fresh --session-id, avoiding prior config-dir isolation that could invalidate rotated OAuth credentials.
Changes:
- Add
newClaudeSessionId()helper to generate RFC-4122 v4 UUID session IDs. - Pass
--session-id <uuid>to theclaudesubprocess indefaultClaudeRunner. - Add unit tests validating UUID format and per-call uniqueness.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/pipeline/claude_session_test.dart | Adds unit tests for RFC-4122 v4 formatting and uniqueness of generated session IDs. |
| lib/pipeline/pipeline_executor.dart | Injects a fresh --session-id into the claude CLI arguments to isolate runs. |
| lib/pipeline/claude_session.dart | Introduces UUID v4 generation for claude --session-id. |
| lib/claudart.dart | Exposes newClaudeSessionId via the public barrel export. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Config-dir isolation 401'd (OAuth token rotation); replaced with a fresh per-run
--session-idthat keeps live auth and isolates the session. Surfaced by dogfoodingclaudart chat. 862 tests green.