-
Notifications
You must be signed in to change notification settings - Fork 87
refactor: v3.0 code optimization and CI tests #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bfly123
wants to merge
164
commits into
main
Choose a base branch
from
test/v3.0-refactor-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
feat(terminal): add iTerm2 support via it2 CLI
Fix: Bridge process crash and message forwarding stability (macOS/tmux)
This reverts commit fd6b6f2.
- Fix Python version check in install.ps1 (single call) - Add lib/compat.py for Windows UTF-8 console encoding - Add _find_claude_cmd() for Windows Claude CLI discovery - Add encoding='utf-8' to subprocess.run calls - Add error handling to WezTerm create_pane - Add tmp/ to .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Runtime config: - Add lib/ccb_config.py for BackendEnv (wsl/windows) configuration - Support .ccb-config.json and CCB_BACKEND_ENV env var - Auto-inject WSL session paths for Windows+WSL scenarios - Update terminal.py to force WSL launch when BackendEnv=wsl Install confirmation: - Add WSL environment confirmation in install.sh - Add Windows environment confirmation in install.ps1 - Support -Yes flag and CCB_INSTALL_ASSUME_YES=1 to skip 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 lib/session_utils.py 权限检查工具 - ccb: _write_*_session() 添加预检查和清晰错误提示 - codex_comm.py/gemini_comm.py: 异常时输出警告而非静默吞掉 用户遇到权限问题时将看到具体原因和修复命令 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Windows 用户必须使用原生 exe 安装 WezTerm,即使使用 WSL 也是如此 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use command argument instead of stdin for text and enter - Add fallback sequence: \r -> \n -> \r\n -> stdin - Set default enter delay to 0.01s for TUI compatibility - Also strip \n from text before sending - Update AI collaboration rules in install.sh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use run_in_background=true for non-blocking execution - Add TaskOutput usage for retrieving results - Update workflow documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add CCB_CONFIG_START/END markers to isolate ccb config - Install: update existing block or append new one - Uninstall: only remove marked block, preserve user content - Keep backward compatibility with legacy rules 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Check all candidate directories instead of just the first one - Remove commands from ~/.claude, ~/.config/claude, ~/.local/share/claude 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Convert all Chinese strings to English across: - lib/*.py (5 files): docstrings, comments, error messages - ccb: CLI help text and status messages - bin/* (8 files): script descriptions and error messages - commands/*.md (8 files): skill definitions - install.sh/install.ps1: prompts and messages - CLAUDE.md: project instructions Intentionally unchanged: - README.md: stays bilingual - install.sh legacy regex: matches old Chinese rules for cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Calculate project hash directly (sha256 of cwd) instead of relying on stored value. Check if session-*.json files exist in ~/.gemini/tmp/<hash>/chats/ before using --resume flag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Windows PowerShell 5.x has poor UTF-8 emoji support, causing parse errors. Replace ❌→[ERROR], ✓→[OK],⚠️ →[WARNING] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement i18n system supporting Chinese and English: - Add lib/i18n.py with language detection and message dictionary - Language detection priority: CCB_LANG env > system locale > default en - Update ccb, bin/*, lib/codex_comm.py, lib/gemini_comm.py - Add i18n functions to install.sh and install.ps1 Usage: Set CCB_LANG=zh for Chinese, CCB_LANG=en for English, or leave unset for auto-detection based on system locale. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add flush=True to print statements in codex_comm.py and gemini_comm.py to ensure immediate output in non-interactive/background mode - Add early "🚀 cask-w/gask-w started" message before initialization so Claude can detect process started and return immediately This should improve stability when using run_in_background=true. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add /cask-w and /gask-w to the fast path triggers in CLAUDE.md config, so Claude will immediately call bash without going through skill system. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Optimizations: - Move imports after startup signal for faster first output - Add lazy_init parameter to CodexCommunicator and GeminiCommunicator - Defer log reader creation and health check until actually needed - Skip Windows encoding setup on Linux Performance improvement: - Startup to first output: 38-40ms -> 24-27ms (35-40% faster) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove timeout=0 parameter from ask_sync calls - Use lazy imports for better startup performance - Simplify error output format - Use raise SystemExit instead of sys.exit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change behavior to STOP immediately after sending to Codex/Gemini instead of continuing with other work in background. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- cask-w/gask-w now return immediately after sending - Background process waits for reply (up to 5 min) - Reply cached in ~/.cache/ccb/ for cpend/gpend to read - cpend/gpend check cache first before querying session 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevents parent process from blocking on child stdout/stderr. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Simplify cask-w/gask-w to pure synchronous wait (no fork) - Use Claude Code's run_in_background=true for async execution - Fix _latest_log() to detect stale log file bindings - Update skill configs to use background task + TaskOutput pattern - Add pending_state save on timeout/interrupt for later retrieval 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add _send_message() and _generate_marker() to GeminiCommunicator - Add marker_prefix to GeminiCommunicator.__init__ - Add save_pending_state() for timeout/interrupt recovery - Use _send_message() instead of direct _send_via_terminal() - Add KeyboardInterrupt handling - Call _remember_gemini_session() after send and wait 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add retry loop (10 attempts) in capture_state() for transient JSONDecodeError - Return msg_count=-1 to indicate unknown baseline instead of 0 - In _read_since(), establish stable baseline first when msg_count<0 - Add id/hash deduplication to avoid returning already-processed messages Root cause: Gemini CLI writes session JSON in-place, causing transient parse failures that reset msg_count to 0, leading to old messages being returned as "new" replies. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change file open from text mode to binary mode ("rb")
- Use offset=-1 to indicate unknown baseline
- Establish baseline from EOF when offset unknown
- Start from EOF when switching log files to avoid replaying old content
Root cause: text mode seek/tell uses "cookie" values that don't equal
byte offsets, causing offset > st_size clamping to misposition and
return stale messages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ility - Add UTF-8 BOM to file header - Set $OutputEncoding, [Console]::OutputEncoding/InputEncoding to UTF-8 - Run chcp 65001 for consistent Chinese/emoji output on Windows PowerShell 5.1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Key changes: - cask-w/gask-w now run in background mode, not blocking foreground work - Fix codex_comm: use binary mode for consistent byte offset handling - Fix gemini_comm: prevent returning stale messages on JSON parse failure - Fix gask-w: align implementation with cask-w - Fix install.ps1: add UTF-8 BOM for PowerShell 5.1 compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…oding - Use utf-8-sig encoding when reading session files (tolerate BOM) - Use utf-8 encoding when writing session files - Refactor _get_latest_codex_session_id() to use _read_json_file() - Add --restore as alias for --resume - Support ccb -r as shortcut for ccb up -r Root cause: Windows PowerShell 5.1 default encoding caused JSON parse failure, making -r ignore .codex-session in current directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…isolation - Add lib/process_lock.py with cross-platform file locking - Each provider (codex/gemini/opencode) has independent lock - Clear output file before new request to avoid stale content - Reset log state after lock acquisition to ignore old messages - Includes stale lock detection (checks if holder PID is alive) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add try_acquire() method to ProviderLock for non-blocking lock - Concurrent requests now immediately fail instead of waiting - Unify oask with cask/gask logic (_wait_for_complete_reply) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Lock files now include cwd hash: {provider}-{cwd_hash}.lock
- Different working directories can run independently
- Same directory still prevents concurrent requests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Check for .autoflow folder in current directory instead of global CCA - Plan mode enabled for CCA projects regardless of -a flag - Removes dependency on global CCA installation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Git version injection to install.ps1 (3-tier fallback) - Improve cmd_version directory detection (Windows paths support) - Enhance _detect_cca to locate Windows installations - Update _update_cca for cross-platform CCA installation - Co-designed with Codex for comprehensive cross-platform support Fixes: - Version displays 'unknown' on Windows - CCA installation fails with WinError 2 - Better Windows path detection (%LOCALAPPDATA%) Testing: - Tested on Windows 10/11 PowerShell 5.1 and 7.x - All existing functionality preserved - Cross-platform compatibility verified
fix: Windows compatibility improvements
Fix cask output write race by using pending file swap
[v2.3] 修复会话与终端识别
- 新增 pane_registry 模块,实现 session-first 绑定策略 - 修复新会话启动后仍读取旧日志的问题 - 允许 cask 并发请求,使用 per-request marker 防止串答 - 更新 .gitignore 忽略本地开发文件 解决同目录多实例串会话问题,提升多模型协作稳定性
feat: 会话绑定强化与 cask 并发支持
修复 Windows 原生环境下 WezTerm pane 标题依赖 printf 造成的 ccb up 启动失败
Major changes:
- Add caskd daemon for persistent background request handling
- Implement SessionRegistry with automatic session file change detection
- Add pane heartbeat check (is_alive) to detect dead Codex panes
- Add interrupted state detection (■ Conversation interrupted)
- Fix exit_code 0 being reported as 1 (resp.get("exit_code") or 1 bug)
- Add WeztermBackend.get_text() for pane content inspection
- Support concurrent task queue with automatic skip on interrupt
New files:
- bin/caskd: Daemon entry point
- lib/caskd_daemon.py: Daemon core with WorkerPool and SessionRegistry
- lib/caskd_protocol.py: Protocol definitions (CCB_REQ_ID, CCB_DONE)
- lib/caskd_session.py: Session management utilities
- commands/caskd.md: Daemon documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add smart daemon layer (caskd/gaskd/oaskd) with per-session queues, auto-start and idle auto-exit - Enable stable cross-AI coordination (Claude/Codex/Gemini/OpenCode) with session_key serialization - Support chained calls across agents without reply mixing - Improve platform compatibility and harden direct-mode locking fallback
…EADME indicated 3.0.0, causing ccb update to report old version
- Add lib/env_utils.py: env_bool(), env_int() - Add lib/askd_runtime.py: run_dir(), state_file_path(), log_path(), write_log(), random_token(), normalize_connect_host() - Add lib/askd_rpc.py: read_state(), ping_daemon(), shutdown_daemon() - Add lib/providers.py: ProviderDaemonSpec with CASKD_SPEC/GASKD_SPEC/OASKD_SPEC - Add lib/askd_server.py: unified AskDaemonServer class - Refactor caskd_daemon.py, gaskd_daemon.py, oaskd_daemon.py to use shared modules - Code reduction: -849 lines, +217 lines Co-Authored-By: Warp <agent@warp.dev>
- Add lib/askd_client.py: autostart_enabled, state_file_from_env, find_project_session_file, try_daemon_request, maybe_start_daemon, wait_for_daemon_ready, check_background_mode - Add ProviderClientSpec to lib/providers.py with CASK/GASK/OASK_CLIENT_SPEC - Refactor bin/cask, bin/gask, bin/oask to use shared client functions - Code reduction: -438 lines, +105 lines (net -333 lines) Co-Authored-By: Warp <agent@warp.dev>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes
lib/session_utils.py- unified session file helperslib/worker_pool.py- extracted common worker pool patternlib/ccb_protocol.py- renamed from caskd_protocol.pyinstall.sh- fixed embedded Python indentationtest/- new pytest test suite.github/workflows/test.yml- CI configurationTest Plan
🤖 Generated with Claude Code
Co-Authored-By: Warp agent@warp.dev