Skip to content

feat(assistant): add scheduled read-only discovery to Rust Bot - #6724

Open
sunrioa wants to merge 23 commits into
apache:rust-previewfrom
sunrioa:codex/feat-rust-discovery-loop
Open

sunrioa wants to merge 23 commits into
apache:rust-previewfrom
sunrioa:codex/feat-rust-discovery-loop

Conversation

@sunrioa

@sunrioa sunrioa commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Refs #6716.

The Rust Bot can arrange scheduled tasks, but scheduled investigations do not yet have a dedicated way to finish quietly or hand recorded findings back to the Bot.

Add a discovery effect to the existing Scheduler. Each fire creates a fresh read-only worker Session. The worker calls DiscoveryComplete to record either no_report or report and end its Turn. A no_report outcome settles without waking the Bot; a report enters the existing notification path, where the Bot decides whether to notify the user.

  • Reuse once/interval/cron schedules and manual triggers. Model-created schedules remain paused proposals requiring human approval; discovery is opt-in.
  • Use read-only workspace permissions without permission requests, with a restricted catalog of file-reading/search tools, enabled built-in Recall tools and DiscoveryComplete.
  • Keep one investigation slot and persist the original fire, execution and result identities in the existing scheduler KV namespace. Track the investigation Turn independently of later user work in the same Session, including across restart and sealed Host handoff.
  • Preserve cancellation when a plan is immediately resumed or the service is disabled and re-enabled. Recheck the captured source permissions at report admission; resuming a plan does not revive its cancelled fire.
  • Update the generated SDK contracts and the native plugin's English/Chinese documentation.

Targets rust-preview. This is the initial manual/timed investigation and result-settlement slice of A1/A3 in #6716. Source-change intake, shared memory and feedback linkage remain follow-up work.

Verification

Local macOS verification for 96d87444c0dde0c1b4062da813df44645c562eeb, using Rust 1.98.0 and Node 26.13.0 for SDK checks.

Check Result
Agent Native, Agent API and Scheduler library suites 394 passed, 0 failed; four existing manual/opt-in tests skipped
Discovery and result-boundary coverage, included above 17 passed
Before/after regression controls Six lifecycle/authorization cases failed before the fixes and passed afterward
Rust compilation, SDK schema consistency and SDK/product TypeScript checks Passed
Rust formatting, staged Biome, ASF headers and whitespace checks Passed
Dependency-license policy and generated inventory (cargo-deny 0.20.2) Passed
Clippy Three existing warnings in unchanged upstream files; strict -D warnings is not green

Integration tests use local model fixtures and the real Host. Coverage includes approved-plan resume, Bot/scheduler disablement, pause/resume cancellation, permission changes before report admission, later ordinary worker Turns, restricted tool selection, uncertain result writes, restart and handoff.

No production code changed after this full-suite run. Full repository CI, Windows validation, desktop packaging and live-provider evaluation were not run locally.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex assisted with investigation, implementation, tests, local verification and this description. The implementation commit includes a Generated-by: OpenAI Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
简体中文

概述

关联 #6716。

Rust Bot 已经能够安排定时任务,但定时调查还缺少一条明确支持静默结束和将已记录发现交回 Bot 的路径。

在现有 Scheduler 中增加 discovery 效果。每次触发新建一个只读 worker Session。worker 调用 DiscoveryComplete,记录 no_report 或 report 并结束本轮。没有值得报告的发现时静默结算,不唤醒 Bot;有报告时通过现有通知路径交给 Bot,由 Bot 判断是否通知用户。

  • 复用 once/interval/cron 计划和手动触发。模型创建的计划仍是需要用户批准的暂停提议,主动发现默认不启用。
  • 使用只读工作区权限,禁止申请额外权限;工具目录收敛为文件读取与搜索、已启用的内置 Recall 和 DiscoveryComplete。
  • 保留一个调查位,在现有调度器 KV 命名空间中持久保存原触发、执行和结果身份。独立跟踪调查 Turn,不受同一 Session 中后续用户工作的影响,并处理重启及已封存的 Host 交接。
  • 立即恢复计划,或停用后重新启用服务,都不会撤销已记录的取消。报告实际接纳前重新检查原来源权限;恢复计划不会复活已取消的那次触发。
  • 同步更新生成的 SDK 契约,以及原生插件的中英文文档。

目标分支为 rust-preview。这是 #6716 中 A1/A3 的首个手动/定时调查与结果结算切片。来源变化事件接入、共享记忆和反馈关联留在后续阶段。

