Commit Graph

13 Commits

Author SHA1 Message Date
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
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
3bc8342929 fix codex wrapper async log 2025-12-02 16:54:43 +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
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
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
freespace8
aea19f0e1f fix(main): improve buffer size and streamline message extraction 2025-11-28 15:10:39 +08:00
cexll
c8a652ec15 Add codex-wrapper Go implementation 2025-11-27 14:33:13 +08:00