feat(feedback): scoped RCP receipt feedback + minimal context router - #24
Merged
Conversation
Close the first half of the convergence design (docs/design/agent-convergence-feedback-design.md) without claiming the overall task complete: a validated RCP receipt becomes a bounded temporary tool observation in an explicitly named session/task frame, and a 132-parameter action-value primitive exists behind the autodiff substrate. The design task stays open: unified event/sample collection, versioned feature semantics, the four executor interfaces, validated outcome admission, and all default-activation gates are still unimplemented. These tests prove only their exercised mechanisms, not natural task success or intervention benefit. Why this shape: - Reconcile drift events never reached session AG. Add explicit opt-in delivery through a new resident-only `nmg session observe` CLI (RCP never imports NMG internals or starts/stops its daemon; a bounded child bounds outages). - Failed scope/check receipts used to be unrejectable yet unfedback. Receipt validity (structure/hash) and success (verified + scope matched) are now separated so real failures stay append-only and visible while forged success stays rejected. - No neural experts or pretrained router transplant. The ContextRouter is an isolated observed-action value head: allowed-action gating, real epsilon sampling with propensity, detached weights, and analytic-gradients coverage in both interpreted and compiled autodiff. Evidence (run with embedding env removed; Windows EPERM temp-dir flakes and inherited NMG_EMBED_* were reproduced independently of this change): - 50 targeted tests pass across tests/rcp, tests/cli/session-observe, tests/core/context-router, including real failing npm verification into AG, HTTP delivery, duplicate projection, session isolation, scope-failure feedback, bounded diagnostics, and compiled finite-difference gradients. - verify:static, build, docs:check and complexity:gate pass.
Add a short duration hint so a submitter observes via forge-status once the checks finish (~90s) instead of polling on a fixed schedule.
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.
变更描述
What(改了什么):
实现 agent-convergence-feedback-design 的第一段可验证代码闭环:把 RCP 的已验证收据通过新的、仅连接既有 daemon 的
nmg session observe命令投递到指定会话/任务帧的临时 AG;同时提供隔离的 132 参数 ContextRouter 数值原语。Why(为什么改 / 解决什么问题):
设计缺口 #1「单一事件总线不存在」的具体前半段——reconcile 结果此前无法回流到会话 AG。本 PR 让真实失败能成为有界、可归属的工作记忆反馈;并把「仅路由、无神经专家」的候选做成可在 autodiff 上受训的数值起点。不把文档合并当作整体完成:事件/样本管线、特征语义、四执行器、结果接纳与默认激活门仍全部未实现。
Changes(关键改动点,按文件或模块列出):
src/rcp/session-feedback.ts(新):收据→有界 tool_observation,绑定 receipt/contract/session/task 身份,越界失败收据仍可反馈但不可伪造成成功,诊断内容裁剪到预算内。src/rcp/cli/main.ts:reconcile ... --nmg optional --session-id <id> --task-frame-id <id>显式选用会话反馈;经随包bin/nmg.mjs session observe通讯,不导入 NMG 内部、不启停 daemon。src/cli/{commands,main}.ts:新增nmg session observe命令,仅要求已运行兼容 daemon,缺失时失败关闭而不落库。src/rcp/receipt.ts:区分「收据有效」与「任务通过」;scope 越界只否决 verified 而非使收据无效。src/lab/context-router.ts(新):32→4 线性 132 参数 action-value 原语,允许动作门控、真实 ε 采样、实测动作回归、权重导出。completion-audit.md明确标记 partial,不关闭工单 10)。完成检查项
本地质量检查
npm run verify:static通过(build / package:check / check / check:lock / lint / format:check / docs:check / agent:context:check / complexity:gate / verify:packages)test:product通过:tests/rcp、session-observe、commands、http-boundary、context-router、agent-verify、complexity-gate(50 项;隔离 embedding 环境变量)RCP
repo-development黑板登记 in-flight goal(1788586790890_000024),工单 10 已 claimnpm run agent:verify -- <改动路径>:build/docs:check/verify:static/check/package:check 通过;test:product 仅剩与本改动无关的 Windows EPERM 临时目录清理抖动(archive-staging,独立复现与本改动无关)CI 完成确认
All checks passed与全部 job 均为 SUCCESS