feat(agent): mid-run guidance injection for background sub-agents - #7912
Open
bfxh wants to merge 3 commits into
Open
feat(agent): mid-run guidance injection for background sub-agents#7912bfxh wants to merge 3 commits into
bfxh wants to merge 3 commits into
Conversation
…b-agents + MCP boundary doc Phase 1 - design (docs/AGENT_ARCHITECTURE.md): subagent concurrency + guidance-injection architecture (auto-forward chain, concurrency safety, fallback, persistence), MCP responsibility boundary rules (external capabilities -> MCP, kernel logic -> built-in), risks & verification. Phase 2 - implementation (zcode-style: main conversation keeps working while a sub-agent runs, and marked user input is forwarded into the running sub-agent's next turn): - jobs: Job.steer callback (mu-guarded) + SetSteer + Manager.SteerJob (running-checked, session-scoped) + cleared on completion + JobFromContext; - agent: Options.OnAgentCreated hook invoked with the child Agent so background task/fleet jobs wire job.SetSteer(sub.Steer) (wireSubagentSteer); consumeSteer already persists injected guidance into the child session (run_loop user message); - agent/steer_forward.go: SteerForwarder — conservative auto-forward (explicit markers → / 注入: / inject: / 告诉子智能体 …; target = newest running task job; marker stripped; fallback to normal turn on any failure); - control: runOrchestratedTurn forwards marked non-synthetic user input to a running sub-agent (Notice emitted, no main turn) — CLI/desktop both ride it. Phase 3 - boundary codification: reasonix.example.toml plugins section gains the MCP-vs-builtin responsibility comment; docs/TOOL_CONTRACT.md gains the Capability Boundary section. No code migration needed (current surface already follows external-MCP / kernel-builtin). Tests: jobs steer_test (5, -race), agent steer_forward_test (6, -race) + steer_persist_test (2); agent/control/jobs full suites green; go build ./... clean; full repo 107 ok (3 known Windows-env failures unrelated).
bfxh
pushed a commit
to bfxh/DeepSeek-Reasonix
that referenced
this pull request
Aug 8, 2026
- §8 优化面补全(不止缓存):状态建模/上下文组装/流程建模/可观测性/记忆/审批安全 六面,逐项标注对接 PR(esengine#7911 flywheel-toolcache / esengine#7912 subagent-steer / esengine#7791 OSWorld) - §9 重复建模场景细分(R1-R6):任务模板复用/同目标重试/增量修改/跨会话同构/ 表面相似/全新——逐类判定是否值得语义缓存 + 细分判定流程 + 度量标准 (只统计 R1/R3 命中,误判率>5% 收紧阈值,防刷命中率)
…on guard for esengine#7912 PR esengine#7912 (mid-turn steer guidance) appends steer as a fresh user message; it must never splice into history or the prompt-cache prefix breaks. Add TestCacheHitSteerPreservesPrefix: drives a 7-request run with a mid-turn steer injected in a 150ms window and asserts every request's cached prefix equals the ENTIRE prior request (hitChars[i]==reqChars[i-1]). mockDeepSeek gains a mutex + per-request delay so the injection window is real and the test is race-clean (-race passes).
bfxh
pushed a commit
to bfxh/DeepSeek-Reasonix
that referenced
this pull request
Aug 8, 2026
…on guard for esengine#7912 PR esengine#7912 (mid-turn steer guidance) appends steer as a fresh user message; it must never splice into history or the prompt-cache prefix breaks. Add TestCacheHitSteerPreservesPrefix: drives a 7-request run with a mid-turn steer injected in a 150ms window and asserts every request's cached prefix equals the ENTIRE prior request (hitChars[i]==reqChars[i-1]). mockDeepSeek gains a mutex + per-request delay so the injection window is real and the test is race-clean (-race passes).
bfxh
pushed a commit
to bfxh/DeepSeek-Reasonix
that referenced
this pull request
Aug 8, 2026
…OSWorld core esengine#7791 boundary cleanup (step 3): remove the two cleanly-separable domains (cosplay: 15 files — decided to drop; desktop/frontend: 5 PR esengine#7910 files). boot/agent already decoupled from cosplay via cosplayhook (5675a52), so the stripped branch compiles; golden re-recorded, code_verify removed from the boot contract, eventwire skips when frontend is absent. flywheel/modeling/ steer stay as agent infrastructure (same code as esengine#7911/esengine#7967/esengine#7912, PR value is separate review not physical separation).
bfxh
pushed a commit
to bfxh/DeepSeek-Reasonix
that referenced
this pull request
Aug 8, 2026
…OSWorld core Merged latest upstream (a720a3a) + main dev line, then removed the two cleanly-separable domains: cosplay (15 files, decided to drop) and desktop/frontend (5 PR esengine#7910 files). boot/agent already decoupled from cosplay via cosplayhook, so the stripped tree compiles; golden re-recorded, code_verify removed from the boot contract, eventwire skips when frontend is absent. flywheel/modeling/steer remain as agent infrastructure (same code as esengine#7911/esengine#7967/esengine#7912 — separate review, not physical separation).
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.
Summary
zcode 式引导注入:主对话可向运行中的后台子智能体注入引导(mid-run guidance),
子智能体继续工作时主对话不被阻塞。
internal/jobs):Job.Steer+Manager.SteerJob(running 校验、完成置 nil、session 作用域);ctx 携带 job;
OnAgentCreated钩子 +wireSubagentSteerinternal/agent/steer_forward.go):→/注入:/inject:标记→ 路由到最近 running task job;失败回退普通 turn(保守,不误吞)
internal/control):非 synthetic 输入命中标记才转发,转发成功发 Notice 且不发起主 turn
consumeSteer进子智能体会话docs/AGENT_ARCHITECTURE.md:子智能体并发引导注入架构 + MCP 职责边界规则表Verification
Notes
CI Declarations
Cache-impact: low - 引导注入走独立 steer 通道(jobs/steer_forward),不改变主对话 system prompt 前缀结构
Cache-guard: internal/agent/steer_forward_test.go + steer_persist_test.go + 既有 cachehit e2e 前缀稳定测试
System-prompt-review: 主对话前缀不变,注入消息作为独立用户消息附加(不破坏前缀字节稳定性)
Documentation-impact: updated - docs/AGENT_ARCHITECTURE.md(引导注入章节)+ docs/TOOL_CONTRACT.md