fixup: 处理 PR #386 review 中尚未覆盖的 4 项

- src/cli/print.ts: cron onFire 改用 createAutonomyQueuedPromptIfNoActiveSource
  并以 prompt 文本作为 sourceId,避免同一定时提示在前一次 run 仍活跃时被重复
  入队叠加;顺手移除 4 个已没人引用的 dead import
  (commitAutonomyQueuedPrompt / prepareAutonomyTurnPrompt /
   markAutonomyRunCancelled / createAutonomyQueuedPrompt)
- src/services/compact/postCompactCleanup.ts: 在 void import().then() 处加
  注释,明确 sweepFileContentCache 是有意的 fire-and-forget,函数对外保持
  同步签名是设计而非疏忽
- src/utils/autonomyFlows.ts: 给 selectPersistedAutonomyFlows 的两阶段排序
  加文档注释(先按 active+updatedAt 选 top-N,再统一按 updatedAt 重排)
- tests/integration/autonomy-lifecycle-user-flow.test.ts: stderr 断言失败时
  把实际 stderr 内容写进 message,方便 CI 失败时定位
This commit is contained in:
Claude
2026-04-29 12:45:02 +00:00
parent f8388e44ed
commit 6b7cfda9b1
4 changed files with 25 additions and 12 deletions

View File

@@ -69,6 +69,12 @@ export function runPostCompactCleanup(querySource?: QuerySource): void {
// cacheUtils resets. See compactConversation() for full rationale.
clearBetaTracingState()
if (feature('COMMIT_ATTRIBUTION')) {
// Intentionally fire-and-forget: the file-content cache sweep is a
// best-effort memory release whose completion no caller depends on.
// Keeping `runPostCompactCleanup` synchronous lets compaction call sites
// (REPL post-compact handler, /compact command, autoCompact) finish their
// own state transitions without an extra microtask round-trip — the sweep
// catches up on the next event-loop tick.
void import('../../utils/attributionHooks.js').then(m =>
m.sweepFileContentCache(),
)