Skip to content

Conversation

@AshishKumar4
Copy link
Collaborator

@AshishKumar4 AshishKumar4 commented Dec 14, 2025

Summary

Major release merging nightly changes to main, featuring a new encrypted User Secrets Vault system, improved CI/CD workflows, enhanced process monitoring, and React safety gate static analysis.

Changes

Vault/Secrets System (New Feature)

  • Added client-side encrypted User Secrets Vault with Argon2id/WebAuthn PRF key derivation
  • New UserSecretsStore Durable Object for secure server-side encrypted storage
  • vault-crypto.ts - Browser-side cryptography (AES-GCM, HKDF, rejection sampling for unbiased RNG)
  • VaultContext React provider for vault state management
  • New vault UI components: VaultSetupWizard, VaultUnlockModal, SecretsManager, etc.
  • WebSocket-based session management for vault operations

CI/CD & Workflows

  • ai-changelog.yml - AI-powered changelog generation for releases
  • claude-issue-autofix.yml - Automated issue fixing with trusted actor gating
  • Updated claude-reviews.yml with security improvements and critical path detection
  • Simplified claude-issue-triage.yml workflow
  • Enhanced ci.yml with caching and full test/lint/typecheck pipeline

Code Generation Safety

  • preDeploySafetyGate.ts - AST-based static analysis for React antipatterns
  • Detects infinite render loops, useEffect without deps, selector instability
  • Automatic deterministic fixes for common patterns

Container/Process Monitoring

  • Improved health check with HTTP probe instead of lsof
  • Better process group handling (detached mode for clean kills)
  • Port failure threshold tracking
  • Comprehensive test suite (3000+ lines)

