Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7fb695
feat(hooks): approval_requested boundary at the operator approval gate
claude Nov 8, 2026
2095010
fix(hooks): synchronize approval_requested event with database constr…
gemini-code-assist Nov 9, 2026
e88a2a0
fix(hooks): add approval_requested display label and reconcile failur…
gemini-code-assist Nov 9, 2026
fe082ad
feat(hooks): post_tool_failure event for tool failure notifications
claude Nov 9, 2026
87caea3
fix(web): accept the post_tool_failure event in hook diagnostics
claude Nov 9, 2026
840108f
feat(hooks): turn_end event for per-turn observation
claude Nov 9, 2026
d0e1b91
fix(hooks): reject the deny failure policy for turn_end hooks
claude Nov 9, 2026
c165f1c
fix(store): admit the turn_end event in the hook audit ledger
claude Nov 9, 2026
f6067e5
feat(hooks): post_compaction event for context compression tracking
claude Nov 9, 2026
bbde22b
fix(hooks): reject the deny failure policy for post_compaction hooks
claude Nov 9, 2026
e6bb5dd
fix(web): accept the post_compaction event in hook diagnostics
claude Nov 9, 2026
fcf5518
fix(store): admit the post_compaction event in the hook audit ledger
claude Nov 9, 2026
e36f4d1
feat(browser): authorize internet access independently of full mode
claude Nov 10, 2026
547f4e9
feat(web): add project browser internet switch
claude Nov 10, 2026
792a3d3
fix(web): keep browser selection on the current run
claude Nov 10, 2026
fb29fed
feat(browser): remember independent project internet access
claude Nov 10, 2026
1ee38ca
fix(browser): bind next-run access at successor commit
claude Nov 10, 2026
fce12fb
fix(browser): clear obsolete request approvals on access changes
claude Nov 10, 2026
c43cfbc
docs(browser): document and verify one-click internet access
claude Nov 10, 2026
6e38f8a
test(browser): attach before-after UI and native browser evidence
claude Nov 10, 2026
b14f3d7
test(store): use browser preferences compatible with historical schemas
claude Nov 10, 2026
6493f74
fix(web): show browser view only from application preview
claude Nov 10, 2026
f391c93
test(web): verify browser settings and explicit preview workflow
claude Nov 10, 2026
bb42ac6
fix(browser): decouple CLI startup from Full access and update native…
claude Nov 10, 2026
b007de5
fix(web): show browser frames only after drawing
claude Nov 10, 2026
f0a523a
test(browser): verify saved image through original-image viewer
claude Nov 10, 2026
c410584
fix(browser): preserve live approvals when CLI shares a database
claude Nov 10, 2026
1defdc5
docs(browser): attach corrected chat and explicit preview screenshots
claude Nov 10, 2026
0eca54c
test(desktop): bind recovered browser requests to network selection
claude Nov 10, 2026
30e5f88
fix(browser): materialize inherited network choice for successor runs
claude Nov 10, 2026
1763c88
test(browser): await the opened view's first status response
claude Nov 10, 2026
739dbca
docs(api): describe browser network origin constraints
claude Nov 10, 2026
28518f2
fix(hooks): cap post-occurrence observation output instead of failing…
claude Nov 11, 2026
38aff4e
merge: preserve hook history and add approval observations as schema …
Qiyuanqiii Nov 12, 2026
1693d50
fix(hooks): persist tool failure audits with cumulative schema v226
Qiyuanqiii Nov 12, 2026
b53e227
fix(hooks): scope turn end audits and retain cumulative schema v227
Qiyuanqiii Nov 12, 2026
ddcddfd
merge: preserve hook events and verify compaction observers as schema…
Qiyuanqiii Nov 12, 2026
b9c4854
test(hooks): wire generated compaction observer and inspect its works…
Qiyuanqiii Nov 12, 2026
8a913a9
fix(hooks): retain cumulative cap audits and bound output without dro…
Qiyuanqiii Nov 12, 2026
3e00c4b
test(hooks): exercise cap before scripts and preserve valid historic …
Qiyuanqiii Nov 12, 2026
6719f64
merge: integrate accepted main into approval hooks without dropping f…
Qiyuanqiii Nov 12, 2026
40559d6
merge: carry accepted main and failure policies into tool failure hooks
Qiyuanqiii Nov 12, 2026
2e3d2cc
merge: carry accepted main and failure policies into turn end hooks
Qiyuanqiii Nov 12, 2026
135bf8f
merge: carry accepted main and failure policies into post compaction …
Qiyuanqiii Nov 12, 2026
b05478a
merge: carry accepted main and failure policies into observation cap …
Qiyuanqiii Nov 12, 2026
f01e226
fix(browser): resolve preview conflicts and integrate schema v230
Qiyuanqiii Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/workbenchjourney/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func nextResponse(request modelRequest) (contentBlock, error) {
}
if strings.Contains(history, "JOURNEY_BROWSER_SETUP:") {
if observed("JOURNEY_FILE_PROOF_2026") {
return text(map[string]string{"version": "root_lifecycle.v1", "action": "wait", "message": "JOURNEY_BROWSER_SETUP_READY: 已读取项目文件,等待操作员启用 Full 并检查浏览器。", "reason": "Operator will confirm Full access"})
return text(map[string]string{"version": "root_lifecycle.v1", "action": "wait", "message": "JOURNEY_BROWSER_SETUP_READY: 已读取项目文件,等待操作员确认浏览器访问。", "reason": "Operator will confirm browser access"})
}
return read("README.md")
}
Expand Down
4 changes: 4 additions & 0 deletions docs/adr/0195-agent-browser-site-level-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- References: [issue #491](https://github.com/CWNU-Open-Source-Community/Universal-Code/issues/491) (P1 authorization granularity), ADR 0082 (CDP permission
ceiling), ADR 0083 (restricted loopback runtime), ADR 0103 (Full access start token)

