Skip to content

A declared browser session is stored the first time a run reaches for it - #259

Merged
czpython merged 1 commit into
mainfrom
session-on-use
Aug 16, 2026
Merged

A declared browser session is stored the first time a run reaches for it#259
czpython merged 1 commit into
mainfrom
session-on-use

Conversation

@czpython

Copy link
Copy Markdown
Owner

What

A BrowserSession declared on an extension had no way to reach its stored row: the identity is namespaced (x_me.x), and the only code path that creates a row is POST /api/browser-sessions, whose name pattern accepts neither dots nor underscores. Every borrow of a declared session raised BrowserSessionUnknownError, so the author surface documented in writing-an-extension.md could not run.

The declaration now resolves its row on first use, the way a Service gets its ServiceIdentity on connect — nothing is written at import or install. The first borrow writes the row as needs_login with the declared site, which is what puts it in the sessions pane for the operator to sign into; the borrow itself still refuses, now saying the session is not ready rather than that it does not exist. mark_stale() resolves the same way, so reporting a bounced login before the first successful borrow lands on a row instead of raising.

Testing

  • The first borrow of a never-used declaration writes a needs_login row carrying the declared site, raises not-ready, and a second borrow reuses that one row rather than writing another.
  • Existing borrow coverage (ready sessions, writer-lock contention, launch failure, persist write-back) is unchanged.

Until a workflow borrows the login, the declaration is the only thing
that exists — nothing is written at import or install. The first borrow
writes the row, so the sessions pane can show the operator which login
the extension is waiting on, and the borrow itself says the session is
not ready yet. Reporting a bounced login lands on the same row.
@czpython
czpython merged commit 77dc885 into main Aug 16, 2026
1 check passed
@czpython
czpython deleted the session-on-use branch August 16, 2026 14:07
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.

1 participant