fix: claude CLI タイムアウト修正 + システムプロンプトフラグ修正#27
Open
leivy-dev wants to merge 11 commits intomoltlaunch:mainfrom
Open
fix: claude CLI タイムアウト修正 + システムプロンプトフラグ修正#27leivy-dev wants to merge 11 commits intomoltlaunch:mainfrom
leivy-dev wants to merge 11 commits intomoltlaunch:mainfrom
Conversation
Add src/cli.ts as a new CLI entrypoint providing subcommands: - init: configure cashclaw without browser UI (reads ANTHROPIC/OPENAI/OPENROUTER_API_KEY from env) - start: start daemon with PID file, no browser auto-open - stop: stop daemon via PID file - status: show config and daemon running state - config show: display config with API key redacted Update tsup.config.ts and package.json to expose cashclaw-cli binary.
Add LLMConfig.apiKeyEnvVar field so API key can be read from environment variables at runtime instead of being stored in config.json. - config.ts: add apiKeyEnvVar field and resolveApiKey() helper - llm/index.ts: use resolveApiKey() instead of config.apiKey directly - cli.ts: add --use-env-key and --api-key-env-var flags to init command Usage (agent-gateway credentials, no key stored in config): cashclaw-cli init --agent-id <id> --provider anthropic --use-env-key
Implement ReAct-style claude CLI provider that spawns local `claude` binary as subprocess, eliminating the need for ANTHROPIC_API_KEY. - src/llm/claude-cli.ts: new provider using execFile with ReAct JSON protocol - src/llm/index.ts: route claude-cli provider, use resolveApiKey() everywhere - src/config.ts: add claude-cli provider type, apiKeyEnvVar field, resolveApiKey() - src/cli.ts: full CLI entrypoint (init/start/stop/status/config show)
Add full headless operation without ANTHROPIC_API_KEY: - claude-cli LLM provider (ReAct/subprocess pattern) - CLI entrypoint: init/start/stop/status/config show - PID-based daemon management - apiKeyEnvVar config field for runtime env resolution
- config/service.yaml: cashclaw service definition - scripts/register-service.sh: installs to ~/.agent-gateway/services.d/ - docs/service-manager.md: integration guide Closes moltlaunch#10
feat: service registration for universal service manager
- error イベントで scheduleWsReconnect() を呼ぶのを廃止 → ws.close() が close イベントを発火するため二重呼出しになりバックオフが加速していた - connectWs() で古い ws を removeAllListeners + terminate してから新規作成 → 再接続時に stale リスナーが残っていたバグを修正 - keepalive ping を 20s 間隔で追加(プロキシのアイドルタイムアウト対策) - pong タイムアウト 10s を追加: ping 後に pong が来なければ dead connection と判定して強制再接続 - disconnectWs() でも ping/pong タイマーをクリーンアップ Co-Authored-By: Claude <noreply@anthropic.com>
- Add lastXPostTime to HeartbeatState - Add xpost to ActivityEvent.type union - Add triggerXPost() using spawnSync with bun run x:post - Add maybeXPost() with 8h interval guard (idle-only, no urgent tasks) - Call triggerXPost(force=true) in handleCompleted() when score >= 4 - Call maybeXPost() in scheduleNext() alongside maybeStudy() - Configurable via SNS_AUTOMATION_PATH + X_PERSONA_ID env vars
- --no-session-persistence を追加してセッション保存コストを排除 (セッション保存処理が原因で120秒タイムアウトが発生していた) - --permission-mode bypassPermissions を追加して権限確認待ちを防止 - --system → --system-prompt に修正 (Claude CLI の正しいフラグ名) これにより学習セッションが正常に完了しDiscord通知が再開する。
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
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.
問題
学習セッションが毎回120秒でタイムアウトし、Discord通知が届かなくなっていた。
ログ:
原因
--no-session-persistenceなし → Claudeがセッションファイルを作成・保存する処理が走り、初期化に2分以上かかることがある--systemフラグが無効 → 正しくは--system-prompt(エージェントループでシステムプロンプトが正しく渡らない)--permission-mode bypassPermissionsなし → 権限確認プロンプトで応答待ちになるリスク修正
--no-session-persistence追加--permission-mode bypassPermissions追加--system→--system-prompt修正確認
npx tsc --noEmit: エラーなしnpm run build: ビルド成功