feat(core): GenAI for Beginners 课程借鉴 P1 九项落地(独立于 #181) - #183
feat(core): GenAI for Beginners 课程借鉴 P1 九项落地(独立于 #181)#183raymondginger2018-sudo wants to merge 13 commits into
Conversation
P1 (PR HKUDS#183) 之上的 P2 候选 9 项,全部纯机制、独立模块: - A6 工具调用轨迹 trace 链: core/observability/trace.py (TraceSpan/TraceChain, 推理片段+参数+结果可查询, JSONL) - A7 工具语义发现: core/agent_runtime/tools/semantic_hint.py (未命中工具名给语义候选, 接入 registry not-found) - C4 few-shot 工具说明: EditTool description 加输入到调用到输出示例 (lesson 04 show-and-tell) - D3 记忆来源元数据: memory_retrieval.compose_memory_injection 带 created_at 时间戳可溯源 (lesson 08/14) - E2 groundedness 抽查: core/loop/groundedness.py (答案句子 vs 证据 token 覆盖, 可选 LLM-as-judge) - E3 MCP 供应链审计: core/mcp/audit.py (server 声明清单 + 风险清单 + allowlist 状态) - E4 LLMOps 指标聚合: core/observability/llmops.py (Quality/Harm/Honesty/Cost/Latency 五维) - F1 SLM 路由: core/loop/slm_routing.py (按子任务类别 SLM/LLM, env DEEPCODE_SLM_MODEL) - A9 顺序链 builder: core/loop/sequential_builder.py (SequentialChain + 前序结果占位符传递) 新增 59 项测试 (9 个新测试文件); P1+P2 合计 110 测试全绿; 对 upstream 0 新失败 (基线 12 个 Windows 环境失败 pre-existing)。
更新:P2 候选 9 项已追加到本 PR在 P1 之上追加 P2 候选落地(commit
P1+P2 合计 110 项测试全绿(17 个测试文件);对 upstream 0 个新失败(基线 12 个 Windows 环境失败 pre-existing)。 |
|
感谢 PR,课程要点提炼得很扎实。已在最新 main(合并后)上试合验证:无冲突,全量 1585 passed,ruff 通过。 特别确认了 P1-4 的温度改动 —— 一个需要确认的点:P1-5 的实现调用了 另外本 PR 同时包含系统提示词、记忆注入、MCP 白名单等多处核心行为改动(34 文件)。如果能把「新增的独立模块」与「修改既有行为的部分」拆开,评审会顺畅很多,风险也更容易逐项评估。 |
The P1-5 deposit event imports core.observability.events (introduced by HKUDS#181). Previously an ImportError was swallowed silently by the blanket except; per maintainer review, make the fallback explicit so the event is intentionally skipped until the observability bus lands, regardless of merge order (HKUDS#183 vs HKUDS#181).
|
Thanks for the detailed review! Both points addressed:
|
|
Hi Zongwei,
Thanks for the detailed review! Both points addressed:
1. P1-5 dependency - added an explicit no-op fallback: the
core.observability.events import now falls back to emit_event = None (with
a comment noting the bus lands with #181), so the deposit event is
intentionally skipped until the bus exists. Safe regardless of merge order,
and the intent is explicit instead of a silent blanket except.
2. Structure - agreed. The sibling #181 has been split into three
independent PRs per your suggestion (#188 keyring / #189 classifier / #190
loop+observability+memory suite), each based on current upstream main. #183
itself stays focused on the P1-4/P1-5 landing.
Thanks!
Zongwei Li ***@***.***> 于2026年8月17日周一 18:44写道:
… *Zongwei9888* left a comment (HKUDS/DeepCode#183)
<#183 (comment)>
感谢 PR,课程要点提炼得很扎实。已在最新 main(合并后)上试合验证:无冲突,全量 1585 passed,ruff 通过。
特别确认了 P1-4 的温度改动 —— _DEFAULT_TOOL_LOOP_TEMPERATURE 只在 execution profile
未设置温度时兜底,用户显式配置仍然优先,这个优先级是对的。
一个需要确认的点:P1-5 的实现调用了 core.observability.events.emit_event,而该模块由 #181
<#181> 引入。虽然用 try/except
包住不会导致失败,但如果本 PR 先于 #181 <#181> 合入,
memory.compaction.deposited 事件会静默不触发。建议二选一:在描述里明确标注依赖 #181
<#181> 先合,或在本 PR 内补一个极小的 no-op 兜底。
另外本 PR 同时包含系统提示词、记忆注入、MCP 白名单等多处核心行为改动(34
文件)。如果能把「新增的独立模块」与「修改既有行为的部分」拆开,评审会顺畅很多,风险也更容易逐项评估。
—
Reply to this email directly, view it on GitHub
<#183?email_source=notifications&email_token=CGK5R7WGXR5ID5BAJJ4456D5KLOZVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGUYDCOBWHA32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5315018687>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CGK5R7WDADLBE3FZIMMNNHD5KLOZVAVCNFSNUABFKJSXA33TNF2G64TZHM4TQMZSGQ3DKNRYHNEXG43VMU5TKMJWGQZDCNJXHEYKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CGK5R7RN7CECQX65BFCES6D5KLOZVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGUYDCOBWHA32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/CGK5R7R5ZBETKTXH7I5ZQRL5KLOZVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGUYDCOBWHA32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
CI status notes + two pushes: 1. Python CI test (3.13) failure — addressed (ec4f05c). 2. Security CI failure — repo-wide, not caused by this PR. Both points from the 08-17 review are already addressed in this branch (explicit no-op fallback for the observability import; #181's modules split into #188/#189/#190 so this PR stays focused on the P1 landing). |
依据 microsoft/generative-ai-for-beginners 22 课学习报告落地 P1 九项,全部零依赖、不与已吸收营养重复: - P1-1 anti-fabrication 子句: agent_setup SYSTEM_PROMPT (不编造证据声明) - P1-4 温度 per-task: session 工具循环默认 0.1 (profile 显式优先) - P1-3 记忆数据-指令隔离: memory.py MEMORY.md 经 <untrusted-data> 边界注入 + restrict - P1-8 注入回归集: loop/injection_regression.py (9 样本 x 4 注入面) + 12 测试 - P1-2 description 质量: tools/base.py 校验 + MCP 远端清洗 - P1-6 检索失败三模式: loop/memory_retrieval.py (阈值+回退+链路自检) - P1-7 异源评估: loop/retrieval_evaluation.py (异源留出+余弦打分) - P1-5 压缩即记忆: runner compaction_summary_sink + session 后台线程 + memory compactions.md - P1-9 MCP server 白名单: naming.server_allowed + runtime 注册过滤 新增 79 项测试。独立于 PR HKUDS#181(不修改其新文件)。
P1 (PR HKUDS#183) 之上的 P2 候选 9 项,全部纯机制、独立模块: - A6 工具调用轨迹 trace 链: core/observability/trace.py (TraceSpan/TraceChain, 推理片段+参数+结果可查询, JSONL) - A7 工具语义发现: core/agent_runtime/tools/semantic_hint.py (未命中工具名给语义候选, 接入 registry not-found) - C4 few-shot 工具说明: EditTool description 加输入到调用到输出示例 (lesson 04 show-and-tell) - D3 记忆来源元数据: memory_retrieval.compose_memory_injection 带 created_at 时间戳可溯源 (lesson 08/14) - E2 groundedness 抽查: core/loop/groundedness.py (答案句子 vs 证据 token 覆盖, 可选 LLM-as-judge) - E3 MCP 供应链审计: core/mcp/audit.py (server 声明清单 + 风险清单 + allowlist 状态) - E4 LLMOps 指标聚合: core/observability/llmops.py (Quality/Harm/Honesty/Cost/Latency 五维) - F1 SLM 路由: core/loop/slm_routing.py (按子任务类别 SLM/LLM, env DEEPCODE_SLM_MODEL) - A9 顺序链 builder: core/loop/sequential_builder.py (SequentialChain + 前序结果占位符传递) 新增 59 项测试 (9 个新测试文件); P1+P2 合计 110 测试全绿; 对 upstream 0 新失败 (基线 12 个 Windows 环境失败 pre-existing)。
The P1-5 deposit event imports core.observability.events (introduced by HKUDS#181). Previously an ImportError was swallowed silently by the blanket except; per maintainer review, make the fallback explicit so the event is intentionally skipped until the observability bus lands, regardless of merge order (HKUDS#183 vs HKUDS#181).
Python CI (ubuntu, 3.13 only) hit the documented pre-existing
cross-process WAL corruption with a new SQLite error string:
'database disk image is malformed' on the first event_log read
(2026-08-22 run of this branch; 3.12/3.14 green in the same run).
The test already whitelists this crash class for bounded startup
retries ('disk I/O error', 'FOREIGN KEY constraint failed'); add the
malformed-image variant of the same corruption so a transient hit
retries instead of failing the subject under test.
ec4f05c to
f23c9eb
Compare
…ory index passes framing assertion
|
Hi Zongwei, GenAI for Beginners P1 nine items, rebased onto latest main (e0767d0). All tests green on 3.12/3.13/3.14. The P1-3 data boundary (render_data_block) is now properly wrapped in _frame_instructions so the memory index passes the framing assertion. The lint failure is a pre-existing N999 issue on upstream main. The sibling #181 has been split into #188/#189/#190 per your suggestion. Ready for review. Thanks! |
概述
从微软《Generative AI for Beginners》22 课学习报告中提炼的 P1 九项借鉴落地,全部独立于 PR #181(不修改其新文件,upstream/main 上可直接运行)。
落地清单
core/agent_setup.pySYSTEM_PROMPTcore/agent_runtime/tools/base.py+core/mcp/tools.pycore/harness/memory.py(<untrusted-data>边界)core/events/session.pycore/agent_runtime/runner.py+core/events/session.py+core/harness/memory.pycore/loop/memory_retrieval.py(新)core/loop/retrieval_evaluation.py(新)core/loop/injection_regression.py(新)core/mcp/naming.py+core/mcp/runtime.py设计要点
测试
76 项新测试(7 个测试文件)全部通过;对 upstream 现有测试 0 个新失败(基线 14 个 Windows 环境失败为 pre-existing)。