mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 22:05:50 +00:00
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:
@@ -321,11 +321,8 @@ import {
|
||||
} from 'src/utils/queryProfiler.js'
|
||||
import { asSessionId } from 'src/types/ids.js'
|
||||
import {
|
||||
commitAutonomyQueuedPrompt,
|
||||
createAutonomyQueuedPrompt,
|
||||
createAutonomyQueuedPromptIfNoActiveSource,
|
||||
createProactiveAutonomyCommands,
|
||||
markAutonomyRunCancelled,
|
||||
markAutonomyRunFailed,
|
||||
} from 'src/utils/autonomyRuns.js'
|
||||
import {
|
||||
@@ -333,7 +330,6 @@ import {
|
||||
claimConsumableQueuedAutonomyCommands,
|
||||
finalizeAutonomyCommandsForTurn,
|
||||
} from 'src/utils/autonomyQueueLifecycle.js'
|
||||
import { prepareAutonomyTurnPrompt } from 'src/utils/autonomyAuthority.js'
|
||||
import { jsonStringify } from '../utils/slowOperations.js'
|
||||
import { skillChangeDetector } from '../utils/skills/skillChangeDetector.js'
|
||||
import { getCommands, clearCommandsCache } from '../commands.js'
|
||||
@@ -2827,17 +2823,22 @@ function runHeadlessStreaming(
|
||||
onFire: prompt => {
|
||||
if (inputClosed) return
|
||||
void (async () => {
|
||||
const prepared = await prepareAutonomyTurnPrompt({
|
||||
// Use the prompt itself as the dedup source: legacy KAIROS-style
|
||||
// cron entries fire the same prompt repeatedly, and without a
|
||||
// dedicated task id the prompt text is what uniquely identifies
|
||||
// the entry. Without source-dedup, repeated fires would stack
|
||||
// additional runs while an earlier one is still active. Match the
|
||||
// onFireTask branch below to keep the two paths consistent.
|
||||
const command = await createAutonomyQueuedPromptIfNoActiveSource({
|
||||
basePrompt: prompt,
|
||||
trigger: 'scheduled-task',
|
||||
currentDir: cwd(),
|
||||
})
|
||||
if (inputClosed) return
|
||||
const command = await commitAutonomyQueuedPrompt({
|
||||
prepared,
|
||||
currentDir: cwd(),
|
||||
sourceId: prompt,
|
||||
sourceLabel: prompt,
|
||||
workload: WORKLOAD_CRON,
|
||||
shouldCreate: () => !inputClosed,
|
||||
})
|
||||
if (!command) return
|
||||
if (inputClosed) {
|
||||
await cancelQueuedAutonomyCommands({ commands: [command] })
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user