feat(browser-task): define negotiated job contracts - #5638
Open
iscekic wants to merge 2 commits into
Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summary (commit 8087941)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8087941)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 54.4K · Output: 9.2K · Cached: 402K Review guidance: REVIEW.md from base branch |
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
No new behavior — this change prepares browser delegation but does not enable it.
Maintainer's changelog
browserJobsV1adds dormantBrowserTaskArguments,BrowserRequest,BrowserResponse,BrowserEvent,BrowserJobHandle,BrowserJobSnapshot,BrowserResult,BrowserProviderOutboundMessage, andBrowserProviderInboundMessagecontracts. Strict schemas bind ownership, approvals, identities, deadlines, and results while bounding data and keeping proofs out of validation errors. The relay and software development kit (SDK) duplicate these contracts for separate consumers; maintainers must keep the copies aligned.Files
services/session-ingest/src/types/user-connection-protocol.ts— M; Source; +494/-0, or 494 changed lines. Defines model operationslist,run,status,cancel, andrecover; the command-line interface (CLI) usesinvokeinstead ofrun. Model arguments cannot select parent, invocation, proof, user, or connection authority. Owned requests requireparentSessionIdandparentProof; status and cancel require a conversation ID, even with an exact job ID. The lookup contract reserves an omittedjobIdfor the conversation's latest job after owner verification. Recovery accepts ownership and an invocation ID, not a new goal or provider. Correlated responses distinguish provider discovery, invoke/cancel acknowledgments, status, recovery, missing invocations, and errors; acknowledgments do not carry progress or terminal results. Distinct prefixed universally unique identifiers (UUIDs) identify providers, conversations, and jobs; request IDs use UUIDs. Invocation IDs useb1.<timestamp>.<digest>; timestamps remain within the safe date range, and proofs and fingerprints require 64 lowercase hexadecimal characters. Snapshots distinguishqueued,awaiting_approval,running,succeeded,failed,cancelled,interrupted, andtimed_out. Terminal snapshots require matching result identities and status; progress events reject terminal results. Success requirescompletedandeffectsUncertain: false; other terminal states use finite failure reasons. Metadata requires bounded generations, millisecond timestamps, a payload fingerprint, and deadlines within retention. Provider discovery exposes labels, availability, and queue depth from zero through 100.packages/cloud-agent-sdk/src/schemas.ts— M; Source; +505/-1, or 506 changed lines. Mirrors the browser contracts and adds outbound web validation and opt-in provider parsers. Provider messages cover registration, heartbeat, approval, results, quiescence, unavailability, exact-job cancellation, dispatch, snapshots, and lease acknowledgments. Only registration acceptsproviderProof; generation zero represents first registration, and recovery requirestabClosed: trueandlocksDrained: true. Approval, results, quiescence, and cancellation carry the job identity and a positive generation. Provider results must match their job; provider snapshots must match their provider and generation. Dispatch accepts onlyawaiting_approvaljobs; snapshots reconcile state and do not grant execution permission. Approved tabs include a bounded integer ID, title, address, andsafeordangerousmode. Queued and awaiting-approval snapshots reject approved tabs; running snapshots require them. Text limits count 8-bit Unicode Transformation Format (UTF-8) bytes. Goals allow 16,384 bytes; results allow 65,536 serialized bytes; complete frames must remain below 131,072 serialized bytes. Discovery and snapshot pages allow 25 entries; results allow 32 evidence items containing text, title, or a valid address. Labels and parent IDs allow 128 bytes; titles and error messages allow 1,024 bytes. Evidence text and addresses allow 8,192 bytes; result summaries allow 32,768 bytes. New browser boundaries reject unknown fields. The genericInvalid browser messageerror omits proof values and unknown key names; consumers must not enable Zod'sreportInput.normalizedBrowserCapabilitiesSchemaproducesBrowserCapabilitieswith missingbrowserJobsV1support set to false; heartbeat,heartbeat_ack,ping, andpongretain optional advertisements. The newwebOutboundMessageSchemavalidates existing web commands, including optionalmutationIdvalues limited to 128 characters. SeparatecliOutboundWithBrowserMessageSchema,cliInboundWithBrowserMessageSchema,webOutboundWithBrowserMessageSchema, andwebInboundWithBrowserMessageSchemapreserve legacy variants and callbacks; consumers must opt in before accepting browser traffic.Files
services/session-ingest/src/types/user-connection-protocol.test.ts— M; Test; +1,017/-0, or 1,017 changed lines. Exercises both copies against canonical frames, authority rejection, proof redaction, malformed identities, invalid states, approval, recovery, byte limits, pagination, and directions. Adds legacy frames and frozen callback types to check compatibility without widening legacy parser unions.packages/cloud-agent-sdk/src/schemas.test.ts— M; Test; +310/-0, or 310 changed lines. Adds relay/SDK parity fixtures, capability normalization cases, direction checks, and compatibility checks for legacy callbacks, commands, results, and errors. Preserves legacy handling of unknown fields and verifies that only opt-in parsers accept browser frames.Tests: 2 files modified —
schemas.test.tsanduser-connection-protocol.test.ts; 1,327 lines added.Generated: 0 files changed.
Verification
No manual or end-to-end tests ran for this level because it adds dormant schemas and does not enable browser delegation. Runtime verification remains pending on the stack tips; no end-to-end report is attached.
Visual Changes
Visual Changes: N/A
Reviewer Notes
Human steps
human-ready, merge each repository's levels from bottom to top.Recorded automated checks
The handoff records seven passing scoped checks and 252 passing cases across the two changed protocol suites. These local results do not establish live verification, continuous integration (CI), or a passing section gate.
Repository scope
Kilo-Org/cloud:/Users/igor/Projects/.worktrees/browser-task-0787; branchbrowser-task-0787; baseorigin/main. This level changes four files, with 2,326 added lines and one deleted line.Kilo-Org/kilocode:/Users/igor/Projects/.worktrees/browser-task-0787-kilocode; branchbrowser-task-0787; baseorigin/main. The matching CLI contracts are published in Kilo-Org/kilocode#13535. Both schema levels remain dormant.Notes
Runtime verification remains pending on the stack tips. This level adds dormant schemas and does not enable browser delegation.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
browser-task-0787— feat(browser-task): define negotiated job contracts #5638 ← this PRbrowser-task-0787-s2— feat(session-ingest): persist owned browser jobs #5644browser-task-0787-s3— feat(session-ingest): route fenced browser providers #5648browser-task-0787-s4— feat(cloud-agent-sdk): support browser provider jobs #5653 (tip)