Skip to content

feat(website): a session cookie per site, /go?sid=, the clock's rate, conformance levels and models= (FD-4683) - #444

Open
williamloo-scale wants to merge 16 commits into
wloo/website-gateway-authfrom
wloo/website-sdk-followups
Open

williamloo-scale wants to merge 16 commits into
wloo/website-gateway-authfrom
wloo/website-sdk-followups

Conversation

@williamloo-scale

@williamloo-scale williamloo-scale commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #443.

Website SDK follow-ups.

  • Session cookie per site. agentenv_session_<name>, named on the card, so two sites under one gateway host don't overwrite each other's. The shared agentenv_session is still read for one release.
  • /go?sid=. Each sid is a store of its own started from the seed, the CUA-Gym convention the website state verifier reads. A request runs in its ?sid=, else the one its browser last named (<cookie>_sid), else the default session, which is the data plane's state as before.
  • Clock rate. /clock/time also answers virtual_seconds_per_real_second, which UniverseClock follows instead of inferring it.
  • Conformance: required vs recommended. Only what website/v1 requires of any server fails a run: any host, health, no page at the reserved paths (new), the data-plane round trip. The card's details, X-Universe-Now, clock, forwarded headers and cookies warn; --strict fails on a warning.
  • @website(models=...). An object with load/export/reset, or SQLAlchemy models. With models the site gets self.db on DATABASE_URL, and the data plane and /go read those tables, so the GUI and the MCP tools share rows.

Before merging

models= adds an optional db extra (sqlalchemy>=2.0), included in dev, and updates uv.lock. SQLAlchemy is imported only when a site uses models.

Test

Unit suite: 12,625 passed; the models= tests (6) also pass with SQLAlchemy installed.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge with dependent PR #446’s development-checker fix.

Summary

Adds per-site cookies, named stores through ?sid=, explicit clock rates, required versus recommended checks, and database-backed sites through models=.

  • Website routes can share database rows with MCP tools.
  • Website requests can keep separate state for each named session.
  • The website checker separates required behavior from recommended features.
  • Website clocks follow the rate reported by the gateway.

Reviews (4) · Last reviewed commit: "fix(website): the conformance round trip..." · Reviewed by Greptile

williamloo-scale and others added 5 commits November 2, 2026 10:48
…n_<name> (FD-4683)

Two SDK sites browsed under one gateway host overwrote each other's agentenv_session.
The cookie is now named after the site's environment name, advertised on the website/v1
card, and the conformance check holds the session path to it; the shared legacy cookie is
still read for one release.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e of its own (FD-4683)

The website state verifier reads /go?sid= per checked session, the CUA-Gym convention in
which every sid is an isolated world started from the seed and no sid is the shared
default. Collections keeps sessions; a request runs in its ?sid= or the one its browser
last named (kept in <session cookie>_sid), self.store resolves to that session, and the
default session (sid=default or none) is the data plane's state, as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…stead of guessing it (FD-4683)

The gateway's /clock/time now carries virtual_seconds_per_real_second beside virtual_time
(an extra field; readers of virtual_time are unaffected). UniverseClock extrapolates at that
rate when a clock answers one and falls back to inferring it from two agreeing read
intervals when it doesn't.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… recommended ones (FD-4683)

Only what website/v1 requires of any server fails a run: / for any Host, the health path,
no page at the reserved paths (a new check), and the data-plane round trip when the card
advertises one. The card's details, X-Universe-Now, clock sync, forwarded handling and
cookies are recommended and warn; --strict makes a warning fail too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rver's database (FD-4683)

models= takes an object with load/export/reset, or SQLAlchemy models (a declarative Base,
a MetaData, or a module holding one). For models the site gets self.db, a session factory
on DATABASE_URL (the env's schema, by its search_path), whose tables the data plane loads,
exports and resets and /go reports, so the GUI and the MCP tools share rows. SQLAlchemy is
imported only then, from the new db extra.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/agentenv-protocol/examples/website/notes/README.md
# Conflicts:
#	packages/agentenv-protocol/src/agentenv_protocol/website/clock.py
@williamloo-scale williamloo-scale changed the title website: per-site session cookie, /go?sid=, clock rate, conformance levels, models= (FD-4683) feat(website): a session cookie per site, /go?sid=, the clock's rate, conformance levels and models= (FD-4683) Nov 3, 2026
@williamloo-scale
williamloo-scale marked this pull request as ready for review November 3, 2026 00:24
@williamloo-scale
williamloo-scale requested a review from a team as a code owner November 3, 2026 00:24
williamloo-scale and others added 4 commits November 2, 2026 16:34
# Conflicts:
#	packages/agentenv-protocol/src/agentenv_protocol/website/conformance.py
…ath themselves (FD-4683)

A server serving a page at the exact RPC_PATH or WELL_KNOWN_PATH, and 404 under them, now fails the required check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…river (FD-4683)

The db extra carries SQLAlchemy and no driver; the module docstring says the site installs the one its URL names,
and Tables.engine turns create_engine's bare ModuleNotFoundError into an ImportError naming it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brings in #428's review fixes beside this branch's: the clock's sync
reads under the refresh lock and keeps the answered rate; conformance
checks X-Universe-Now last, on every answer, at the recommended level,
with the reserved-path probes counted; the handwritten test server
stamps its 404s and 405s like every other answer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale and others added 2 commits November 2, 2026 17:50
…s hooks still own (FD-4683)

ModelState.load_parts now deep-copies the hooks' export when it saves the initial state, so a hook that returns row
dicts it keeps editing no longer changes what /go reports as the starting value.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale and others added 2 commits November 2, 2026 18:28
… session cookie (FD-4683)

The cookie keeping the session a browser last named was the session cookie's name plus `_sid`, so the site
`notes`'s `agentenv_session_notes_sid` was also the sign-in cookie of a site named `notes_sid`. It is now
`agentenv_sid_<name>`, a prefix no session cookie has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s changes (FD-4683)

data/reset drops a store's named sessions, which data/get doesn't export, so a check run while a browser had
edited ?sid=task-1 erased that session. /go now names the site's changed_sessions, the named sessions whose
state changed, and the checker skips the round trip when it names any, as it does for a changed default state.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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