Repository navigation
fix(#222): capture /fx-scoped session cookie + seed headed context from pre-launch snapshot (macOS) - #230
Merged
Conversation
…om pre-launch snapshot (macOS) Two macOS-specific fixes so generation authenticates (createProject no longer 401s): 1. cookies.py: _get_chrome_cookies_playwright derives flow cookies from the FULL jar filtered by domain, not ctx.cookies([labs.google]) which only returns path-"/" cookies and silently dropped __Secure-next-auth.session-token (scoped to /fx). This is the unconditional bug — verification/pre-read now capture the session (preread_count 2 -> 5-8). 2. client.py: restore _ensure_context_session_cookie (log + seed) and pre-read the flow cookies via get_chrome_cookie_snapshot BEFORE the headed context launches (the headless --password-store=basic fallback is the one reader that decrypts on macOS; pre-launch avoids the profile singleton-lock deadlock). Seed them into the headed context when its native decrypt loaded nothing. On macOS the headed context's native decrypt is intermittent: observed both context_cookie_count=0 (seed rescues -> seeded_session=True) and =7 (native, seed no-op). Both reach batchGenerateImages 200. No-op on Windows. Adds 3 tests for the seed path. Full suite: 1906 passed, 6 skipped, 1 xfailed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the contribution. This PR has been marked as an external contribution and routed for maintainer review. Before merge, please make sure:
GitHub Copilot code review may be requested as an advisory first pass, but maintainer approval is still required. |
Merged
ffroliva
added a commit
that referenced
this pull request
Jul 1, 2026
The #228 boundary guards pushed gflow_generate_image/video over the cognitive- complexity threshold and duplicated the bad-parameter error literal. Extract: - `_BAD_PARAM_TYPE` constant + `_bad_param()` builder (fixes S1192 duplicated literal) - `_resolve_image_references()` and `_build_video_media_inputs()` helpers, moving the mode/mutual-exclusion/path validation out of the tool functions (fixes S3776 cognitive complexity on both) Adds unit tests for the extracted helpers plus the #230 `_preread_flow_session_cookies` capture path (D4 council gap) and the video `tool_specs` expansion branch — lifting new-code coverage back over 80%. Behavior-preserving; 38 affected tests green, pyright src 0 errors.
ffroliva
added a commit
that referenced
this pull request
Jul 1, 2026
test(222): falsifiable /fx cookie-path regression for #230
kittinan
pushed a commit
to kittinan/gflow-cli
that referenced
this pull request
Jul 1, 2026
The ffroliva#230 fix reads the full cookie jar filtered by domain instead of the path-/ URL filter that silently dropped the /fx-scoped __Secure-next-auth.session-token. This regression asserts the session token survives _get_chrome_cookies_playwright: the mocked context returns it only from the full jar (ctx.cookies()), not the URL-filtered read (ctx.cookies([url])), so the test FAILS on the pre-ffroliva#230 form and PASSES on the fix (verified by temporary revert). Closes the D4 council coverage gap.
15990166686ll-crypto
pushed a commit
to 15990166686ll-crypto/gflow-cli
that referenced
this pull request
Aug 24, 2026
…velop fix(ffroliva#222): capture /fx-scoped session cookie + seed headed context from pre-launch snapshot (macOS)
15990166686ll-crypto
pushed a commit
to 15990166686ll-crypto/gflow-cli
that referenced
this pull request
Aug 24, 2026
The ffroliva#228 boundary guards pushed gflow_generate_image/video over the cognitive- complexity threshold and duplicated the bad-parameter error literal. Extract: - `_BAD_PARAM_TYPE` constant + `_bad_param()` builder (fixes S1192 duplicated literal) - `_resolve_image_references()` and `_build_video_media_inputs()` helpers, moving the mode/mutual-exclusion/path validation out of the tool functions (fixes S3776 cognitive complexity on both) Adds unit tests for the extracted helpers plus the ffroliva#230 `_preread_flow_session_cookies` capture path (D4 council gap) and the video `tool_specs` expansion branch — lifting new-code coverage back over 80%. Behavior-preserving; 38 affected tests green, pyright src 0 errors.
15990166686ll-crypto
pushed a commit
to 15990166686ll-crypto/gflow-cli
that referenced
this pull request
Aug 24, 2026
The ffroliva#230 fix reads the full cookie jar filtered by domain instead of the path-/ URL filter that silently dropped the /fx-scoped __Secure-next-auth.session-token. This regression asserts the session token survives _get_chrome_cookies_playwright: the mocked context returns it only from the full jar (ctx.cookies()), not the URL-filtered read (ctx.cookies([url])), so the test FAILS on the pre-ffroliva#230 form and PASSES on the fix (verified by temporary revert). Closes the D4 council coverage gap.
15990166686ll-crypto
pushed a commit
to 15990166686ll-crypto/gflow-cli
that referenced
this pull request
Aug 24, 2026
…-regression test(222): falsifiable /fx cookie-path regression for ffroliva#230
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.
Fixes #222 — macOS generation 401
Re: dropping the seed as "disproven" in
98bd455— I think the seed actually works; the dropped version just sourced cookies frombrowser_cookie3(which fails on macOS) and read them at path/. With two corrections, generation succeeds on macOS (Apple Silicon, verified end-to-end).1. Read flow cookies by domain, not root-path URL (unconditional bug fix)
_get_chrome_cookies_playwrightusedctx.cookies(["https://labs.google"]), which only returns cookies whose path matches/— silently dropping__Secure-next-auth.session-token(scoped to/fx, where the Flow app +createProjectlive). Switched to the full jar filtered by domain. This alone fixes verification / pre-read capturing the session (preread_countwent 2 → 5–8, now including the session token).2. Pre-read + seed the session into the headed context (safety net)
On macOS the headed generation context's native cookie decrypt is intermittent:
context_cookie_count=0, flow_session_cookie_present=False) →createProject401s;context_cookie_count=7, present=True).When it loads nothing, we seed the session from a snapshot read pre-launch via the headless
--password-store=basicreader (the one path that decrypts on macOS; done pre-launch to avoid the profile singleton-lock deadlock). Restores_ensure_context_session_cookie(log + seed). No-op where the context loads the cookie itself (Windows, or the successful-decrypt runs).Verified on macOS (Apple Silicon) — both paths
Full suite: 1906 passed, 6 skipped, 1 xfailed. Added 3 tests for the seed path.
Separate finding (worth its own follow-up)
The 401 was also masked by a login-capture bug: on macOS, if Chrome is already running,
gflow auth login --browser chromeis hijacked by the running instance and the sign-in lands in the user's default profile, so the session is never persisted to the gflow profile (the profile had__Host-next-auth.csrf-token+callback-urlbut nosession-token/SAPISID). Quitting Chrome beforeauth loginfixed capture. gflow could detect a running Chrome at login and warn/relaunch — happy to file separately.