Skip to content

Correct monitor_disconnected description on computed state - #402

Draft
robertjamesprior wants to merge 2 commits into
mainfrom
hypeship/correct-monitor-disconnected-description
Draft

robertjamesprior wants to merge 2 commits into
mainfrom
hypeship/correct-monitor-disconnected-description

Conversation

@robertjamesprior

@robertjamesprior robertjamesprior commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

BrowserMonitorDisconnectedEvent said:

Treat any in-progress computed state (network_idle, page_layout_settled) as unreliable until then.

"Until then" implies the state becomes reliable again once monitor_reconnected arrives. It doesn't come back. The reconnect path closes the connection and calls clearState, which replaces the computed-state map and calls stop() on every previous state. stop() sets dead, and each pending timer callback checks dead and bails, so those timers are dropped permanently.

The spec already contradicted itself on this. BrowserMonitorReconnectedEvent says:

Computed state is reset, so navigation and network tracking restart fresh from this point.

That one is correct. This change makes the disconnect description agree with it.

What the description says now

Two commits. The first replaced the "unreliable until then" wording. The second dropped an overclaim the first one introduced, raised in review:

readiness resumes at the next top-level navigation

That promises more than the code guarantees. Reattachment builds a fresh state machine, and onRequest, onLoadingFinished, onPageLoad, and onDOMContentLoaded are gated only on that state existing, not on a prior Page.frameNavigated. Computed events can fire before any new navigation, carrying the empty nav context newComputedState seeds, which its own comment describes:

navData is initialized to {} and navMeta to an empty map so events emitted before the first frameNavigated carry consistent empty payloads rather than null.

The final text keeps "monitor_reconnected does not restore them" and says computed events can resume before the next navigation with empty nav context, instead of promising they wait for one.

Scope: this repo only, and that is a limitation

An earlier version of this description claimed the change reaches the Python, Node, and Go SDK docstrings. It does not. The same sentence exists in three independently maintained places:

Copy Feeds Status
kernel-images/server/openapi.yaml (here) the in-VM server's own generated types fixed by this PR
kernel-images-private/server/openapi.yaml the shipped image; kernel/kernel builds against it via a replace directive in packages/api/go.mod still stale
kernel/kernel:packages/api/openapi.yaml the public SDKs and API reference, via packages/api/stainless.yaml still stale

Nothing syncs them automatically, and no CI enforces consistency between them. So this PR corrects the in-VM server spec and nothing user-visible. The copy that reaches customers is the one in kernel/kernel.

Merging this alone is still correct, just incomplete. It also widens the drift against the private fork, which is a superset of this spec, so whoever next syncs public into private should expect this hunk.

About the diff size

lib/oapi/oapi.go shows a large diff. That is the base64 gzip blob oapi-codegen embeds for the whole spec, which churns completely whenever any byte of the spec changes. I decoded the embedded spec from both origin/main and this branch and diffed them structurally: exactly one semantic difference, this description. That also confirms the checked-in file had no pre-existing drift.

Regenerated with the standard pipeline (openapi-down-convertoapi-codegenpatch_sse_methodsgo fmtgo generate ./lib/events/...). lib/events/category_gen.go is unchanged, and openapi-3.0.yaml is a build artifact and was removed as the Makefile does.

Note for whoever re-runs this: the Makefile installs the down-converter with pnpm, which isn't in every environment; npm i -g @apiture/openapi-down-convert produces the same result.

One authoring gotcha

An early draft put a colon inside the plain YAML scalar, which silently broke openapi-down-convert with a parse error pointing at the wrong line. The neighbouring reason description quotes its string for the same reason. This version avoids the colon instead.

Testing

  • go build ./... passes
  • go test ./lib/oapi/... ./lib/events/... passes
  • Embedded spec decoded and structurally diffed against origin/main: one semantic change

🤖 Generated with Claude Code

robertjamesprior and others added 2 commits September 18, 2026 20:18
The schema said to treat in-progress computed state as unreliable "until
monitor_reconnected arrives," which implies reconnecting restores it.
Reconnect calls clearState, which stops every computed state and replaces
the map, so pending readiness timers are dropped for good. This also
contradicted BrowserMonitorReconnectedEvent, which already says computed
state is reset and tracking restarts fresh.

Regenerated lib/oapi/oapi.go; the large base64 diff is the re-gzipped
embedded spec, whose only semantic change is this description.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Computed events can fire before the next navigation: reattachment builds a
fresh state machine, and onRequest, onLoadingFinished, onPageLoad, and
onDOMContentLoaded are gated only on the state existing, not on a prior
frameNavigated. Those events carry the empty nav context newComputedState
seeds. Say that instead of promising readiness waits for a navigation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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