Database & API

  • Migration 0004: Drops old user_secrets table, updates user_model_providers
  • New /api/vault/* endpoints for vault lifecycle
  • Removed deprecated SecretsService (replaced by Durable Object)

Motivation

This release consolidates security-focused improvements and new features developed on the nightly branch:

  1. User secrets needed end-to-end encryption with zero-knowledge server storage
  2. CI/CD workflows needed better security gating and automation
  3. React code generation needed safety checks to prevent common runtime errors
  4. Process monitoring needed more reliable health checks

Testing

  • Run bun run test to execute all tests including vault and monitor suites
  • Manual testing of vault setup/unlock flows with password and passkey methods
  • Verify CI workflow triggers on PRs

Breaking Changes

  • user_secrets D1 table is dropped (data migrated to Durable Object)
  • Old secrets API endpoints removed in favor of vault WebSocket protocol

Related Issues

  • Addresses security improvements across the platform

AshishKumar4 and others added 30 commits November 4, 2025 00:17
- Added UserSecretsStore durable object for secure secret storage and management
- Implemented XChaCha20-Poly1305 encryption service for secure secret storage
- Heirarchial key derivation
- Increased PBKDF2 iterations to 600k/100k for stronger key derivation
- Added memory zeroing for plaintext bytes in encryption/decryption operations
- Implemented promise-based locking for key rotation to prevent concurrent modifications
- Added detailed security documentation for deterministic salt design and SQL injection prevention
- Updated UserSecretsStore to wait for any in-progress key rotation before executing operations
- Added comprehensive
…ic coding agent implemented

- Abstracted behaviors and objectives
- Behavior and Objectives are bot h AgentComponent
- CodeGeneratorAgent (Agent DO) houses common business logic
- Implemented agentic coding agent and and assistant
- Implemented AI-powered project type prediction (app/workflow/presentation) with confidence scoring and auto-detection when projectType is 'auto'
- Enhanced template selection to filter by project type and skip AI selection for single-template scenarios in workflow/presentation types
- Added GitHub token caching in CodeGeneratorAgent for persistent OAuth sessions across exports
- Updated commitlint config to allow longer commit messages (
- Initialize template cache during agent setup to avoid redundant fetches
- Remove redundant project name prompt from template selection
- Clean up default projectType fallback logic
- Added concurrency control to prevent duplicate workflow runs on the same PR
- Replaced Claude-based comment cleanup with direct GitHub API deletion for better reliability
- Enhanced code debugger instructions to handle Vite dev server restarts and config file restrictions
- Replaced unsafe type assertions with proper type guards for legacy state detection
- Added explicit type definitions for deprecated state fields and legacy file formats
- Eliminated all 'any' types while maintaining backward compatibility with legacy states
…ess design

- Sandbox layer does not rely on templates now, instead expects raw files list
- Tools to init/list templates, files
- Templates can be chosen by agentic mode after creation
- Restructured system prompt with detailed architecture explanations covering virtual filesystem, sandbox environment, and deployment flow
- Better tool descriptions
- Improved communication guidelines and workflow steps for better agent reasoning and execution
- Replaced agent mode toggle with project mode selector (App/Slides/Chat) that determines behavior type
- Implemented agentic behavior detection for static content (docs, markdown) with automatic editor view
- Conditionally render PhaseTimeline and deployment controls based on behavior type (phasic vs agentic)
- Replaced manual template_manager tool with init_suitable_template that uses the original template selector ai
- Updated system prompts to emphasize template-first workflow for interactive projects with AI selector as mandatory first step
- Simplified template selection process by removing manual list/select commands in favor of intelligent matching
```
- Added conversation history support to AgenticProjectBuilder with message preparation and context tracking
- Implemented tool call completion callbacks to sync messages and trigger periodic compactification
- Modified AgenticCodingBehavior to queue user inputs during builds and inject them between tool call chains using abort mechanism
- Fix importTemplate to actually work
- Fixed template filtering logic to respect 'general' project type
- Added behaviorType to logger context for better debugging
- fixed not saving behaviorType to state
…ructor

- Moved behaviorType and projectType initialization from hardcoded values to constructor-based setup
- Changed initial state values to 'unknown' to ensure proper initialization through behavior constructor
- Cleared template details cache when importing new templates to prevent stale data
- Moved user input idle check from PhasicCodingBehavior to CodeGeneratorAgent for consistent behavior across all modes
- Fixed message order in agenticProjectBuilder to place history after user message instead of before
- Added replaceExisting parameter to addConversationMessage for better control over message updates
- Enhanced initial state restoration to include queued user messages and behaviorType
- Added status and queuePosition fields
- Single convo id needs to be broadcasted but messages need to be saved with unique ids.
- Fix message deduplication to use composite key (conversationId + role + tool_call_id)
- Improved tool message filtering to validate against parent assistant tool_calls
- Removed unused CodingAgentInterface stub file
- Simplified addConversationMessage interface by removing replaceExisting parameter
- Added CompletionDetector interface and CompletionConfig for detecting task completion signals
- Implemented dependency-aware parallel tool execution engine with resource conflict detection
- Added LoopDetector to prevent infinite tool call loops with contextual warnings
- Enhanced ToolCallContext with completion signal tracking and warning injection state
- Modified tool execution to respect dependencies and execute in parallel groups
… and debugger

- Added CompletionDetector to track completion signals via dedicated tools (mark_generation_complete, mark_debugging_complete)
- Implemented LoopDetector to prevent infinite tool call loops with contextual warnings
- Created wrapToolsWithLoopDetection utility to inject loop detection into tool execution flow
- Enhanced system prompts to emphasize efficient parallel tool usage and completion discipline
- Add GitHub Actions workflow for release-live branch deployments
- Include test-build job with dependency caching
- Configure deploy job with all required secrets and environment variables
- Add vitest alias for bun:test to enable test compatibility
- Add VIBESDK_RUN_INTEGRATION_TESTS environment variable to control integration test execution
- Exclude SDK integration tests from pre-commit hooks to improve commit speed
- Add dedicated test:integration npm script for running integration tests explicitly
- Update vitest config to conditionally exclude integration tests based on environment variable
AshishKumar4 and others added 2 commits December 19, 2025 15:06
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
sdk/src/state.ts Outdated
}
case 'phase_generated': {
const m = msg as WsMessageOf<'phase_generated'>;
this.setState({ phase: { status: 'generated', ...extractPhaseInfo(m as any) } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM - Type Safety Violation

Using as any violates the project's strict type safety rules (CLAUDE.md: "NEVER use any type"). This pattern is repeated on lines 125, 130, 135, 140, and 145.

Root cause: The WsMessageOf<'phase_generated'> and similar phase message types don't include the phase property in their type definitions.

Suggested fix: Update the message type definitions in sdk/src/protocol.ts to include the phase property:

// In protocol.ts or types.ts
interface PhaseInfo {
  name?: string;
  description?: string;
}

// Then extend phase message types to include:
// phase?: PhaseInfo

Alternatively, create a helper type:

type PhaseMessageWithPhase<T> = T & { phase?: { name?: string; description?: string } };
const m = msg as PhaseMessageWithPhase<WsMessageOf<'phase_generated'>>;

AshishKumar4 and others added 8 commits December 19, 2025 15:49
…ript

- Add ALLOCATION_STRATEGY, ENVIRONMENT, PLATFORM_MODEL_PROVIDERS, and USE_CLOUDFLARE_IMAGES to deploy-release-live workflow
- Add AI_PROXY_JWT_SECRET secret to deployment workflow
- Update deploy script to include new variables in .prod.vars generation
- Add clear() methods to TypedEmitter, SessionStateStore, and WorkspaceStore for proper resource cleanup
- Truncate HTTP error response text to 1000 characters to prevent excessive error messages
- Add message queue overflow error emission when pending sends exceed limit
- Export FileOutputType from protocol for type safety
- Refactor extractPhaseInfo to use proper type guards instead of any casts
- Add type guard isFileOutputType for safer file
…ering

- Add detectBlankScreenshot utility with entropy-based analysis to identify blank/uniform screenshots
- Implement retry mechanism with exponential backoff (3 total attempts) for screenshot capture
- Add SCREENSHOT_CONFIG with configurable timeouts, retry delays, and detection thresholds
- Change waitUntil from networkidle0 to networkidle2 and add 2s post-load wait for better page stability
- Refactor captureScreenshot into
Feat: improve SDK error handling and resource cleanup
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Feat: add retry logic and blank screenshot detection for browser rendering
- Add retry module with configurable retry behavior (enabled, delays, max retries)
- Implement exponential backoff with ±20% jitter to prevent thundering herds
- Add HTTP-specific retry defaults (3 retries, 1s-10s delays) vs WebSocket defaults (infinite retries, 1s-30s delays)
- Retry on 5xx server errors and network failures (TypeError), skip 4xx client errors
- Refactor WebSocket connection to use shared retry utilities
- Add comprehensive
@AshishKumar4 AshishKumar4 requested a review from Copilot December 19, 2025 23:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Major release merging nightly changes to main, introducing an encrypted User Secrets Vault system with client-side cryptography, enhanced CI/CD workflows with AI-powered automation, React safety gate static analysis, and improved process monitoring with better health checks.

Key Changes

  • New encrypted User Secrets Vault with Argon2id/WebAuthn PRF key derivation and zero-knowledge server storage
  • AI-powered CI/CD workflows including changelog generation, automated issue fixing, and enhanced code review
  • AST-based static analysis safety gate for React antipatterns
  • Feature registry system supporting presentations and general-purpose code generation

Reviewed changes

Copilot reviewed 139 out of 305 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/routes/home.tsx Updated to use ProjectModeSelector and handle mode capabilities from feature system
src/routes/discover/index.tsx Added error logging for localStorage persistence failures
src/routes/chat/utils/message-helpers.ts Added queue status fields to ChatMessage type
src/routes/chat/utils/handle-websocket-message.ts Extended WebSocket message handling with vault, template, and presentation support
src/routes/chat/utils/file-state-helpers.ts Updated FileType import to centralized api-types
src/routes/chat/hooks/use-chat.ts Refactored to support multiple project types and behavior modes
src/routes/chat/components/*.tsx New modular components for view management and presentation features
src/routes/chat/chat.tsx Major refactor integrating feature system and vault unlock flow
src/lib/vault-crypto.ts Browser-side cryptography implementation for vault system
src/lib/api-client.ts Added vault and capabilities API endpoints
src/features/* New feature registry system with lazy-loaded modules
src/contexts/vault-context.tsx Vault state management with WebSocket session handling
src/hooks/use-copy-to-clipboard.ts Reusable clipboard copy hook with feedback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…king to SDK

- Add BlueprintStreamParser for handling streaming JSON/Markdown blueprint chunks with graceful partial JSON parsing
- Add blueprintToMarkdown utility to convert Blueprint objects to formatted Markdown
- Add ConnectionState tracking ('disconnected' | 'connecting' | 'connected') to SessionState
- Track filesGenerated count and currentFile path during generation phases
- Add withTimeout utility and TimeoutError for operation
@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

Claude finished @AshishKumar4's task in 2m 2s —— View job


Code Quality & Security Review

Recommendation: APPROVE

PR Summary

Major release merging nightly changes to main, introducing an encrypted User Secrets Vault system with client-side cryptography (Argon2id/WebAuthn PRF), enhanced CI/CD workflows with security gating, AST-based React safety analysis, and improved process monitoring with HTTP health probes.

PR Description

  • Updated: no (already comprehensive)
  • Notes: The existing PR description is thorough and covers all major changes, breaking changes, and testing instructions.

Addressed Issues

  • Addresses security improvements across the platform (as noted in PR)
  • Previous security scanning alerts have been resolved

Code Quality

  • Critical: None
  • High: None
  • Medium: 1 (Type assertion pattern in SDK - see below)
  • Low: None

Security

  • Critical: None
  • High: None
  • Medium: 1 (Workflow interpolation - defense in depth only)
  • Low: None

Detailed Findings

Vault Crypto - RNG Bias Fix (RESOLVED)

The generateRecoveryCodes function in src/lib/vault-crypto.ts:208-260 now correctly uses rejection sampling to avoid modulo bias. The implementation calculates maxUnbiased = range - (range % alphabetLength) and discards values >= maxUnbiased. This is cryptographically sound.

SDK Type Safety (MEDIUM)

The extractPhaseInfo helper in sdk/src/state.ts:64-70 uses a type assertion pattern:

const phase = (msg as { phase?: { name?: string; description?: string } } | undefined)?.phase;

This is NOT an any type violation - it's a constrained assertion. However, the underlying issue is that WsMessageOf<'phase_generated'> doesn't include the phase property in its type definition. Consider adding this to the protocol types for full type safety.

Workflow Security (MEDIUM - Defense in Depth)

In .github/workflows/claude-reviews.yml:50, the PR_HEAD_REF value is stored as an environment variable, which is safer than direct interpolation. The existing security gating (fork detection at line 112-114, collaborator checks at line 59-66) provides strong protection against untrusted actors.

For maximum safety, consider using toJSON() escaping:

PR_HEAD_REF: ${{ toJSON(github.event.pull_request.head.ref || '') }}

This is a defense-in-depth recommendation only - the current implementation is reasonably secure.

Vault Implementation Review

  • src/contexts/vault-context.tsx (910 lines): Well-structured with proper WebSocket session management, VMK derivation, and session storage
  • Uses Argon2id (PHC recommendations: time=3, mem=64MB, parallelism=4) for password-based key derivation
  • WebAuthn PRF with HKDF-SHA256 for passkey-based derivation
  • AES-256-GCM for encryption with random 12-byte nonces
  • Recovery codes encrypted with VMK for secure storage

Process Monitor Review

  • container/process-monitor.ts (1300+ lines): Robust implementation with:
    • CircularBuffer for O(1) log buffering
    • SimpleMutex and FileLock for thread/process safety
    • HTTP probe health checks (replaces lsof)
    • Port failure threshold tracking (2 consecutive failures trigger restart)
    • Stability threshold for restart counter reset (5 minutes)
    • Proper signal handling with process group kills (detached mode)

Database Migration

  • migrations/0004_calm_omega_flight.sql: Drops user_secrets table (data migrated to Durable Object), removes FK constraint from user_model_providers. Breaking change is documented.

CI/CD Workflows

  • claude-issue-autofix.yml: Proper security gating with:
    • Explicit approval via label (claude-fix-approved) or command (/claude fix)
    • Trusted actor verification (admin/maintain only)
    • .github/ modification blocking
    • Limited tool access (Read, Edit, Write only)

Testing

  • Run bun run test to execute all tests including vault and monitor suites
  • Manual testing recommended for vault setup/unlock flows

Final Recommendation

Approve - This is a well-structured release with security-focused improvements. The vault implementation follows cryptographic best practices, the process monitor is robust, and the CI/CD workflows have appropriate security gating. The identified issues are minor type safety improvements that don't affect functionality or security.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent ci/cd database dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation frontend size/XL worker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant