Repository navigation
feat(web): add observationNodeBudget option - #1620
ahmadparizaad wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (agent-run triage).
Thanks. The wiring is small and clean: both capture paths (surface.ts observe and trace-feed.ts) get nodeBudget, the old constant is gone, frames still share one budget, truncation flag untouched, no cache-key impact (buildTraceCacheKey has no observation content). CI green.
Heads up: this is a feat, and #1510 has no maintainer agreement on the API yet (CONTRIBUTING asks for that first). The API shape is a maintainer call, see the end. Review of the code as it stands:
Must fix
- No test proves the option does anything.
protected-app-options.test.ts:69-86only checks validation. The issue asked for "override reaches a control past the old cutoff" and "shared cross-frame limit" tests; both are missing. Mutations that makesurface.ts:339ignore the option, hardcode 3000 in capture, or switch to a per-frame budget all survive the suite. Add an integration test throughweb({...}).observe(likehidden-frames.test.ts): ~4,000 buttons + a trailing link, default misses it,observationNodeBudget: 8_000finds it; and a small budget split across main document + iframe. (A scratch version of both killed those mutations.) - Docs miss the agent-side byte budget, which likely binds first. The agent cuts the tree text at
agents.<name>.maxObservationBytes(256 KB), also clamped bymaxInputTokens(64k) minus overhead, so roughly 55-60 KB by default. At ~25-60 bytes per tree line, the model probably already sees fewer than 3,000 nodes on a dense page, so raising the node budget alone may not letactreach the late control. Docs should say to raise those too, and the PR needs evidence the #1510 storefront case is actually fixed (a real run). - Cost wording is off. "every extra node costs tokens on each observation": model tokens are capped by the byte budget. The real cost is capture time, CDP payload, and the trace screen after each action, which has a 1 s deadline (
trace-feed.ts:15), so big budgets can silently drop trace screens. Say that in user terms.
Nits
- Changeset bumps
e2e, but nothing ine2echanged. Only@e2e-dev/web. engine.ts:411-415: JSDoc citesmintId, budgets go throughreserveIds(refs.ts:45); the 1,000,000 cap has no stated basis.engine.ts:418"no capture could spend" isn't what the validator checks.surface.ts:278repeats the JSDoc ofCaptureSettings.nodeBudgetandWebOptions(three near-identical comments).- Docs use internal terms ("semantic capture", "reports
truncated"). Prefer "the observation is marked incomplete". protected-app-options.test.tsheader comment listing the options wasn't updated.
For maintainers: accept the option at all (vs ranking viewport/interactive nodes first, #1237); name observationNodeBudget vs maxObservationNodes (parallels maxObservationBytes); per-target vs config-level; the 1,000,000 cap.
|
Before I build out the remaining items (integration test, docs on the byte budget, changeset fix): is |
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
Automated review (agent-run triage). Good call to ask before building the tests. The shape ( |
|
Thanks for the PR. We are closing it without merging. We have not agreed on an API for #1510 yet, and the requested changes from 2026-11-07 are still open: no test shows that the option reaches a control past the old cutoff. Also, the agent's observation byte budget ( |
Issue
Fixes #1510
What changed
web({ observationNodeBudget })sets the node budget one observation spends, shared across the main document and its frames, default 3,000 (MAX_OBSERVED_NODESinobservation-capture.tswas the fixed value).INVALID_CONFIGotherwise; added toWEB_OPTION_KEYSso it is a knownweb()key.captureObservationthroughCaptureSettings.nodeBudget, which also feedsTraceFeedcaptures.docs/reference/web.mdxoption table and section) and a patch changeset for@e2e-dev/webande2e.Verified
Ran it locally: yes
pnpm --filter @e2e-dev/web test:unit: all unit tests pass, including the newweb({ observationNodeBudget })cases (rejects0,-1,1.5,NaN,'8000'asINVALID_CONFIG; accepts8_000) and the updated unknown-key message.pnpm --filter @e2e-dev/web typecheck,pnpm run lint,pnpm docs:check: clean.