验证

本地 macOS 验证对应 96d87444c0dde0c1b4062da813df44645c562eeb,使用 Rust 1.98.0,SDK 检查使用 Node 26.13.0。

检查 结果
Agent Native、Agent API 和 Scheduler 库套件 394 项通过、0 项失败;四项既有手工/需显式启用的测试跳过
上述套件中的调查与结果边界覆盖 17 项通过
修复前后对照 六个生命周期/授权回归场景在修复前失败,修复后通过
Rust 编译、SDK Schema 一致性、SDK/产品 TypeScript 检查 通过
Rust 格式、暂存区 Biome、ASF 文件头及空白检查 通过
依赖许可证策略与生成清单(cargo-deny 0.20.2) 通过
Clippy 未修改的上游文件仍有三条既有告警,严格 -D warnings 检查尚未通过

集成测试使用本地模型夹具和真实 Host,覆盖已批准计划的恢复、Bot/调度停用、暂停后恢复的取消语义、报告接纳前权限变化、worker 后续普通 Turn、受限工具选择、结果写入不确定、重启及交接。

全量套件运行后没有修改生产代码。本地未执行完整仓库 CI、Windows 验证、桌面打包或真实供应商评估。

AI 使用说明

OpenAI Codex 协助完成调查、实现、测试、本地验证及本说明起草。实现提交包含 Generated-by: OpenAI Codex 标记。

检查清单

已确认六个回归场景在修复前失败、修复后通过,最终格式、类型检查及受影响套件均已通过。本 PR 存在行为变化,已在概述中说明。

Add opt-in discovery schedules using fresh read-only worker Sessions and
explicit report or no_report settlement through the existing Bot path.
Preserve original execution identities across restart and Host handoff.

Refs: apache#6716
Generated-by: OpenAI Codex
Keep cancellation durable across resume and service disablement, and
settle only the original investigation Turn. Recheck report authority
at admission and restrict Recall to the enabled built-in implementation.
Preserve uncertain result writes and allow approved inactive plans to resume.

Generated-by: OpenAI Codex
Integrate the durable Agent execution API, retain the A1 read-only investigation scope, and retract revoked pending reports before recovery consumers start. Port behavior coverage to the current real Host harness.

Generated-by: OpenAI Codex
Include the latest upstream UI changes and regenerate the dependency inventory after the upstream native graph changes.

Generated-by: OpenAI Codex
Finish each simulated model step before awaiting steering. Verify that Stop targets the current Run while an accepted followup executes once and the next draft stays intact. Keep the existing input, queue, and timeout checks.

Generated-by: OpenAI Codex
Sync current rust-preview while retaining the recovered-report authorization boundary. Box the new legacy-compaction projection at its entrypoint to bound the debug poll stack, and keep the notification recovery fixture pinned to its original busy Run.

Generated-by: OpenAI Codex
Acquire the existing child handle before the five-second pipe-drain wait. This separates PowerShell fixture startup from drain timing and preserves cleanup when the wait fails; production process behavior and the drain bound are unchanged.

Generated-by: OpenAI Codex
The queue consumer uses try_lock for Goal admission, so an enqueue wake can be consumed while the producer still owns the gate. Notify after releasing it when the persisted schedule still has ready work; keep the existing authorization and ordering checks.

Generated-by: OpenAI Codex
Withdraw independent engine, Goal, Bot admission, inventory and platform-test repairs. Keep discovery recovery and authorization coverage, and narrow fixture cleanup to report delivery.

Generated-by: OpenAI Codex
Retain both discovery and upstream recovery endpoints in the model test fixture.

Generated-by: OpenAI Codex
Keep discovery target checks and upstream completion placement during background admission. Retain the Bot controls and discovery regression fixtures.

Generated-by: OpenAI Codex
Sync rust-preview and keep Bot worker notifications out of the interactive Stop cut. The recovery fixture finishes its independent worker turn before restarting the Host so the original report is still verified exactly once.

Generated-by: OpenAI Codex
Read the investigation plan directly in restore and tool admission, and fold ordinary Session tool visibility into the existing approval test.

Generated-by: OpenAI Codex
Continue accepting the old receipt shape while avoiding a second durable copy of the worker report.

Generated-by: OpenAI Codex
sunrioa

This comment was marked as off-topic.

@sunrioa
sunrioa marked this pull request as ready for review November 12, 2026 10:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant