Environment: macOS, hstry 0.5.18, Bun 1.3.13
Problem: hstry web sync --provider chatgpt completes silently but saves 0 conversations.
Two bugs found:
1. hstry web login chatgpt closes before auth completes
The login flow waits for textarea selector, but ChatGPT's landing page renders a textarea before the user authenticates (e.g. on the marketing/landing page). Playwright captures state immediately and closes — without the __Secure-next-auth.session-token cookie. Result: only Cloudflare cookies are saved.
Fix: wait for a selector that only appears post-auth, e.g.:
await page.waitForSelector('[data-testid="profile-button"], nav[aria-label="Chat history"]', { timeout: 0 });
2. request.newContext crashes on relative URL in Set-Cookie header
Without baseURL set, Playwright's internal _parseSetCookieHeader receives a relative URL (/backend-api/workspaces) from ChatGPT's API response and crashes:
TypeError: "/backend-api/workspaces" cannot be parsed as a URL.
at _parseSetCookieHeader (playwright-core/lib/coreBundle.js)
Fix: pass baseURL to request.newContext:
const api = await request.newContext({
storageState: storageStatePath,
baseURL: providerUrls[provider], // add this
});
Both fixes are one-liners. Happy to open a PR if helpful.
Environment: macOS, hstry 0.5.18, Bun 1.3.13
Problem:
hstry web sync --provider chatgptcompletes silently but saves 0 conversations.Two bugs found:
1.
hstry web login chatgptcloses before auth completesThe login flow waits for
textareaselector, but ChatGPT's landing page renders atextareabefore the user authenticates (e.g. on the marketing/landing page). Playwright captures state immediately and closes — without the__Secure-next-auth.session-tokencookie. Result: only Cloudflare cookies are saved.Fix: wait for a selector that only appears post-auth, e.g.:
2.
request.newContextcrashes on relative URL in Set-Cookie headerWithout
baseURLset, Playwright's internal_parseSetCookieHeaderreceives a relative URL (/backend-api/workspaces) from ChatGPT's API response and crashes:Fix: pass
baseURLtorequest.newContext:Both fixes are one-liners. Happy to open a PR if helpful.