Skip to content

Add browser runtime lifecycle protocol#43

Merged
glittercowboy merged 2 commits intomainfrom
codex/browser-runtime-events
May 1, 2026
Merged

Add browser runtime lifecycle protocol#43
glittercowboy merged 2 commits intomainfrom
codex/browser-runtime-events

Conversation

@glittercowboy
Copy link
Copy Markdown
Contributor

@glittercowboy glittercowboy commented May 1, 2026

Summary

  • adds browser runtime readiness fields
  • adds task browser grant context for daemon-side lazy open
  • adds browser tool lifecycle/artifact message types
  • updates envelope decode and message round-trip tests

Verification

  • go test ./...

Dependency

Merge after browser method manifest PR. Tag protocol after merge, then bump daemon and cloud-app relay.

Summary by CodeRabbit

  • New Features

    • Task-scoped browser grant support for finer-grained task access.
    • New browser tool lifecycle and artifact events for improved tracking.
    • Enriched tool result envelope with session/channel binding, error classification, redaction and diagnostic metadata.
    • Expanded browser runtime capability reporting (installation, version, path, cloud methods, Chrome availability).
  • Tests

    • Added round‑trip and forward‑compatibility tests for the new browser protocol messages.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4590c4c3-9e3c-4ecf-a84c-b8add4066e0d

📥 Commits

Reviewing files that changed from the base of the PR and between a58ea26 and 46aa81a.

📒 Files selected for processing (2)
  • PROTOCOL.md
  • messages_test.go
✅ Files skipped from review due to trivial changes (1)
  • PROTOCOL.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • messages_test.go

📝 Walkthrough

Walkthrough

Adds task-scoped browser grant context and browser runtime capability fields; introduces browser tool lifecycle/ artifact messages (browserToolCallStarted, browserToolCallUpdated, browserArtifactCreated), extends browserToolResult with session/channel/redaction/error metadata, and updates envelope unmarshalling to recognize new types.

Changes

Cohort / File(s) Summary
Protocol Definition
PROTOCOL.md
Added browserGrant to task; introduced BrowserGrantContext (grant/project/session/task/channel/machine/expiry); extended hello.capabilities with browserRuntimeInstalled, browserRuntimeVersion, browserRuntimeMinVersion, browserRuntimeMinVersionOk, browserRuntimePath, browserRuntimeErrorCode, browserRuntimeErrorMessage, browserCloudMethodsVersion, browserChromeAvailable; added browserToolCallStarted, browserToolCallUpdated, browserArtifactCreated schemas; expanded browserToolResult description to require redacted safe resultJson and added session/channel/error/redaction/diagnostic fields.
Message Definitions
messages.go
Added BrowserGrantContext struct and Task.BrowserGrant; added BrowserToolCallStarted, BrowserToolCallUpdated, BrowserArtifactCreated structs; reworked BrowserToolResult into an enriched result envelope with identifiers, status, error/recovery/redaction fields and local artifact pointer; extended HelloCapabilities with browser runtime/version/path/error/cloud/chrome fields.
Envelope Handling
envelope.go
Extended payloadForType mapping to handle MsgTypeBrowserToolCallStarted, MsgTypeBrowserToolCallUpdated, and MsgTypeBrowserArtifactCreated, routing them to their concrete payload structs for JSON unmarshalling instead of falling through to unknown-type error.
Tests
messages_test.go
Added round-trip tests covering Task.BrowserGrant, extended HelloCapabilities browser fields, and envelope round-trip tests for browserToolResult, browserToolCallStarted, browserToolCallUpdated, browserArtifactCreated; added compatibility test ensuring forward-tolerance of unknown fields for these browser messages.

Sequence Diagram(s)

sequenceDiagram
  participant Browser as Browser
  participant Daemon as Daemon
  participant Cloud as Cloud
  Browser->>Daemon: Send browserToolCallStarted (method/category/metadata)
  Daemon->>Cloud: Relay browserToolCallStarted
  Browser->>Daemon: Send browserToolCallUpdated (status/summary/metadata)
  Daemon->>Cloud: Relay browserToolCallUpdated
  Browser->>Daemon: Send browserArtifactCreated (artifactId/kind/url/metadata)
  Daemon->>Cloud: Relay browserArtifactCreated
  Browser->>Daemon: Send browserToolResult (resultJson redacted, sessionId, channelId, errorCode, redactionStatus)
  Daemon->>Cloud: Relay browserToolResult
  Note over Daemon,Cloud: hello.capabilities includes browserRuntime* and chrome availability
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A tiny grant hops into each task,
Lifecycle notes in a tidy flask—
Starts and updates, artifacts gleam,
Results redacted for the cloud-bound stream.
🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add browser runtime lifecycle protocol' accurately and specifically describes the main changes: introducing new message types for browser tool-call lifecycle and artifact creation, extending task schema with browser grant context, and adding daemon capability advertisement for browser runtime.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/browser-runtime-events

Review rate limit: 8/10 reviews remaining, refill in 8 minutes and 50 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@messages_test.go`:
- Around line 230-271: Add tests that cover invalid-type rejection and
unknown-field compatibility for the new browser lifecycle messages:
BrowserToolCallStarted, BrowserToolCallUpdated, BrowserArtifactCreated and the
expanded browserToolResult shape (e.g., BrowserToolResult or whichever struct
represents the result). Specifically, add entries to the round-trip test table
for "browserToolCallStarted", "browserToolCallUpdated", "browserArtifactCreated"
and the browserToolResult case, then add parallel negative tests that (1) feed
an invalid "type" value for each message and assert parsing fails, and (2)
include unknown extra fields in the JSON payload for each message and assert the
parser accepts them (compatibility). Reference the existing test helpers and
table-driven test patterns in messages_test.go to mirror how other message types
validate invalid-type and unknown-field behavior.

In `@PROTOCOL.md`:
- Around line 1238-1249: The table has a malformed row with an extra table cell;
ensure every row in the "browserToolResult" table has exactly two columns (Field
and Type). Specifically, fix the "error" row so it only has two cells (e.g., "|
error | string? |") and remove any stray trailing cell/pipe; also if any
explanatory notes (like "Redacted safe result data only.") were placed in a
third cell (e.g., on "resultJson"), move that note into the Type cell after the
type (e.g., "json? — Redacted safe result data only.") so all rows remain
two-column compliant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d00f82e-1ebf-4f0e-a004-d9b738ff68d9

📥 Commits

Reviewing files that changed from the base of the PR and between 1e13e98 and a58ea26.

📒 Files selected for processing (4)
  • PROTOCOL.md
  • envelope.go
  • messages.go
  • messages_test.go

Comment thread messages_test.go
Comment thread PROTOCOL.md
@glittercowboy glittercowboy merged commit e5a44f5 into main May 1, 2026
2 checks passed
@glittercowboy glittercowboy deleted the codex/browser-runtime-events branch May 1, 2026 17:55
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