-
Notifications
You must be signed in to change notification settings - Fork 11
Fix docker-git auth claude login failing after successful OAuth login #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
konard
wants to merge
18
commits into
ProverCoderAI:main
Choose a base branch
from
konard:issue-439-c9a9c01e8b9b
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2738a0c
Initial commit with task details
konard 7c58988
chore(release): version packages
github-actions[bot] 72bf8eb
fix(claude): keep OAuth token when post-login API probe fails
konard 19bd8c3
Merge remote-tracking branch 'origin/main' into issue-439-c9a9c01e8b9b
konard 09dc407
test(claude): verify docker-backed auth login
skulidropek a02936b
refactor(claude): extract docker oauth package
skulidropek bd54c54
chore(release): version packages
github-actions[bot] 025b925
fix(auth): harden claude oauth login probe path
konard 875fbd5
fix(app): keep controller compose lintable
konard de50520
fix(auth): address claude oauth review hardening
konard bbd1885
Merge remote-tracking branch 'origin/main' into issue-439-c9a9c01e8b9b
konard 5ba9e51
fix(auth): persist claude oauth token atomically
konard 88da062
fix(ci): avoid github api cache bust in project image
konard 5dc13bc
fix(app): require gpu overlay regular file
konard 06a4e2a
ci: retry bun install in setup action
konard bc1da97
fix(shell): isolate claude oauth env boundary
konard 8abc88d
fix(shell): address coderabbit oauth review
konard aedf7d3
fix(test): isolate claude auth e2e token injection
konard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| "@prover-coder-ai/docker-git": patch | ||
| --- | ||
|
|
||
| Fix `docker-git auth claude login` failing after a successful OAuth login. | ||
|
|
||
| After `claude setup-token` created and persisted the OAuth token, the login | ||
| command ran a verification probe (`claude -p ping`) and treated any non-zero | ||
| exit as a hard failure, exiting with code 1 even though the token was already | ||
| saved. A transient probe failure (network hiccup, rate limit, or token | ||
| propagation delay) would therefore discard an otherwise successful login. | ||
|
|
||
| The probe failure is now reported as a warning instead of an error, mirroring | ||
| `docker-git auth claude status`. The token is kept, and the user is advised to | ||
| re-check connectivity later with `docker-git auth claude status`. | ||
|
|
||
| Controller startup now also rejects `DOCKER_GIT_CONTROLLER_GPU=all` when | ||
| `docker-compose.gpu.yml` exists as a directory instead of a regular file, | ||
| matching the extra compose overlay invariant before invoking Docker Compose. |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
137 changes: 137 additions & 0 deletions
137
packages/app/src/docker-git/controller-compose-files.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| import type { PlatformError } from "@effect/platform/Error" | ||
| import * as FileSystem from "@effect/platform/FileSystem" | ||
| import * as Path from "@effect/platform/Path" | ||
| import { Effect } from "effect" | ||
|
|
||
| import { type ControllerBootstrapError, controllerBootstrapError } from "./host-errors.js" | ||
|
|
||
| export const controllerGpuModeEnvKey = "DOCKER_GIT_CONTROLLER_GPU" | ||
| export const controllerComposeExtraFileEnvKey = "DOCKER_GIT_CONTROLLER_COMPOSE_EXTRA_FILE" | ||
|
|
||
| export type ControllerGpuMode = "none" | "all" | ||
|
|
||
| export type ControllerComposeFiles = { | ||
| readonly composePath: string | ||
| readonly extraOverlayPath: string | null | ||
| readonly gpuOverlayPath: string | null | ||
| readonly runtimeOverlayPath: string | null | ||
| } | ||
|
|
||
| const mapComposePathError = (error: PlatformError): ControllerBootstrapError => | ||
| controllerBootstrapError(`Failed to resolve docker-compose.yml path.\nDetails: ${String(error)}`) | ||
|
|
||
| // CHANGE: add a verified controller compose overlay boundary for E2E/runtime callers | ||
| // WHY: temporary compose overrides must be part of the explicit docker compose argument vector | ||
| // QUOTE(ТЗ): n/a | ||
| // REF: issue-440-review-compose-overlay | ||
| // SOURCE: n/a | ||
| // FORMAT THEOREM: forall p: env(extra)=p and regular_file(resolve(p)) -> resolve(extra)=Some(resolve(p)) | ||
| // PURITY: SHELL | ||
| // EFFECT: Effect<string | null, ControllerBootstrapError, FileSystem | Path> | ||
| // INVARIANT: non-empty extra compose env values either resolve to a regular file or fail before docker compose | ||
| // COMPLEXITY: O(1) | ||
| export const loadControllerComposeExtraPath = (): Effect.Effect< | ||
| string | null, | ||
| ControllerBootstrapError, | ||
| FileSystem.FileSystem | Path.Path | ||
| > => | ||
| Effect.gen(function*(_) { | ||
| const raw = process.env[controllerComposeExtraFileEnvKey]?.trim() ?? "" | ||
| if (raw.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| const fs = yield* _(FileSystem.FileSystem) | ||
| const path = yield* _(Path.Path) | ||
| const extraOverlayPath = path.resolve(raw) | ||
| const isExists = yield* _(fs.exists(extraOverlayPath).pipe(Effect.mapError(mapComposePathError))) | ||
| if (!isExists) { | ||
| return yield* _( | ||
| Effect.fail( | ||
| controllerBootstrapError( | ||
| `${controllerComposeExtraFileEnvKey} points to ${extraOverlayPath}, but it was not found.` | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| const info = yield* _(fs.stat(extraOverlayPath).pipe(Effect.mapError(mapComposePathError))) | ||
| return info.type === "File" | ||
| ? extraOverlayPath | ||
| : yield* _( | ||
| Effect.fail( | ||
| controllerBootstrapError( | ||
| `${controllerComposeExtraFileEnvKey} points to ${extraOverlayPath}, but it is not a regular file.` | ||
| ) | ||
| ) | ||
| ) | ||
| }) | ||
|
|
||
| export const composeFilesForMode = ( | ||
| composePath: string, | ||
| gpuOverlayPath: string | null, | ||
| runtimeOverlayPath: string | null = null, | ||
| extraOverlayPath: string | null = null | ||
| ): ReadonlyArray<string> => [ | ||
| "-f", | ||
| composePath, | ||
| ...(runtimeOverlayPath === null ? [] : ["-f", runtimeOverlayPath]), | ||
| ...(gpuOverlayPath === null ? [] : ["-f", gpuOverlayPath]), | ||
| ...(extraOverlayPath === null ? [] : ["-f", extraOverlayPath]) | ||
| ] | ||
|
|
||
| export const composeFilesToArgs = (composeFiles: ControllerComposeFiles): ReadonlyArray<string> => | ||
| composeFilesForMode( | ||
| composeFiles.composePath, | ||
| composeFiles.gpuOverlayPath, | ||
| composeFiles.runtimeOverlayPath, | ||
| composeFiles.extraOverlayPath | ||
| ) | ||
|
|
||
| // CHANGE: require the GPU compose overlay path to be a regular file | ||
| // WHY: docker compose accepts file arguments; accepting directories delays the failure past typed bootstrap validation | ||
| // QUOTE(ТЗ): "Исправь CI/CD и все правки от Rabbit Coder." | ||
| // REF: PR-440-CodeRabbit-f31ac99d | ||
| // SOURCE: n/a | ||
| // FORMAT THEOREM: forall p: gpu=all and regular_file(resolve(p)) -> resolve(gpu)=Some(resolve(p)) | ||
| // PURITY: SHELL | ||
| // EFFECT: Effect<string, ControllerBootstrapError, FileSystem | Path> | ||
| // INVARIANT: GPU compose overlay resolution returns only existing regular files | ||
| // COMPLEXITY: O(1) | ||
| const requireGpuOverlayPath = ( | ||
| composePath: string | ||
| ): Effect.Effect<string, ControllerBootstrapError, FileSystem.FileSystem | Path.Path> => | ||
| Effect.gen(function*(_) { | ||
| const fs = yield* _(FileSystem.FileSystem) | ||
| const path = yield* _(Path.Path) | ||
| const gpuOverlayPath = path.join(path.dirname(composePath), "docker-compose.gpu.yml") | ||
| const isExists = yield* _(fs.exists(gpuOverlayPath).pipe(Effect.mapError(mapComposePathError))) | ||
| if (!isExists) { | ||
| return yield* _( | ||
| Effect.fail( | ||
| controllerBootstrapError(`${controllerGpuModeEnvKey}=all requires ${gpuOverlayPath}, but it was not found.`) | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| const info = yield* _(fs.stat(gpuOverlayPath).pipe(Effect.mapError(mapComposePathError))) | ||
| return info.type === "File" | ||
| ? gpuOverlayPath | ||
| : yield* _( | ||
| Effect.fail( | ||
| controllerBootstrapError( | ||
| `${controllerGpuModeEnvKey}=all requires ${gpuOverlayPath}, but it is not a regular file.` | ||
| ) | ||
| ) | ||
| ) | ||
| }) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| export const composeFilesForGpuMode = ( | ||
| composePath: string, | ||
| gpuMode: ControllerGpuMode | ||
| ): Effect.Effect<ControllerComposeFiles, ControllerBootstrapError, FileSystem.FileSystem | Path.Path> => | ||
| gpuMode === "none" | ||
| ? Effect.succeed({ composePath, extraOverlayPath: null, gpuOverlayPath: null, runtimeOverlayPath: null }) | ||
| : requireGpuOverlayPath(composePath).pipe( | ||
| Effect.map((gpuOverlayPath) => ({ composePath, extraOverlayPath: null, gpuOverlayPath, runtimeOverlayPath: null })) | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.