mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
Squashed merge of: 1. fix/mcp-tsc-errors — 修复上游 MCP 重构后的 tsc 错误和测试失败 2. feat/pipe-mute-disconnect — Pipe IPC 逻辑断开、/lang 命令、mute 状态机 3. feat/stub-recovery-all — 实现全部 stub 恢复 (task 001-012) 4. feat/kairos-activation — KAIROS 激活解除阻塞 + 工具实现 5. codex/openclaw-autonomy-pr — 自治权限系统、运行记录、managed flows Additional: 6. daemon/job 命令层级化重构 (subcommand 架构) 7. 跨平台后台引擎抽象 (detached/tmux engines) 8. 修复 src/ 中 43 个预存在的 TypeScript 类型错误 9. 修复 langfuse isolated test mock 完整性 10. 修复 CodeRabbit 审查的 Critical/Major/Minor 问题 11. remote-control-server logger 抽象 (测试 stderr 静默化) 12. /simplify 审查修复 (代码复用、质量、效率)
3.2 KiB
3.2 KiB
OpenClaw Autonomy Baseline Test Spec
Purpose
This test spec locks the current behavior of the existing trigger and context layers before any formal autonomy-subsystem implementation begins.
At this stage, production code is read-only. Only test files, fixtures, and planning documents may change.
Goal
Establish a stable baseline around the parts of Claude-code-bast that later autonomy work is most likely to touch:
- proactive state handling
- cron task storage semantics
- cron scheduler helper semantics
- user-context cache and
CLAUDE.mdinjection behavior
Out of Scope for This Baseline Round
- New authority behavior (
AGENTS.md/HEARTBEAT.md) - New detached-run ledger behavior
- New flow behavior
- UI redesign
Files Under Baseline Protection
src/proactive/index.tssrc/utils/cronTasks.tssrc/utils/cronScheduler.tssrc/context.ts
Test Files Added In This Round
src/proactive/__tests__/state.baseline.test.tssrc/commands/__tests__/proactive.baseline.test.tssrc/utils/__tests__/cronTasks.baseline.test.tssrc/utils/__tests__/cronScheduler.baseline.test.tssrc/__tests__/context.baseline.test.ts
Baseline Assertions
Proactive state
- Activating proactive mode sets active state and activation source.
- Pausing proactive mode suppresses
shouldTick()and clearsnextTickAt. - Blocking context suppresses
shouldTick()and clearsnextTickAt. - Subscribers are notified on state transitions.
- The
/proactivecommand enables proactive mode and emits the expected hidden reminder. - The
/proactivecommand disables proactive mode on the second invocation.
Cron task storage
- Session-only cron tasks remain in memory only.
- Durable cron tasks are persisted to
.claude/scheduled_tasks.json. - Daemon-style
dir-scoped reads exclude session-only cron tasks. removeCronTasks()withoutdircan remove session-only tasks.removeCronTasks()withdirdoes not mutate session-only task storage.
Cron scheduler helpers
isRecurringTaskAged()preserves current aging semantics.buildMissedTaskNotification()preserves the current AskUserQuestion safety wording.buildMissedTaskNotification()preserves code-fence hardening for prompt bodies that contain backticks.
User context caching
getUserContext()includescurrentDate.getUserContext()includes mockedclaudeMdcontent when memory loading is enabled.CLAUDE_CODE_DISABLE_CLAUDE_MDSsuppressesclaudeMd.setSystemPromptInjection()clears the memoized user-context cache.getSystemContext()reflects the injection after cache invalidation.
Remaining Baseline Gaps
The following areas are intentionally deferred because they require higher-cost harnessing and should still avoid production-code changes:
useScheduledTasks.tshook-level runtime behaviorsrc/cli/print.tsfull headless scheduler loop behavioruseProactive.tshook timer behavior- end-to-end queue interaction between proactive ticks and
SleepTool
Acceptance
This baseline round is complete when:
- The four new test files pass.
- No production source files are modified.
- The tests are stable enough to serve as a pre-implementation guardrail.