Archived
fix(memory): 配方留痕恢复 internal,工作日志按 detail.auto 另开例外
`internal` 是 `machinery()`(工作日志)与 `chat-projection`(对话区)**共用的一个旗**。 上一轮为了让配方留痕进工作日志,把 project / analyze 那两笔的 `internal` 整个去掉了 —— 等于同时对两个投影开门:「芯片主数据:写下 2 行」「已把 8 条参数交给模型逐条判定」 这类机械痕一笔一个气泡跑进了对话区,而这个仓花了很大代价立起 「对话区一轮一句,不是一拍一句」「引擎内部观察进日志不进对话」。 治法与 `detail.say` 同款(控制端裁定 F2):配方那几笔照旧标 `internal`(对话区据此挡住), `machinery()` 这一侧给 `typeof detail.auto === 'string'` 开一道例外 —— **两件事各有各的开关**。`say` 与「办不下去」那两笔本来就该进对话区,保持不标 internal。 既有那几条「留痕真的走到工作日志」的用例全绿(它们现在喂的正是 internal:true 的形状, 恰好验这条新例外);另补 8 条:auto-runner 侧断言四类痕各自标不标 internal、 chat-projection 侧断言机械痕一个气泡不冒 / say 与失败照进、 task-log 侧断言例外只认结构化的 auto 键(不是字符串就不算)。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
@@ -425,16 +425,17 @@ describe('card 与 submit', () => {
|
||||
* (没被 `SKELETON` / `machinery()` 滤掉)且 `who` 是 `system`。
|
||||
*/
|
||||
describe('配方留痕真的到得了工作日志(spec §5.9 验收 · R10)', () => {
|
||||
it('say 那一笔:进日志且归系统', async () => {
|
||||
it('say 那一笔:进日志且归系统,**不标 internal**(它是人话,该进对话区)', async () => {
|
||||
const { runner, appended, ctx } = harness({ n: 2 });
|
||||
await runner.run({ do: [{ kind: 'say', text: { cat: ['已核对 ', { in: 'n' }, ' 颗料'] } }] }, ctx);
|
||||
expect(appended).toHaveLength(1);
|
||||
const lines = structuredLog([asLogEntry(appended[0]!)]);
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(lines[0]?.who).toBe('system');
|
||||
expect(appended[0]?.detail?.['internal']).toBeUndefined();
|
||||
});
|
||||
|
||||
it('project 那一笔:进日志且归系统', async () => {
|
||||
it('project 那一笔:进日志且归系统,**而且标着 internal(对话区那一侧据此挡住)**', async () => {
|
||||
const { runner, appended, ctx } = harness({});
|
||||
await runner.run(
|
||||
{ do: [{ kind: 'project', into: 'sub_eval.part', from: { once: true }, fields: { eval_ref: 'a', internal_pn: 'b', role: 'original' } }] },
|
||||
@@ -444,6 +445,13 @@ describe('配方留痕真的到得了工作日志(spec §5.9 验收 · R10)', ()
|
||||
const lines = structuredLog([asLogEntry(appended[0]!)]);
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(lines[0]?.who).toBe('system');
|
||||
/*
|
||||
* **两件事各有各的开关**(2026-08-29 终审 I5):`internal` 同时是对话区的开关 ——
|
||||
* 去掉它,这类机械痕会一笔一个气泡跑进对话区(见 `chat-projection.test.ts` 对应那条)。
|
||||
* 进不进工作日志由 `machinery()` 对 `detail.auto` 开的例外说了算,上面那一行已经验了。
|
||||
*/
|
||||
expect(appended[0]?.detail?.['internal']).toBe(true);
|
||||
expect(appended[0]?.detail?.['auto']).toBe('S1#1');
|
||||
});
|
||||
|
||||
it('analyze 那一笔:进日志且归系统', async () => {
|
||||
@@ -470,15 +478,17 @@ describe('配方留痕真的到得了工作日志(spec §5.9 验收 · R10)', ()
|
||||
const lines = structuredLog([asLogEntry(appended[0]!)]);
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(lines[0]?.who).toBe('system');
|
||||
expect(appended[0]?.detail?.['internal']).toBe(true);
|
||||
});
|
||||
|
||||
it('出错兜底那一笔:进日志且归系统', async () => {
|
||||
it('出错兜底那一笔:进日志且归系统,**不标 internal**(交人的话得让人看见)', async () => {
|
||||
const { runner, appended, ctx } = harness({});
|
||||
await runner.run({ do: [{ kind: 'project', into: 'nope.nope', from: { once: true }, fields: { a: 'b' } }] }, ctx);
|
||||
expect(appended).toHaveLength(1);
|
||||
const lines = structuredLog([asLogEntry(appended[0]!)]);
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(lines[0]?.who).toBe('system');
|
||||
expect(appended[0]?.detail?.['internal']).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -157,9 +157,12 @@ export function createAutoRunner(deps: AutoRunnerDeps): {
|
||||
}
|
||||
if (localWrote > 0 || localDropped > 0 || localExisting > 0) {
|
||||
/*
|
||||
* **kind: 'observation'、不再标 internal**(2026-08-29,R10)—— 从前 `kind: 'result'`
|
||||
* 连骨架都进不了;就算 kind 改对,`internal: true` 也会被 `machinery()` 挡下。
|
||||
* 这一笔是「系统做了什么」,恰是人回看时最想看的东西,不该当排障内部痕藏起来。
|
||||
* **kind: 'observation' + `internal: true`**(2026-08-29 终审 I5,控制端裁定 F2)。
|
||||
* `kind` 必须是 `observation`:`result` 不在 `task-log.ts` 的 `SKELETON` 里,进不了工作日志(R10)。
|
||||
* `internal` 必须留着:它是**对话区**那一侧的开关 —— 去掉之后这类机械痕
|
||||
* (「芯片主数据:写下 2 行」)会一笔一个气泡跑进对话区,而对话区的口径是
|
||||
* 「一轮一句,不是一拍一句」。工作日志那一侧由 `machinery()` 对 `detail.auto`
|
||||
* 开的例外放行(与 `detail.say` 同款)——**两件事各有各的开关**。
|
||||
*/
|
||||
await deps.memory.append({
|
||||
taskId: context.taskId,
|
||||
@@ -168,7 +171,7 @@ export function createAutoRunner(deps: AutoRunnerDeps): {
|
||||
`${decl.label}:写下 ${localWrote} 行` +
|
||||
(localExisting === 0 ? '' : `,${localExisting} 行已在库、这一笔不用建`) +
|
||||
(localDropped === 0 ? '' : `,撤掉 ${localDropped} 行`),
|
||||
detail: { auto: `${context.stepId}#${index + 1}`, ledger: action.into },
|
||||
detail: { auto: `${context.stepId}#${index + 1}`, ledger: action.into, internal: true },
|
||||
});
|
||||
}
|
||||
return { wrote: localWrote, dropped: localDropped };
|
||||
@@ -193,12 +196,12 @@ export function createAutoRunner(deps: AutoRunnerDeps): {
|
||||
/* `into` 既是出参里那个数组字段的名字,也是拍内作用域的键 —— 一处声明,两处认 */
|
||||
const rows = object[action.into];
|
||||
results[`result:${action.into}`] = Array.isArray(rows) ? rows : [];
|
||||
/* kind: 'observation'、不再标 internal —— 理由同上(project 分支那条注释) */
|
||||
/* kind: 'observation' + internal —— 理由同上(project 分支那条注释) */
|
||||
await deps.memory.append({
|
||||
taskId: context.taskId,
|
||||
kind: 'observation',
|
||||
title: `已把 ${payload.length} 条参数交给模型逐条判定,拿回 ${results[`result:${action.into}`]?.length ?? 0} 条结论`,
|
||||
detail: { auto: `${context.stepId}#${index + 1}`, model: action.model },
|
||||
detail: { auto: `${context.stepId}#${index + 1}`, model: action.model, internal: true },
|
||||
});
|
||||
/* 出参只活在拍内作用域里,不进草稿层 —— 下一笔要能看见它,所以这里也算「脏」 */
|
||||
scope = { ...scope, ...results };
|
||||
@@ -296,7 +299,10 @@ export function createAutoRunner(deps: AutoRunnerDeps): {
|
||||
if (done.stop) break;
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
/* kind: 'observation'、去掉那个恒为 false 的 internal 键 —— 理由同上 */
|
||||
/*
|
||||
* **失败这一笔不标 internal** —— 它是说给人听的(「交给你处理」),
|
||||
* 该出现在对话区。`say` 同理(它本来就是人话)。(2026-08-29 终审 I5)
|
||||
*/
|
||||
await deps.memory.append({
|
||||
taskId: ctx.taskId,
|
||||
kind: 'observation',
|
||||
|
||||
Reference in New Issue
Block a user