-
Notifications
You must be signed in to change notification settings - Fork 607
Join expo-app, server, and cli into a mono repo #403
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
Closed
Closed
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
Fix "Unexpected end of JSON input" error by: - Check for empty/whitespace-only body before parsing - Return empty object for empty bodies instead of failing - Add detailed error logging for debugging JSON parse failures - Prevent crashes on malformed or empty request bodies 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Improve content type parser to handle HTTP methods correctly: - DELETE and GET requests with empty bodies return undefined (no parsing) - Other HTTP methods with empty bodies return empty object - Add method and URL to error logging for better debugging - Prevents JSON parsing errors on legitimate empty DELETE requests Fixes the GitHub disconnect endpoint which uses DELETE without body. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add GET /v2/sessions/active - returns only active sessions
- Add GET /v2/sessions - cursor-based pagination with changedSince filter
- Use consistent ID-based sorting (desc) for predictable pagination
- changedSince is just a filter, doesn't affect pagination mechanics
- Remove lastMessage field from all v2 endpoints for smaller payloads
- Simple opaque cursor format: cursor_v1_{sessionId}
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Updated default server endpoint from api.happy-servers.com to api.cluster-fluster.com in: - CLI configuration (src/configuration.ts) - Push notifications client (src/api/pushNotifications.ts) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
chore: - stricter types for daemon control server - fixed integration tests
…e Code versions Previous behavior: --continue flag created new sessions instead of resuming existing ones. Two bugs caused this: 1. claudeCheckSession() only validated sessions with 'uuid' field (Claude Code 2.1.x format), rejecting sessions from older Claude Code versions that use 'messageId' or 'leafUuid' fields 2. claudeLocal.ts checked hasUserSessionControl AFTER extracting session flags, preventing --resume from being added to Claude CLI arguments in hook mode Result: claudeFindLastSession() found valid session ID, but --resume flag was not passed to Claude Code, causing new session creation instead of resumption. What changed: - src/claude/utils/claudeCheckSession.ts: Accept uuid, messageId, leafUuid fields + error logging - Lines 20-30: Parse JSON once, check uuid OR messageId OR leafUuid (with length > 0) - Line 21: Skip empty lines explicitly (not parse errors) - Line 32: Log malformed JSON errors per project convention (claudeRemoteLauncher.ts pattern) - Line 38: Log final validation result (valid/invalid) for transparency - src/claude/utils/claudeFindLastSession.ts: Add error logging + update documentation - Line 5: Import logger module - Line 10: Update JSDoc to document all supported field types (uuid, messageId, leafUuid) - Line 49: Log errors in catch block per project logging convention - src/claude/claudeLocal.ts: Fix --resume flag passing in hook mode - Lines 184-189: Remove hasUserSessionControl condition that blocked --resume - Add --resume to args when startFrom exists (user flags already extracted, must re-add) - Fix: hasUserSessionControl set before extraction but checked after, blocking --resume - src/claude/utils/claudeCheckSession.test.ts: Add 17 unit tests covering all scenarios - Claude 2.1.x sessions (uuid field), older Claude sessions (messageId), summaries (leafUuid) - Edge cases (empty strings, null, missing fields, malformed JSON, empty files) - File system edge cases (non-existent sessions, large files) - src/claude/utils/claudeFindLastSession.test.ts: Add 14 integration tests - Session finding with multiple formats, mtime sorting, UUID filtering - Mixed scenario tests (valid + invalid sessions) - scripts/test-continue-fix.sh: Add manual verification script for session finder Why: Claude Code changed message ID field names between versions. Older Claude Code uses 'messageId', version 2.1.x uses 'uuid', summary lines use 'leafUuid'. Session validation must check all three field types for backwards compatibility with sessions created by any Claude Code version. In hook mode, session flags are extracted from claudeArgs array before spawning Claude CLI. The hasUserSessionControl variable was set before extraction but checked after when building args, incorrectly preventing --resume from being added even though flags were removed. Added error logging to all catch blocks following project convention (claudeRemoteLauncher.ts, claudeLocalLauncher.ts pattern). Files affected: - src/claude/utils/claudeCheckSession.ts: Multi-format validation + logging (14 lines modified) - src/claude/utils/claudeFindLastSession.ts: Error logging + JSDoc (3 lines modified) - src/claude/claudeLocal.ts: Fix hook mode --resume passing (4 lines modified) - src/claude/utils/claudeCheckSession.test.ts: Comprehensive unit tests (188 lines, new) - src/claude/utils/claudeFindLastSession.test.ts: Integration tests (210 lines, new) - scripts/test-continue-fix.sh: Manual verification script (79 lines, new) Testable: - Run unit/integration tests: npm test -- src/claude/utils/ - Test --continue behavior: happy --continue "test message" - Verify --resume in args: grep "Args.*--resume" logs - Expected: Session resumes correctly (not new session created)
Previous behavior:
- Bash handler validated all cwd paths against working directory
- validatePath("/", workingDir) failed security check (/ outside working dir)
- CLI detection command sent with cwd="/" was rejected
- Handler returned { success: false, error: "Access denied..." } immediately
- Never executed "command -v claude/codex/gemini"
- GUI received failure, set all cliAvailability to null (unknown)
- Profile greying used wrong logic: codex profiles enabled, claude greyed
What changed:
- registerCommonHandlers.ts:157: Add special case for cwd="/" in validation
- registerCommonHandlers.ts:169: Map cwd="/" to undefined (shell default)
- registerCommonHandlers.ts:172: Log actual cwd value used in options
- registerCommonHandlers.ts:173-186: Add complete result logging (executing, result)
- registerCommonHandlers.ts:204-224: Add timeout and error logging
- RpcHandlerManager.ts:72-77: Add handler call/return/response logging
- codexMcpClient.ts:21-48: Return null when codex not installed (conservative)
- codexMcpClient.ts:92-105: Add clear error when codex CLI missing
Why:
- CLI detection needs to run with shell default PATH (cwd="/")
- Security preserved: all non-root paths still validated
- Follows Node.js convention: undefined cwd = shell default
- Enables proper CLI detection for claude, codex, gemini
Files affected:
- src/modules/common/registerCommonHandlers.ts: Path validation special case + logging
- src/api/rpc/RpcHandlerManager.ts: RPC lifecycle logging
- src/codex/codexMcpClient.ts: Null return on detection failure + clear error
Testable:
- Open new session wizard in GUI
- Daemon log shows: "Shell command executing... { cwd: undefined }"
- Daemon log shows: "Shell command result: { success: true, exitCode: 0 }"
- GUI console shows: "Parsed CLI status: { claude: true, codex: false, ... }"
- Claude profiles enabled, codex profiles greyed with warning banner
…verflow Previous behavior: - Custom deepEqual with unbounded recursion (no circular ref protection) - Infinite recursion when tool inputs contained circular references - Stack overflow in background Claude sessions: "RangeError: Maximum call stack size exceeded" - Wrapper function in utils/deepEqual.ts used only in one place What changed: - permissionHandler.ts:8: Import isDeepStrictEqual directly from node:util - permissionHandler.ts:14: Remove deepEqual import (no longer needed) - permissionHandler.ts:269: Use isDeepStrictEqual directly at call site - deepEqual.ts: Now unused (can be deleted in cleanup) Why: - DRY: No wrapper needed, use Node.js built-in directly - Zero new dependencies (node:util is built-in) - Handles circular refs safely (tested: returns true for circular objects) - More performant (C++ implementation vs JavaScript) - Idiomatic Node.js/TypeScript practice - WOLOG: Works identically for all tool types Files affected: - src/claude/utils/permissionHandler.ts: Use isDeepStrictEqual directly - src/utils/deepEqual.ts: Now unused (wrapper removed) Testable: - Run Claude in bypass permissions mode with complex tool calls - High token contexts (150k+) should work without stack overflow - Tool call matching still works correctly
Previous behavior: - Session.cleanup() was never called after session loop completed, causing keepAliveInterval to run indefinitely (memory leak) - sendClaudeSessionMessage() did not check socket.connected before emitting, causing messages to be silently lost when disconnected What changed: - src/claude/runClaude.ts: Add currentSession?.cleanup() calls in both the SIGINT handler (line 381) and after the main loop completes (line 457) to properly release intervals and callbacks - src/api/apiSession.ts: Add socket.connected check before emit in sendClaudeSessionMessage() to prevent silent message loss and log a debug message when messages cannot be sent Why: Prevents memory leaks from orphaned intervals and makes message delivery failures visible in logs for debugging
Adds support for specifying the JavaScript runtime used to spawn Claude Code. The new --js-runtime flag accepts 'node' (default) or 'bun'. Usage: happy --js-runtime bun Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…rovements-merged Feature/new session wizard ux improvements merged
- Move AgentBackend, AgentRegistry to core/ - Create transport/ with TransportHandler abstraction - Move Gemini-specific logic to GeminiTransport - Create adapters/ for message transformation - Create factories/ for high-level agent creation - Rename AcpSdkBackend → AcpBackend - Remove acp/utils.ts (merged into transport handlers)
…proved UX ACP Integration: - Add sendAgentMessage() for unified Agent Communication Protocol format - Migrate all Gemini messages from sendCodexMessage to sendAgentMessage(gemini, ...) - Add ACP message types: task_started, task_complete, turn_aborted, permission-request Model Selection: - Support dynamic model selection from frontend via meta.model - Save selected model to ~/.gemini/config.json for persistence Permission Handling: - Integrate GeminiPermissionHandler with permission modes (default, read-only, safe-yolo, yolo) - Add permission ID to tool call ID mapping for proper UI tracking Message Flow Improvements: - Add waitForResponseComplete() to ensure all chunks received before task_complete - Accumulate response chunks and send complete message once (fixes fragmentation) - Fix status flickering by not resetting thinking on intermediate idle events Error Handling: - Add retry logic for empty response errors (up to 3 retries) - Improve quota error handling: no retry, show reset time, suggest alternative model - Better error messages for model not found, rate limits, quota exceeded Tool Handling: - Improve change_title detection from toolCallId pattern - Add tool-result emission after permission approval - Track hadToolCallInTurn for proper task_complete timing
- Add ConversationHistory class to track user/assistant messages - Inject previous conversation context into new session on model change - Allows seamless model switching without losing context
…ling - Add `happy gemini project set/get` commands for Workspace accounts - Store project ID per-account (linked to email) - Show helpful error message for "Authentication required" with guide link - Sync local ~/.gemini/oauth_creds.json on `happy connect gemini` - Add `happy connect status` command to show vendor auth status - Pass GOOGLE_CLOUD_PROJECT env var to Gemini SDK
codex: make abort graceful; force-close MCP on kill/exit
- Extract session update handlers into separate module (sessionUpdateHandlers.ts) - handleAgentMessageChunk, handleToolCallUpdate, handleToolCall, etc. - Reduces AcpBackend.ts from ~1350 to ~900 lines - Add retry logic for ACP init/newSession operations - 3 attempts with exponential backoff (1s, 2s, 4s) - Improves reliability on slow starts - Move timeouts to configurable constants - Add getIdleTimeout() to TransportHandler interface - Export GEMINI_TIMEOUTS from GeminiTransport - DEFAULT_IDLE_TIMEOUT_MS, DEFAULT_TOOL_CALL_TIMEOUT_MS - Improve tool name detection in GeminiTransport - ExtendedToolPattern with inputFields and emptyInputDefault - Remove fragile context-based heuristics - Cleaner, more declarative pattern matching Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
…y, unify model resolution
…ath calculation The test was failing because it manually calculated the project directory path by only replacing `/` with `-`, while getProjectPath replaces additional characters including underscores. On macOS, temp directory paths contain underscores, causing a path mismatch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
No description provided.