ben
1ad2cfe629
Merge pull request #51 from cexll/fix/channel-sync-race-conditions
...
fix: 修复channel同步竞态条件和死锁问题
v5.1.2
2025-12-09 00:13:04 +08:00
swe-agent[bot]
7bad716fbc
change codex-wrapper version
2025-12-08 23:45:29 +08:00
swe-agent[bot]
220be6eb5c
fix: 修复channel同步竞态条件和死锁问题
...
修复了4个严重的channel同步问题:
1. **parseCh无条件阻塞** (main.go:894-907)
- 问题:cmd.Wait()先返回但parseJSONStreamWithLog永久阻塞时,主流程卡死
- 修复:引入ctxAwareReader和5秒drainTimer机制,Wait完成后立即关闭stdout
2. **context取消失效** (main.go:894-907)
- 问题:waitCh先完成后不再监听ctx.Done(),取消信号被吞掉
- 修复:改为双channel循环持续监听waitCh/parseCh/ctx.Done()/drainTimer
3. **parseJSONStreamWithLog无读超时** (main.go:1056-1094)
- 问题:bufio.Scanner阻塞读取,stdout未主动关闭时永远停在Read
- 修复:ctxAwareReader支持CloseWithReason,Wait/ctx完成时主动关闭
4. **forceKillTimer生命周期过短**
- 问题:waitCh返回后立刻停止timer,但stdout可能仍被写入
- 修复:统一管理timer生命周期,在循环结束后Stop和drain
5. **并发竞态修复**
- main.go:492 runStartupCleanup使用WaitGroup同步
- logger.go:176 Flush加锁防止WaitGroup reuse panic
**测试覆盖**:
- 新增4个核心场景测试(Wait先返回、同时返回、Context超时、Parse阻塞)
- main.go覆盖率从28.6%提升到90.32%
- 154个测试全部通过,-race检测无警告
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-08 23:35:55 +08:00
ben
ead11d6996
Merge pull request #49 from cexll/freespace8/master
...
Freespace8/master
v5.1.1
2025-12-08 11:48:07 +08:00
swe-agent[bot]
fec4b7dba3
test: 补充测试覆盖提升至 89.3%
...
解决的测试盲点:
1. getProcessStartTime (Unix) 0% → 77.3%
- 新增 process_check_test.go
- 测试 /proc/<pid>/stat 解析
- 覆盖失败路径和边界情况
2. getBootTime (Unix) 0% → 91.7%
- 测试 /proc/stat btime 解析
- 覆盖缺失和格式错误场景
3. isPIDReused 60% → 100%
- 新增表驱动测试覆盖所有分支
- file_stat_fails, old_file, new_file, pid_reused, pid_not_reused
4. isUnsafeFile 82.4% → 88.2%
- 符号链接检测测试
- 路径遍历攻击测试
- TempDir 外文件测试
5. parsePIDFromLog 86.7% → 100%
- 补充边界测试:负数、零、超大 PID
测试质量改进:
- 新增 stubFileStat 和 stubEvalSymlinks 辅助函数
- 新增 fakeFileInfo 用于文件信息模拟
- 所有测试独立不依赖真实系统状态
- 表驱动测试模式提升可维护性
覆盖率统计:
- 整体覆盖率: 85.5% → 89.3% (+3.8%)
- 新增测试代码: ~150 行
- 测试/代码比例: 1.08 (健康水平)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-08 11:13:00 +08:00
swe-agent[bot]
da257b860b
fix: 增强日志清理的安全性和可靠性
...
必须修复的问题:
1. PID重用防护 - 添加进程启动时间检查,对比文件修改时间避免误删活动进程的日志
- Unix: 通过 /proc/<pid>/stat 读取进程启动时间
- Windows: 使用 GetProcessTimes API 获取创建时间
- 7天策略: 无法获取进程启动时间时,超过7天的日志视为孤儿
2. 符号链接攻击防护 - 新增安全检查避免删除恶意符号链接
- 使用 os.Lstat 检测符号链接
- 使用 filepath.EvalSymlinks 解析真实路径
- 确保所有文件在 TempDir 内(防止路径遍历)
强烈建议的改进:
3. 异步启动清理 - 通过 goroutine 运行清理避免阻塞主流程启动
4. NotExist错误语义修正 - 文件已被其他进程删除时计入 Kept 而非 Deleted
- 更准确反映实际清理行为
- 避免并发清理时的统计误导
5. Windows兼容性验证 - 完善Windows平台的进程时间获取
测试覆盖:
- 更新所有测试以适配新的安全检查逻辑
- 添加 stubProcessStartTime 支持PID重用测试
- 修复 setTempDirEnv 解析符号链接避免安全检查失败
- 所有测试通过(codex-wrapper: ok 6.183s)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-08 10:53:52 +08:00
freespace8
9452b77307
fix(test): resolve data race on forceKillDelay with atomic operations
...
Replace global int variable with atomic.Int32 to eliminate race condition detected in TestRunForwardSignals. Concurrent reads in forwardSignals/terminateProcess goroutines now use Load(), tests use Store().
Test results: all 100+ tests pass with -race enabled.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-07 17:12:52 +08:00
freespace8
85303126d6
merge: resolve signal handling conflict preserving testability and Windows support
...
Integrate Windows compatibility (conditional SIGTERM) from upstream while retaining signalNotifyFn injection hook for testing.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-07 17:06:24 +08:00
ben
f08fa88d71
Merge pull request #45 from Michaelxwb/master
...
增加windows系统的安装支持
v5.1.0
2025-12-07 13:50:15 +08:00
freespace8
33149d9615
feat(cleanup): 添加启动时清理日志的功能和--cleanup标志支持
2025-12-07 12:28:06 +08:00
徐文彬
95408e7fa7
修改windows安装说明
2025-12-07 01:43:47 +08:00
徐文彬
22987b5f74
修改打包脚本
2025-12-06 23:47:57 +08:00
徐文彬
90f9a131fe
支持windows系统的安装
2025-12-06 23:40:24 +08:00
Jahan
017ad5e4d9
Merge pull request #1 from Michaelxwb/feature-win
...
支持window
2025-12-06 12:45:41 +08:00
root
15b4176afb
支持window
2025-12-06 04:34:47 +00:00
cexll
1533e08425
Merge branch 'master' of github.com:cexll/myclaude
v5.0.0
2025-12-05 10:28:24 +08:00
cexll
c3dd5b567f
feat install.py
2025-12-05 10:28:18 +08:00
cexll
386937cfb3
fix(codex-wrapper): defer startup log until args parsed
...
调整启动日志输出时机,在参数解析后再打印:
问题:
- 之前在解析参数前打印日志,命令行显示的是原始参数
- 无法准确反映实际执行的 codex 命令
解决:
- 将启动日志移到 buildCodexArgsFn 调用后
- 日志现在显示完整的 codex 命令(包括展开的参数)
- 提升调试体验,准确反映执行上下文
改动位于 codex-wrapper/main.go:487-500
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 10:27:36 +08:00
cexll
c89ad3df2d
docs: rewrite documentation for v5.0 modular architecture
...
完全重写 README 以反映新的模块化架构:
核心变更:
- 版本号升级至 5.0
- 聚焦 Claude Code + Codex 双智能体协作概念
- 重组工作流说明(Dev/BMAD/Requirements/Essentials)
- 新增模块化安装详细指南
- 移除过时的插件系统引用
- 添加工作流选择决策树
- 更新故障排查章节
文档结构:
1. 核心概念 - 双智能体架构
2. 快速开始 - python3 install.py
3. 工作流对比 - 适用场景清晰化
4. 安装配置 - config.json 操作类型
5. Codex 集成 - wrapper 使用和并行执行
6. 故障排查 - 常见问题解决方案
中英文文档同步更新。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 10:27:21 +08:00
cexll
2b8efd42a9
feat: implement modular installation system
...
引入模块化安装系统,支持可配置的工作流组合:
核心改进:
- .claude-plugin/marketplace.json: 移除废弃模块引用,精简插件清单
- .gitignore: 添加 Python 开发环境忽略项(.venv, __pycache__, .coverage)
- Makefile: 标记 make install 为 LEGACY,推荐使用 install.py
- install.sh: codex-wrapper 安装脚本,添加到 PATH
新架构使用 config.json 控制模块启用/禁用,支持:
- 选择性安装工作流(dev/bmad/requirements/essentials)
- 声明式操作定义(merge_dir/copy_file/run_command)
- 版本化配置管理
迁移路径: make install -> python3 install.py --install-dir ~/.claude
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 10:26:58 +08:00
cexll
d4104214ff
refactor: remove deprecated plugin modules
...
清理废弃的独立插件模块,统一到主工作流:
- 删除 advanced-ai-agents (GPT-5 已集成到核心)
- 删除 requirements-clarity (已集成到 dev 工作流)
- 删除 output-styles/bmad.md (输出格式由 CLAUDE.md 管理)
- 删除 skills/codex/scripts/codex.py (由 Go wrapper 替代)
- 删除 docs/ADVANCED-AGENTS.md (功能已整合)
这些模块的功能已整合到模块化安装系统中。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 10:26:38 +08:00
ben
802efb5358
Merge pull request #43 from gurdasnijor/smithery/add-badge
...
Add "Run in Smithery" badge
2025-12-03 10:33:24 +08:00
Gurdas Nijor
767b137c58
Add Smithery badge
2025-12-02 14:18:30 -08:00
ben
8eecf103ef
Merge pull request #42 from freespace8/master
...
chore: clarify unit-test coverage levels in requirement questions
2025-12-02 22:57:57 +08:00
freespace8
77822cf062
chore: clarify unit-test coverage levels in requirement questions
2025-12-02 22:51:22 +08:00
cexll
007c27879d
fix: skip signal test in CI environment
...
CI 环境中信号传递不可靠,导致 TestRun_LoggerRemovedOnSignal 超时。
添加 CI 环境检测,在 CI 中跳过此测试,本地保留完整测试覆盖。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
v4.8.2
2025-12-02 17:43:09 +08:00
cexll
368831da4c
fix: make forceKillDelay testable to prevent signal test timeout
...
将 forceKillDelay 从常量改为变量,在 TestRun_LoggerRemovedOnSignal 中设为 1 秒。
防止测试等待 3 秒超时,而子进程需要 5 秒才能被强制杀死的竞态条件。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 17:35:40 +08:00
cexll
eb84dfa574
fix: correct Go version in go.mod from 1.25.3 to 1.21
...
修复 go.mod 中的 Go 版本错误(1.25.3 不存在),改为与 CI 一致的 1.21 版本。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 17:12:43 +08:00
cexll
3bc8342929
fix codex wrapper async log
2025-12-02 16:54:43 +08:00
ben
cfc64e8515
Merge pull request #41 from cexll/fix-async-log
...
Fix async log
2025-12-02 15:51:34 +08:00
cexll
7a40c9d492
remove test case 90
2025-12-02 15:50:49 +08:00
cexll
d51a2f12f8
optimize codex-wrapper
2025-12-02 15:49:36 +08:00
cexll
8a8771076d
Merge branch 'master' into fix-async-log
...
合并master分支的TaskSpec重构和测试改进到fix-async-log分支:
- 保留异步日志系统 (Logger, atomic.Pointer)
- 集成TaskSpec结构和runCodexTask流程
- 合并所有测试钩子 (buildCodexArgsFn, commandContext, jsonMarshal)
- 统一常量定义 (stdinSpecialChars, stderrCaptureLimit, codexLogLineLimit)
- 整合测试套件,确保两分支特性兼容
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 10:18:33 +08:00
cexll
e637b26151
fix(codex-wrapper): capture and include stderr in error messages
...
- Add tailBuffer to capture last 4KB of codex stderr output
- Include stderr in all error messages for better diagnostics
- Use io.MultiWriter to preserve real-time stderr while capturing
- Helps diagnose codex failures instead of just showing exit codes
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-02 09:59:38 +08:00
dnslin
595fa8da96
fix(logger): 保留日志文件以便程序退出后调试并完善日志输出功能
2025-12-01 17:55:39 +08:00
cexll
9ba6950d21
style(codex-skill): replace emoji with text labels
...
替换 ❌ emoji 为 # Bad: 文字标记,保持文档简洁专业。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
v4.8.1
2025-12-01 16:22:32 +08:00
cexll
7f790fbe15
remove codex-wrapper bin
2025-12-01 16:21:57 +08:00
cexll
06f14aa695
fix(codex-wrapper): improve --parallel parameter validation and docs
...
修复问题:
- codex-wrapper --parallel 模式缺少参数验证,用户误传额外参数导致 shell 解析错误
- 文档中缺少正确 vs 错误用法对比,容易误导用户
主要改进:
1. codex-wrapper/main.go:
- 添加 --parallel 参数验证 (366-373行)
- 当检测到额外参数时,输出清晰的错误提示和正确用法示例
- 更新 --help 文档,添加 --parallel 使用说明
2. skills/codex/SKILL.md:
- 添加重要提示框,明确 --parallel 只从 stdin 读取配置
- 新增"正确 vs 错误用法"对比部分,包含3种常见错误示例
- 修复所有示例中多余的 `-` 参数
- 在 Delimiter Format 部分强调 workdir 的正确用法
测试验证:
- ✅ 所有单元测试通过
- ✅ 参数验证功能正常
- ✅ 并行执行功能正常
- ✅ 中文内容解析正常
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-01 16:18:36 +08:00
cexll
9fa872a1f0
update codex skill dependencies
v4.8.0
2025-12-01 00:11:31 +08:00
ben
6d263fe8c9
Merge pull request #34 from cexll/cce-worktree-master-20251129-111802-997076000
...
feat: add parallel execution support to codex-wrapper
v4.7.3
2025-11-30 00:16:10 +08:00
cexll
e55b13c2c5
docs: improve codex skill parameter best practices
...
Add best practices for task id and workdir parameters:
- id: recommend <feature>_<timestamp> format for uniqueness
- workdir: recommend absolute paths to avoid ambiguity
Update parallel execution example to demonstrate recommended format
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-29 23:32:44 +08:00
cexll
f95f5f5e88
feat: add session resume support and improve output format
...
- Support session_id in parallel task config for resuming failed tasks
- Change output format from JSON to human-readable text
- Add helper functions (hello, greet, farewell) with tests
- Clean up code formatting
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-29 23:14:43 +08:00
cexll
246674c388
feat: add async logging to temp file with lifecycle management
...
Implement async logging system that writes to /tmp/codex-wrapper-{pid}.log during execution and auto-deletes on exit.
- Add Logger with buffered channel (cap 100) + single worker goroutine
- Support INFO/DEBUG/ERROR levels
- Graceful shutdown via signal.NotifyContext
- File cleanup on normal/signal exit
- Test coverage: 90.4%
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-29 22:40:19 +08:00
cexll
23c212f8be
feat: add parallel execution support to codex-wrapper
...
- Replace JSON format with delimiter format (---TASK---/---CONTENT---)
- Support unlimited concurrent task execution with dependency management
- Implement Kahn's topological sort for dependency resolution
- Add cycle detection and error isolation
- Change output from JSON to human-readable text format
- Update SKILL.md with parallel execution documentation
Key features:
- No escaping needed for task content (heredoc protected)
- Automatic dependency-based scheduling
- Failed tasks don't block independent tasks
- Text output format for better readability
Test coverage: 89.0%
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-29 22:12:40 +08:00
cexll
90477abb81
update CLAUDE.md and codex skill
2025-11-29 19:11:06 +08:00
ben
11afae2dff
Merge pull request #32 from freespace8/master
...
fix(main): 提升缓冲区限制并简化消息提取流程
v4.7.2
2025-11-28 16:49:24 +08:00
freespace8
3df4fec6dd
test(ParseJSONStream): 增加对超大单行文本和非字符串文本的处理测试
2025-11-28 15:10:47 +08:00
freespace8
aea19f0e1f
fix(main): improve buffer size and streamline message extraction
2025-11-28 15:10:39 +08:00
cexll
291a4e3d0a
optimize dev pipline
v4.7.1
2025-11-27 22:21:49 +08:00
cexll
957b737126
Merge feat/codex-wrapper: fix repository URLs
2025-11-27 18:01:13 +08:00