The default interaction is updated by [ADR 0196](0196-independent-browser-network-access.md):
browser networking has an independent switch, and this ADR's origin list is an
optional restricted mode rather than a prerequisite for Ask/Auto browsing.

## Problem

The agent browser requires live Full activation at two layers — authority creation
Expand Down
57 changes: 57 additions & 0 deletions docs/adr/0196-independent-browser-network-access.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ADR 0196: Independent browser network access

- Status: Accepted
- Date: 2026-11-06
- Scope: Agent browser network preferences, runtime admission and desktop controls
- Updates: [ADR 0195](0195-agent-browser-site-level-authorization.md)

## Problem

Ask and Auto browser sessions require an operator-supplied list of exact origins.
A page can need several origins for redirects, images and scripts, so opening an
ordinary website requires configuration that users cannot reasonably predict.
Full access removes that list requirement while also changing unrelated command
and file permissions. The browser needs its own network choice.

## Decision

Settings > Permissions > Browser offers an **Allow internet** switch, available
independently of the task's Ask, Auto or Full approval mode. A collapsed advanced
control optionally restricts access to specified websites. Network settings do
not appear in the conversation. The browser view opens explicitly from App
preview; ordinary conversations do not poll its status or stream its screen.

The host stores three states: `off`, `internet` and `restricted`. Internet mode
permits ordinary HTTP(S) browser destinations, including local development
servers, redirects and cross-origin page resources. It is not a public-IP-only
firewall. Restricted mode retains ADR 0195's exact-origin and destination checks.
Turning access off retains a configured website list so enabling it again does
not silently remove the restriction.

The operator's choice is stored in the local database, with a project preference
for new conversations and a revisioned policy for the current run. Repository
files and model tool arguments do not grant network access. New projects start
with access off. Existing runs with no explicit policy retain their previous
interpretation until the operator changes it.

Changing browser access invalidates the affected browser sessions and pending
browser approvals. It does not change the task's approval mode, filesystem
access or command permissions. Follow-up runs inherit the conversation's policy;
new conversations use the saved project preference.

Network access and effect approval remain separate. Existing upload, download
release, sensitive-action and intercepted HTTP write approvals continue to apply.
An approval for an old browser generation cannot authorize a later request.
Chromium Fetch interception covers HTTP requests; WebSocket handshakes and
messages are outside that interception. This is an existing limitation of both
restricted and unrestricted browser sessions, reproduced on Windows Edge during
this change, and must not be described as covered by HTTP write approval.

## Verification

Focused checks cover project persistence and run inheritance, revision conflicts,
browser-session invalidation, Ask/Auto internet admission, cross-origin reads and
redirects, restricted-site denial, and the existing HTTP request approval flow.
The frontend is exercised against the production API, with screenshots of the
conversation and permission settings before and after the change. The PR records
the exact checks run and platform coverage.
93 changes: 93 additions & 0 deletions docs/adr/0202-approval-requested-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# ADR 0202: Approval-requested hook boundary

- Status: Proposed
- Date: 2026-11-09
- Scope: restricted lifecycle hook events and the operator approval gate
- Updates: the hook boundary contract in docs/extensions.md; complements
ADR 0039 (model plan and approval controls) and ADR 0103 (Full access start
token)
- References: Claude Code `Notification` hook event (fires when Claude needs
permission); the `PermissionRequest` hook is examined and deliberately
narrowed (see Decision 1)

## Problem

The restricted hook runtime fires at tool, run, session, prompt, compaction,
subagent, and checkpoint boundaries — but nothing fires when a Run settles
into an approval gate. With the one-shot exec mode (ADR 0201), an unattended
Run that reaches an approval goes silent: no webhook, no metrics tap, no
operator notification channel. Claude Code fires its `Notification` hook at
exactly this moment.

Two durable settle shapes exist in this runtime, and the boundary covers
both: a turn-level settlement (command/MCP/browser preflight waits, inline
web fetch review) where the Supervisor turn pauses with pending approvals and
the Run may still be `running`, and the durable waiting gate where the Run
row itself is persisted as `RunWaitingApproval` (today the web fetch
authorization transaction). The hook fires whenever the Supervisor turn
settles into the gate, and again on `AgentRunner.Execute` re-entries into a
durably waiting Run.

## Decision (proposed)

1. **Observation-only, whitelist by action.** Only `record`-style hooks may
subscribe; deny, annotate, and narrow are rejected at declaration time,
and the check is written as a whitelist (`Action != ActionRecord` fails)
so any future action type fails closed instead of silently gaining
approval-gate authority. The approval decision stays with the operator:
hooks never auto-deny, never auto-approve, never rewrite a pending human
decision. Claude Code's `PermissionRequest` allow/deny behavior was
examined and deliberately narrowed to observation — pre-tool deny hooks
already cover pre-execution enforcement.
2. **Fires per settlement and per Execute re-entry — no dedup.** The
boundary fires once per Supervisor-turn settlement into the gate (from
the convergence function all three settle paths call) and again on every
`AgentRunner.Execute` re-entry into a durably waiting Run. A polling host
therefore re-notifies per poll: accepted and documented, because the
current `Execute` has a single CLI caller; dedup/debounce is a follow-up
if more hosts appear. Only `AgentRunner.Execute` implements the re-entry
half today — thread-turn refresh, handoff continuation re-entries, drain
loop heads, and session chat rejections do not fire, by design.
3. **Fail closed, stay recoverable (governed by failure_policy).**
Failure policy follows standard hook semantics: when a declared hook
specifies `failure_policy: "deny"`, an audit sink or hook error fails
the settlement closed (propagating the error and halting settlement).
When configured with `failure_policy: "continue"`, audit sink errors
do not block the human approval wait, permitting the turn to settle into
`waiting_approval`. Loader failures (e.g. storage unavailability while
reading declarations) fail closed unconditionally. When a failure halts
settlement, the turn deliberately skips `recordFailure` so the checkpoint
stays in `SupervisorTurnStarted` and `resumePendingToolApproval` can still
resume the exact pending action — fail-closed for the boundary, recoverable
for the Run.
4. **Go-owned bounded payload.** `{run_id, state: "waiting_approval"}`.
Deliberately minimal: no session id, pending approval id, or tool name,
because the pending decision is the operator's input, not model-visible
data. Enriching the payload is a follow-up with its own review.
5. **Identity consistency.** Every trigger site resolves the workspace from
the Run's mission (the durable re-entry fetches the mission explicitly),
so audit rows filter consistently by workspace.

