feat(cloud-agent-sdk): support browser provider jobs - #5653
Open
iscekic wants to merge 3 commits into
Open
Conversation
This was referenced Aug 28, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 211.1K · Output: 20.7K · Cached: 610.8K 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.
No new behavior — this change prepares browser task support without changing the product's current controls.
Summary
The software development kit (SDK) adds
BrowserProviderConnectionthroughUserWebConnectionConfig.browserProvider; omitted values stay permanently disabled. AfterbrowserJobsV1negotiation, retained connections use typed callbacks and short requests; lease loss blocks actions before owner callbacks. Onlyprovider_joboffers new work; owners must wait for a running snapshot, and reconnect recovers history without execution replay.Files
packages/cloud-agent-sdk/src/user-web-connection.ts— Source; M (modified), 813 changed lines. Requires a matching capability ping/pong before registration or composite parsing. Adds state subscriptions and typed registration, heartbeat, status, approval, cancellation, result, quiescence, and unavailable methods. Validates outbound messages, bounds correlated requests to 10 seconds, and renews leases halfway to expiry. Heartbeat requests require both the matching lease acknowledgement and snapshot. Separates proof-authenticated, cursor-based history from live snapshots, including history after rejected registration or lease loss. History failures leave live leases unchanged. Reconnect retains stable registration data, clears live snapshots, and never replays work, results, or one-shot recovery assertions. Rejects duplicate, foreign, stale, cancelled, or regressive job messages before callbacks. Validates job bindings; results must match the running job and all approved-tab metadata. Expiry, revocation, connection replacement, ticket refresh, and teardown invalidate authority before owner callbacks. Cancelling approved work revokes the lease; cancelling queued or unapproved work preserves it. Allows quiescence for completed or cancelled jobs after lease loss while the binding survives. Explicit unavailability prevents automatic registration, even when sending fails. Sanitizes provider and authentication errors, ignores late sockets and stale refreshes, and stops callbacks after release or destruction.packages/cloud-agent-sdk/src/user-web-connection.test.ts— Test; M (modified), 1,377 added lines. Adds fake-timer fixtures and an in-process harness using the real relay. Covers legacy compatibility, negotiation, request timeouts, generation checks, job updates, cancellation, lease expiry, ticket loss, historical recovery, teardown, and error redaction.Public exports add
BrowserProviderConnection,BrowserProviderState,BrowserProviderError, andBrowserProviderErrorCode; the privatebrowserProviderErrorSchemavalidates relay failures without exposing their text. Lease and history callers receiveBrowserProviderRegistration,BrowserProviderLease,BrowserProviderSnapshot,BrowserProviderStatusResult,BrowserJobHandle,BrowserJobSnapshot,BrowserProviderInboundMessage,BrowserProviderOutboundMessage, andBrowserResult. Typed operations useBrowserProviderApprovalInput,BrowserProviderCancelInput,BrowserProviderResultInput,BrowserProviderQuiescenceInput, andBrowserProviderUnavailableInput, without changing the existingUserWebConnectioncontract or legacy inbound union.Files
packages/cloud-agent-sdk/src/index.ts— Source; M (modified), 22 changed lines. Exposes the provider error class and provider connection, state, operation, message, job, lease, and history types through the package entry point.Tests: 1 modified test file,
packages/cloud-agent-sdk/src/user-web-connection.test.ts, with 1,377 added lines.Generated: 0 files changed.
Verification
The handoff reports no manual verification. Runtime verification remains pending on the stack tips. The handoff includes no end-to-end (E2E) report.
Visual Changes
Visual Changes: N/A
Reviewer Notes
Human steps
Automated checks
The recorded scoped checks passed 5/5. The evidence covers local checks only; it does not establish continuous integration (CI) or live verification.
oxfmt --writeon the three changed filesoxlint --deny-warningson the three changed filesuser-web-connection.test.tsJest suiteoxfmt --checkon the three changed filesgit diff --checkon the three changed filesScope and dependencies
This description covers Cloud level 4 only. The lower levels own the prerequisite history contracts, ledger reads, and relay routing.
Worktrees
Kilo-Org/cloud:/Users/igor/Projects/.worktrees/browser-task-0787, branchbrowser-task-0787-s4; comparison basebrowser-task-0787-s3.Kilo-Org/kilocode:/Users/igor/Projects/.worktrees/browser-task-0787-kilocode, branchbrowser-task-0787; related contracts only, outside this level's diff.Notes
Runtime verification remains pending on the stack tips. The provider transport is opt-in; the extension integration follows in later levels.
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 #5638browser-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 ← this PRbrowser-task-0787-s7— fix(extension): expose honest browser runner outcomes #5681browser-task-0787-s8— feat(extension): coordinate browser execution across panels #5694browser-task-0787-s9— fix(extension): invalidate ended browser task approvals #5698 (tip)