Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 12
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2738a0c7c5898872bf8eb19bd8c309dc407a02936bbd54c54025b925875fbd5de50520bbd18855ba9e5188da0625dc13bc06a4e2abc1da978abc88daedf7d3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Uh oh!There was an error while loading. Please reload this page. | ||
| 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 })) | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.