Skip to content

plan-07: 连接器动作结果验证 — 执行→验证后置条件→上报契约 (#769) - #504

Merged
Milhouszhang merged 8 commits into
berabuddies:masterfrom
Milhouszhang:plan-07/connector-action-verification
Jul 9, 2026
Merged

plan-07: 连接器动作结果验证 — 执行→验证后置条件→上报契约 (#769)#504
Milhouszhang merged 8 commits into
berabuddies:masterfrom
Milhouszhang:plan-07/connector-action-verification

Conversation

@Milhouszhang

Copy link
Copy Markdown
Collaborator

背景

agentenv/monorepo#769。Gmail/GCal 浏览器连接器的动作没有 post-condition 验证就上报成功,把"发起了动作"当成"动作完成"(虚报成功比失败更危险——上游 Monitor/agent 基于假成功继续推进)。

改动(执行→验证后置条件→上报 三段式)

  • 验证原语:新增 browser_action_verify(诊断化失败信息 + thread-id 归一化)。
  • send_email:验证邮件落 Sent(subject AND recipient)才上报成功(#578)。
  • delete:验证线程落 Trash 才成功(#588)。
  • mark_read:验证未读标记清除(三态 Read/StillUnread/Missing)才成功(#591)。
  • search:query 走服务端 #search 路由、不再当字面关键词过滤(#582)。
  • GCal RSVP:多策略选择器 + 重开事件校验选中态 + 失败带 DOM 快照诊断(#697/#698)。
  • 轮询逻辑合并为共享 poll_gmail_list_until helper。
  • 导航根因修复:gmail_base_url/u/0/ 路径形式——?authuser= query 形式会在账户解析重定向中丢弃 URL hash 片段,导致 #sent/#trash/#inbox/<thread>/#search 视图从未到达。附回归测试。

验证

  • 单测:gmail 48 / gcal 15 / browser_action_verify 2,全绿。
  • 真机只读 E2E(托管浏览器实登账户):list_emails 端到端跑通;搜索/RSVP 验证在真机按"如实失败不虚报"设计生效。

已知 follow-up

  • 搜索结果时序(冷 boot 丢 hash + 结果异步渲染)另立独立 issue 跟踪;本 PR 的搜索路径已保证"倾向如实失败而非虚报成功"。

🤖 Generated with Claude Code

Milhouszhang and others added 8 commits July 9, 2026 09:28
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rify search landed

Fixes agentenv/monorepo#582 (puffer side)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…success

Fixes agentenv/monorepo#578 (puffer side)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ing success

Fixes agentenv/monorepo#588 (puffer side)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…k_read success

Fixes agentenv/monorepo#591 (puffer side)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ilure diagnostics

Fixes agentenv/monorepo#697, agentenv/monorepo#698 (puffer side)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mark_read, delete, and send_email actions each hand-rolled the same
post-condition loop (sleep -> poll -> auth-check -> predicate -> deadline).
Extract a single `poll_gmail_list_until` helper plus `listing_rows` /
`listing_contains_thread`, so each action expresses only its predicate and
result payload. No behavior change to the verification contract.

Also harden two review findings surfaced while consolidating:
- gmail_list_emails asserted the live href contained the percent-encoded
  `#search/<query>` fragment, but Gmail re-normalizes the hash (decoding
  operators like `newer_than:1d`), which would false-fail the very operator
  queries #582 enables. Assert the `#search` route instead.
- Generalize the shared `verification_failure` prefix from the hardcoded
  "Gmail/GCal action" to "Browser action" since it also serves GCal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…gation

The `?authuser=<email>` query form triggered an account-resolution redirect
that dropped the URL hash fragment, so the `#sent` (send), `#trash` (delete),
`#inbox/<thread>` (mark_read / reply), and `#search` (#582) views were never
reached -- Gmail silently landed on the default `#inbox`. Switch
`gmail_base_url` to the `/u/0/` path form, which preserves the fragment.

Search additionally waits for the `#search` route to commit and for the
result rows to settle before trusting them, so a transient stale-inbox scrape
is never reported as search hits (upholds the plan-07 no-false-success
contract). Full search result-timing on cold/warm tabs is tracked separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Milhouszhang
Milhouszhang merged commit e92162c into berabuddies:master Jul 9, 2026
5 checks passed
@Milhouszhang
Milhouszhang deleted the plan-07/connector-action-verification branch July 9, 2026 05:51
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