## Alternatives considered

- `PermissionRequest`-style auto-deny was rejected (see Decision 1).
- Firing on `RunPaused` Supervisor waits was rejected: a Supervisor wait is a
continuation pause, not an approval gate.
- Deduplicating re-entry notifications was deferred (Decision 2).
- A richer payload was deferred (Decision 4).

## Verification

- `internal/hooks` tests: record accepted, deny/annotate/narrow rejected by
the whitelist, tool filters rejected.
- `internal/application` tests drive a Run into the durable waiting gate via
the inline web fetch approval (Ask mode) and assert the hook fired exactly
once with the run identity, and that a failing loader fails the Execute
re-entry closed.
- Documentation: docs/extensions.md (bilingual) and this ADR.

## Consequences

Operators close the unattended loop: `exec` (ADR 0201) runs a task, this
boundary pages them when a decision is needed, and the audit ledger keeps
the trail. Auto-decision remains impossible by construction.
10 changes: 6 additions & 4 deletions docs/convergence/protocol-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This document is generated from [`protocols/registry.json`](../../protocols/regi
| [agent-browser-supervisor-ledger](#agent-browser-supervisor-ledger) | `internal-durable` | Agent browser, Supervisor tool, and persistence maintainers | 12 | true |
| [agent-scheduling-delivery-ledgers](#agent-scheduling-delivery-ledgers) | `internal-durable` | Agent graph, scheduler, and batch-delivery maintainers | 93 | true |
| [analyzer-interchange](#analyzer-interchange) | `external-durable` | Analyzer contract maintainers | 40 | true |
| [authority-approval-ledgers](#authority-approval-ledgers) | `internal-durable` | Execution authority and approval maintainers | 57 | true |
| [authority-approval-ledgers](#authority-approval-ledgers) | `internal-durable` | Execution authority and approval maintainers | 58 | true |
| [browser-cdp-process-session](#browser-cdp-process-session) | `ephemeral` | Browser runtime maintainers | 26 | false |
| [browser-ui-evidence-ledgers](#browser-ui-evidence-ledgers) | `internal-durable` | Browser and UI evidence maintainers | 44 | true |
| [capability-readiness-projection](#capability-readiness-projection) | `projection` | Application readiness maintainers | 5 | true |
Expand All @@ -27,7 +27,7 @@ This document is generated from [`protocols/registry.json`](../../protocols/regi
| [exported-evidence-and-handoff](#exported-evidence-and-handoff) | `external-durable` | Evidence, verification, report, and handoff maintainers | 35 | true |
| [extension-package-contracts](#extension-package-contracts) | `external-durable` | Skill, Plugin, Hook, and extension maintainers | 48 | true |
| [github-pr-followup-observation](#github-pr-followup-observation) | `projection` | GitHub review and task follow-up maintainers | 1 | false |
| [http-openapi-contract](#http-openapi-contract) | `external-durable` | HTTP/OpenAPI and generated-client maintainers | 147 | true |
| [http-openapi-contract](#http-openapi-contract) | `external-durable` | HTTP/OpenAPI and generated-client maintainers | 148 | true |
| [in-memory-token-session](#in-memory-token-session) | `ephemeral` | Credential and bootstrap maintainers | 1 | false |
| [lsp-process-session](#lsp-process-session) | `ephemeral` | Code intelligence maintainers | 1 | false |
| [mcp-interchange](#mcp-interchange) | `external-durable` | MCP client/server maintainers | 9 | true |
Expand Down Expand Up @@ -298,12 +298,13 @@ This document is generated from [`protocols/registry.json`](../../protocols/regi
- `approval-preference-reader` (`v1, v2`, active) at `internal/domain`
- `computer-use-app-grant-fingerprint-reader` (`v1`, active) at `internal/store/computer_use_app_approval.go`

<details><summary>57 active identifiers</summary>
<details><summary>58 active identifiers</summary>

- `approval_grant_consumption.v1`
- `approval_grant_operation_key.v1`
- `approval_operation_key.v1`
- `approval_record.v1`
- `browser_network_access_operation.v1`
- `computer_use_app_grant.v1`
- `computer_use_app_review.v1`
- `computer_use_app_scope.v1`
Expand Down Expand Up @@ -1023,7 +1024,7 @@ This document is generated from [`protocols/registry.json`](../../protocols/regi
- `pr-followup-http-request-reader` (`v1`, active) at `internal/application/pr_followup.go`
- `pr-followup-http-response-reader` (`v1`, active) at `web/src/api/pr-followup.ts`

<details><summary>147 active identifiers</summary>
<details><summary>148 active identifiers</summary>

- `agent-code-tools.v1`
- `agent_browser_close.v1`
Expand All @@ -1037,6 +1038,7 @@ This document is generated from [`protocols/registry.json`](../../protocols/regi
- `batch-delivery-workbench.v1`
- `batch-delivery.v1`
- `browser_cdp_permission_policy.v1`
- `browser_network_access.v1`
- `browser_network_containment_policy.v2`
- `browser_safe_web_readiness.v1`
- `chatgpt_auth.v1`
Expand Down
6 changes: 6 additions & 0 deletions docs/development-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,11 @@ The complete slice ledger remains in [PROGRESS_BOOK](PROGRESS_BOOK.md), current
| v222 | 保存暂停的浏览器网页请求及审批来源,记录摘要、有效期和发送状态,支持过期与重启清理 | persist paused browser page requests and their approval source, including digests, expiry and dispatch state for expiry and restart cleanup |
| v223 | 重建 hook 审计表以接纳 operator 脚本 hook 动作,绑定触发器以引擎观察值为准 | rebuild the hook audit table to admit the operator script hook action; the binding trigger treats the engine's observed script denial as authoritative |
| v224 | 重建 hook 审计表以接纳 user_prompt_submit 生命周期事件 | rebuild the hook audit table to admit the user_prompt_submit lifecycle event |
| v225 | 重建 hook 审计表以接纳 approval_requested 审批等待事件,保留已有不可变收据和诊断绑定约束 | rebuild the hook audit table to admit the approval_requested lifecycle event while preserving immutable receipts and diagnostic binding guards |
| v226 | 扩展 hook 审计事件以保存 post_tool_failure,保留脚本和已有生命周期审计约束 | admit post_tool_failure audits while preserving script bindings and previous lifecycle events |
| v227 | 重建 hook 审计表以接纳 turn_end 生命周期事件 | rebuild the hook audit table to admit the turn_end lifecycle event |
| v228 | 重建 hook 审计表以接纳 post_compaction 生命周期事件 | rebuild the hook audit table to admit the post_compaction lifecycle event |
| v229 | hook 已发生边界截断过量观测输出,审计保存 output_capped 并保留既有事件和脚本拒绝绑定 | cap post-occurrence hook observations and admit output_capped audits while preserving prior event and script bindings |
| v230 | 保存独立的项目浏览器联网偏好、已结束任务的下次执行选择及不可变操作记录,支持浏览器策略修订与继承 | persist independent project browser network preferences, next-execution selections for terminal Runs and immutable operation records for browser policy revision and inheritance |

</details>
Loading
Loading