Skip to content

fix: set explicit max-age in _set_coulomb_token to prevent cookie eviction#17

Merged
mbillow merged 4 commits intomainfrom
claude/fix-cookie-expiry-2X9f3
Mar 28, 2026
Merged

fix: set explicit max-age in _set_coulomb_token to prevent cookie eviction#17
mbillow merged 4 commits intomainfrom
claude/fix-cookie-expiry-2X9f3

Conversation

@mbillow
Copy link
Copy Markdown
Owner

@mbillow mbillow commented Mar 28, 2026

aiohttp's CookieJar tracks expiry separately from the morsel value.
Calling update_cookies() without max-age left the original 2-hour
expiry timestamp intact, causing coulomb_sess to be evicted and
triggering RuntimeError after 2 hours. Setting a ~10-year max-age
overwrites the expiry timestamp on every refresh.

Bumps version to 2.3.2.

https://claude.ai/code/session_01DKeE6wx2BUUyNQnC6cJHZ8

claude added 4 commits March 28, 2026 05:49
…ction

aiohttp's CookieJar tracks expiry separately from the morsel value.
Calling update_cookies() without max-age left the original 2-hour
expiry timestamp intact, causing coulomb_sess to be evicted and
triggering RuntimeError after 2 hours. Setting a ~10-year max-age
overwrites the expiry timestamp on every refresh.

Bumps version to 2.3.2.

https://claude.ai/code/session_01DKeE6wx2BUUyNQnC6cJHZ8
Four new tests in test_client.py:
- raises ValueError on empty token
- cookie is retrievable immediately after being set
- documents root cause: update_cookies() without max-age leaves prior
  expiry intact (aiohttp evicts after 1s in the test)
- proves the fix: _set_coulomb_token overwrites the expiry so the
  cookie survives past the original server-set Max-Age

https://claude.ai/code/session_01DKeE6wx2BUUyNQnC6cJHZ8
black 26.x removes the enforcement of two blank lines after the last
import block. The system/CI environment was running black 26.1.0 while
the lock file pinned 25.1.0, causing CI to flag __main__.py. Update the
constraint and lock file to 26.3.1 (latest), and drop the spurious
blank line to match the new rule.

https://claude.ai/code/session_01DKeE6wx2BUUyNQnC6cJHZ8
client.py:
- Extract _COULOMB_SESSION_MAX_AGE constant; drop magic number and comment

tests/test_client.py:
- Add _make_coulomb_cookie() helper to deduplicate SimpleCookie construction
- Add _coulomb_expiry() helper to safely look up aiohttp's _expirations entry
  by cookie name rather than assuming domain/path normalisation
- Replace asyncio.sleep(1.5) in two tests with direct _expirations inspection;
  test suite drops from ~3.7s to ~0.8s

https://claude.ai/code/session_01DKeE6wx2BUUyNQnC6cJHZ8
@mbillow mbillow merged commit 691112f into main Mar 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants