Repository navigation
fix: Add missing Switch UI component - #564
Conversation
- Exclude langfuse credentials from version control - Ignore tar.gz build artifacts - Add example template for langfuse configuration Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Complete SDK configuration system with documentation, tests, and UI: - Comprehensive SDK documentation (usage, reference, upgrade guides) - AG-UI optimization playbook - Amber skill for SDK expertise - Integration smoketest suite (8 test classes) - SDK configuration loader for runner - Backend API handlers for SDK configuration - Frontend configuration UI panel - Move all SDK docs to docs/sdk-expert/ and docs/claude-agent-sdk/ Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Proposes implementing Amber background agent using LangGraph for: - Stateful workflow orchestration - Human-in-the-loop approvals - Error resilience with retry policies - Multi-mode operation (on-demand, background, scheduled, webhook) Architecture integrates with AgenticSession CRDs, PostgreSQL checkpointing, and GitHub API via MCP or PyGithub. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Analysis of 12 high-value skill opportunities for the platform: - Top 4 recommended skills (Operator, GitLab, Backend, Amber) - Quick wins from existing documentation - ROI calculation and success metrics - Implementation plan and resource requirements Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Analysis of what makes the codebase LLM-friendly and improvement opportunities: - Rating: 9.2/10 for LLM-readiness - Strengths: .claude/ context, ADRs, skill system - Improvement opportunities: inline docs, trigger comments, task nav Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add Shadcn Switch component required by SDKConfigurationPanel. Update tsconfig.json with Next.js automatic React JSX runtime. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
not sure how this happened but it didnt commit one file of a feature im working on. so here i is. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Claude Code ReviewSummaryThis PR adds the missing Shadcn Switch component and updates tsconfig.json to fix a runtime issue where SDKConfigurationPanel.tsx (committed in 35da252) was importing a non-existent component. The code quality is generally high with proper Shadcn UI patterns and type safety. However, there are critical security issues in the backend that must be addressed before merging. Issues by Severity🚫 Blocker Issues1. Backend VIOLATES User Token Authentication Pattern (sdk_config.go) Lines 42-70, 136-178: Handler functions are missing user token authentication entirely. // ❌ CRITICAL SECURITY VIOLATION
func GetSDKConfiguration(c *gin.Context) {
projectName := c.Param("project")
userID := c.GetString("user_id") // From auth middleware - NOT VERIFIED
// ... directly queries database without user token verification
}Required pattern (per CLAUDE.md:435-439, k8s-client-usage.md:18-24): func GetSDKConfiguration(c *gin.Context) {
projectName := c.Param("project")
// REQUIRED: Get user-scoped clients to verify auth
reqK8s, reqDyn := GetK8sClientsForRequest(c)
if reqK8s == nil {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Invalid or missing token"})
c.Abort()
return
}
// Then perform RBAC check before database access
// ... rest of handler
}Impact: Bypasses authentication entirely. Any request with a spoofed user_id header can read/write SDK configurations for any user. Affected functions: GetSDKConfiguration, UpdateSDKConfiguration, GetSDKConfigForSession 2. Missing RBAC Authorization Checks (sdk_config.go) All handlers assume the user has permission without verification. Per security-standards.md:52-70, RBAC checks are REQUIRED before operations. // REQUIRED: Add before database access
ssar := &authv1.SelfSubjectAccessReview{
Spec: authv1.SelfSubjectAccessReviewSpec{
ResourceAttributes: &authv1.ResourceAttributes{
Resource: "namespaces",
Verb: "get",
Name: projectName,
},
},
}
res, err := reqK8s.AuthorizationV1().SelfSubjectAccessReviews().Create(ctx, ssar, v1.CreateOptions{})
if err \!= nil || \!res.Status.Allowed {
c.JSON(http.StatusForbidden, gin.H{"error": "Access denied to project"})
return
}3. Database Dependency Not Initialized (sdk_config.go:47) db := c.MustGet("db").(*gorm.DB) // ❌ Will panic if DB not in contextIssues:
Required:
🔴 Critical Issues4. Manual fetch() in Frontend Component (SDKConfigurationPanel.tsx:80-88, 98-111) VIOLATES frontend-development.md:18-34, react-query-usage.md:1-10 // ❌ FORBIDDEN: Manual fetch in component
const loadConfiguration = async () => {
try {
const response = await fetch('/api/sdk/configuration');
// ...
} catch (error) { /* ... */ }
};Required pattern (per react-query-usage.md:34-46): // services/queries/sdk-config.ts
export function useSDKConfiguration(projectName: string) {
return useQuery({
queryKey: ["sdk-config", projectName],
queryFn: () => sdkConfigApi.get(projectName),
staleTime: 5000,
});
}
// Then in component:
const { data: config, isLoading, error } = useSDKConfiguration(projectName);5. Inconsistent Error Handling (sdk_config.go) Lines 59-62, 108-111: Generic error messages without logging context (violates error-handling.md:49-65) // ❌ BAD: No logging, generic message
if err \!= nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve configuration"})
return
}
// ✅ REQUIRED:
if err \!= nil {
log.Printf("Failed to retrieve SDK config for project %s, user %s: %v", projectName, userID, err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve configuration"})
return
}6. Python SDK Loader Uses Synchronous urllib (sdk_config.py:44) # ❌ Blocks event loop in async function
with _urllib_request.urlopen(req, timeout=10) as resp:
data = resp.read().decode('utf-8')Required: Use async HTTP client (aiohttp, httpx) to avoid blocking the event loop. 🟡 Major Issues7. Missing Input Validation (sdk_config.go:143-150) GetSDKConfigForSession queries database without validating sessionID format. Could lead to SQL injection if not properly escaped by GORM. Recommendation: Add validation before database queries. 8. Incomplete MCP Test Implementation (sdk_config.go:265-269) func testMCPServerConnection(config MCPServerConfig) bool {
// TODO: Implement actual MCP server connectivity test
return strings.TrimSpace(config.Command) \!= ""
}Impact: Users get false positive "Connected" status. Should either implement or remove the test feature. 9. Frontend Uses const name = prompt('Enter MCP server name:'); // ❌ Poor UXRecommendation: Use Shadcn Dialog component with proper form validation. 10. Missing API Routes Registration No evidence in the PR of route registration for new handlers. Need to add to routes.go: r.GET("/api/projects/:project/sdk/configuration", ValidateProjectContext(), GetSDKConfiguration)
r.PUT("/api/projects/:project/sdk/configuration", ValidateProjectContext(), UpdateSDKConfiguration)
// ... etc🔵 Minor Issues11. Switch Component Missing TypeScript Type Safety (switch.tsx:12-13) size?: "sm" | "default" // ✅ Good
// But props spread lacks proper type constraintsSuggestion: Consider adding explicit type for remaining props if needed. 12. tsconfig.json Change Rationale Unclear Changed 13. Python Loader Merges System Prompt Naively (sdk_config.py:127-133) merged_prompt = f"{existing_prompt}\n\n## Custom Instructions\n{custom_prompt}"Could lead to prompt injection if custom_prompt contains malicious instructions. Consider sanitization or template-based approach. Positive Highlights✅ Switch component follows Shadcn UI patterns perfectly (switch.tsx:1-35)
✅ Comprehensive validation in backend (sdk_config.go:197-263)
✅ Frontend component structure is well-organized (SDKConfigurationPanel.tsx)
✅ Python loader has good error handling (sdk_config.py:49-52)
RecommendationsImmediate Actions (Required for Merge)
Follow-up Improvements
Security Checklist (from security-standards.md)Authentication:
Authorization:
Input Validation:
VerdictDO NOT MERGE until blocker issues #1, #2, #3 are resolved. The missing authentication and RBAC checks represent critical security vulnerabilities that bypass the platform's multi-tenant isolation model. The Switch component itself is perfect and ready to merge. The security issues are entirely in the backend handlers that were part of the larger SDK feature (commit 35da252). Recommended approach:
🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
## Summary Reverts PR #564 which accidentally included 27 files with 10,149 additions instead of just the Switch component. ## What was reverted PR #564 was supposed to add only: - `switch.tsx` component - `tsconfig.json` update But it actually included: - SDK expert system files - SDK configuration UI - Integration tests - ADR documentation - Skill analysis docs - .gitignore changes - Many other unrelated files (27 files total) ## Files removed by this revert - .ambient/skills/claude-sdk-expert/ - components/backend/pkg/handlers/sdk_config.go - components/frontend/src/components/settings/SDKConfigurationPanel.tsx - components/frontend/src/components/ui/switch.tsx - components/runners/claude-code-runner/INTEGRATION.md - components/runners/claude-code-runner/sdk_config.py - docs/adr/0006-amber-langgraph-implementation.md - docs/analysis/llm-effectiveness-analysis.md - docs/claude-agent-sdk/ - docs/sdk-expert/ - docs/skills/ - e2e/scripts/langfuse-credentials.env.example - And more... These changes should be submitted in separate, focused PRs if needed. 🤖 Generated with Claude Code
## SDK Version Bump - `claude-agent-sdk`: 0.2.139 -> 0.2.157 - `anthropic`: 0.122.0 -> 1.7.0 ### TL;DR - **3 migration(s) required** (deprecated APIs — see Action Items) - **1 opt-in feature(s)** available for adoption - 3 behavior change(s) to review - 33 new feature(s), 36 bug fix(es) ## Action Items - **MIGRATE** — **add group with display_name to rate limits, deprecate group_type** (`anthropic` v1.7.0): add group with display_name to rate limits, deprecate group_type - **MIGRATE** — **client** (`anthropic` v1.5.0): keep the idempotency_key request option as a deprecated no-op (#621) - **MIGRATE** — **client** (`anthropic` v1.0.0): upgrade to httpx2 and some minor breaking changes. See MIGRATION.md for details **Opt-in features to evaluate:** - [ ] **`snapshot` option for system prompts** (`claude-agent-sdk` v0.2.153): Added a `snapshot` field to `SystemPromptPreset` and a new `SystemPromptCustom` typed dict. When... ## Behavior Changes | Change | Package | Version | Action | |--------|---------|---------|--------| | **MCP 2.x support for in-process SDK MCP servers** | `claude-agent-sdk` | 0.2.140 | Review | | **`ResultError` exception with structured error payload** | `claude-agent-sdk` | 0.2.140 | Review | | **client** | `anthropic` | 1.0.0 | Review | <details><summary><strong>New Features</strong> (33)</summary> | Feature | Package | Version | Claude | Gemini | Default | Action | |---------|---------|---------|--------|--------|---------|--------| | **`snapshot` option for system prompts** | `claude-agent-sdk` | 0.2.153 | Yes | - | Opt-in | Opt-in | | **`forward_subagent_text` option** | `claude-agent-sdk` | 0.2.140 | Yes | - | Available | Review | | **`can_use_tool` callback support for `query()` and string prompts** | `claude-agent-sdk` | 0.2.140 | Yes | - | Available | Review | | **add group with display_name to rate limits, deprecate group_type** | `anthropic` | 1.7.0 | - | - | Available | Migrate | | **tools** | `anthropic` | 1.7.0 | Yes | - | Available | Review | | **add auto mode tool permissions for Managed Agents** | `anthropic` | 1.6.0 | - | - | Available | Review | | **add compaction parameter and signed compaction blocks (beta)** | `anthropic` | 1.6.0 | - | - | Available | Review | | **add enum types for workspace data-residency geo fields** | `anthropic` | 1.6.0 | - | - | Available | Review | | **add thinking_mismatch_allowed entries to input_transformations (beta)** | `anthropic` | 1.6.0 | Yes | - | Available | Review | | **add url_sources to the web fetch tool** | `anthropic` | 1.6.0 | - | - | Available | Review | | **add workspace_id parameter to user profiles methods** | `anthropic` | 1.6.0 | - | - | Available | Review | | **client** | `anthropic` | 1.6.0 | - | - | Available | Review | | **add auto mode tool permissions for Managed Agents** | `anthropic` | 1.5.0 | - | - | Available | Review | | **add content_too_large web_fetch tool error code** | `anthropic` | 1.5.0 | - | - | Available | Review | | **add the user-profiles-2026-09-04 beta value and external_user_details to user...** | `anthropic` | 1.5.0 | - | - | Available | Review | | **support mounting public GitHub repositories without an authorization_token in...** | `anthropic` | 1.5.0 | Yes | - | Available | Review | | **client** | `anthropic` | 1.5.0 | - | - | Available | Review | | **credentials** | `anthropic` | 1.5.0 | - | - | Available | Review | | **tools** | `anthropic` | 1.5.0 | - | - | Available | Review | | **add Claude Tag category and user breakdowns to usage reports** | `anthropic` | 1.4.0 | Yes | - | Available | Review | | **add named types for organization compliance settings state** | `anthropic` | 1.4.0 | - | - | Available | Review | | **add support for sending a workspace ID on more endpoints** | `anthropic` | 1.4.0 | - | - | Available | Review | | **beta user profiles: add external_user_onboarded_at, remove relationship in fa...** | `anthropic` | 1.3.0 | - | - | Available | Review | | **organization compliance settings, user-profile order_by, memory-store and too...** | `anthropic` | 1.3.0 | - | - | Available | Review | | **beta files/skills namespaces use GA shapes; drop dated beta header pins** | `anthropic` | 1.2.0 | - | - | Available | Review | | **add `updates` thinking display mode (beta)** | `anthropic` | 1.1.0 | Yes | - | Available | Review | | **add missing anthropic-beta values** | `anthropic` | 1.1.0 | Yes | - | Available | Review | | **add support for Organization API endpoints** | `anthropic` | 1.1.0 | - | - | Available | Review | | **managed agents web search config and self hosted sandbox memory** | `anthropic` | 0.125.0 | - | - | Available | Review | | **Files and Skills APIs are now GA; add computer use and browser use toolsets** | `anthropic` | 0.124.0 | - | - | Available | Review | | **additions to files and memory stores** | `anthropic` | 0.123.0 | - | - | Available | Review | | **updates to skill, files, and user profiles** | `anthropic` | 0.123.0 | - | - | Available | Review | | **client** | `anthropic` | 0.123.0 | - | - | Available | Review | </details> <details><summary><strong>Bug Fixes</strong> (36)</summary> - **Recover `parent_tool_use_id` when reading subagent transcripts** (`claude-agent-sdk` 0.2.140): `get_subagent_messages()` and `get_subagent_messages_from_store()` now recover the `parent_tool_use_id` from the suba... - **bedrock** (`anthropic` 1.7.0): raise an API error for eventstream exception and error frames (#769) - **client** (`anthropic` 1.7.0): accept `X | Y` union types when parsing responses - **client** (`anthropic` 1.7.0): don't raise TypeError for `X | Y` fields with unknown data - **client** (`anthropic` 1.7.0): join multiple anthropic-beta values with a comma and no space (#781) - **tools** (`anthropic` 1.7.0): tidy compact_before_next_turn() state and failure handling (#804) - **mark usage iteration model as nullable** (`anthropic` 1.6.0): mark usage iteration model as nullable - **use one input transformation type for message and delta event** (`anthropic` 1.6.0): use one input transformation type for message and delta event - **client** (`anthropic` 1.6.0): honor Retry-After values above 60 seconds - **client** (`anthropic` 1.6.0): ignore invalid Retry-After values and validate maxRetries - **client** (`anthropic` 1.6.0): retry connection errors in the async client and stop blocking in the coroutine retry loop - **client** (`anthropic` 1.6.0): use the default backoff when Retry-After is out of range - **client** (`anthropic` 1.5.0): merge extra_body before client hooks run - **credentials** (`anthropic` 1.5.0): refuse credentials files accessible by group or others - **streaming** (`anthropic` 1.5.0): keep partial tool input JSON off content blocks - **types** (`anthropic` 1.5.0): leave parsed_output out of dumped text blocks - **client** (`anthropic` 1.4.0): raise a clear error when an httpx object is passed instead of an httpx2 one - **repair custom-code merge in messages resources** (`anthropic` 1.4.0): repair custom-code merge in messages resources (#580) - **aws** (`anthropic` 1.3.0): resolve base_url from aws_region under skip_auth and with_options (#564) - **batches** (`anthropic` 1.3.0): add results to GA raw/streaming response wrappers - **client** (`anthropic` 1.3.0): derive multipart filename for file tuples passed without one - **types** (`anthropic` 1.3.0): remove unused wire aliases from header and path params - **aws,bedrock** (`anthropic` 1.2.0): sign raw request bytes so binary file uploads work (#531) - **sessions** (`anthropic` 1.2.0): make event accumulator forward-compatible with new event types (#533) - **tools** (`anthropic` 1.2.0): let read return a view_range of a file over the size cap (#538) - **tools** (`anthropic` 1.2.0): preserve exact file bytes in the agent toolset and memory tool (no newline translation) (#540) - **webhooks** (`anthropic` 1.2.0): require headers to be passed to `unwrap()` - **correct link for long requests error (4474f31), closes #1883** (`anthropic` 1.1.0): correct link for long requests error (#1884) (4474f31), closes #1883 - **tools** (`anthropic` 1.1.0): keep the tool runner going on pause_turn (#343) - **beta** (`anthropic` 1.0.0): stop warning about `output_format=` on the parse/stream/tool_runner helpers - **remove unsupported mid_conv_system content block** (`anthropic` 0.123.0): remove unsupported mid_conv_system content block - **client** (`anthropic` 0.123.0): compute platform headers without spawning a subprocess - **client** (`anthropic` 0.123.0): export custom status errors from _exceptions.__all__ (#459) - **client** (`anthropic` 0.123.0): export ServiceUnavailableError and DeadlineExceededError from the package root (#468) - **session-runner** (`anthropic` 0.123.0): retry tool-result sends for at least the lease TTL (#453) - **tools** (`anthropic` 0.123.0): run synchronous session tools in a worker thread (#399) </details> <details><summary><strong>Bundled Claude CLI Versions</strong> (17)</summary> | SDK Version | CLI Version | |-------------|-------------| | 0.2.156 | 2.1.276 | | 0.2.155 | 2.1.275 | | 0.2.154 | 2.1.274 | | 0.2.153 | 2.1.273 | | 0.2.152 | 2.1.259 | | 0.2.151 | 2.1.258 | | 0.2.150 | 2.1.257 | | 0.2.149 | 2.1.252 | | 0.2.148 | 2.1.251 | | 0.2.147 | 2.1.250 | | 0.2.146 | 2.1.248 | | 0.2.145 | 2.1.247 | | 0.2.144 | 2.1.246 | | 0.2.143 | 2.1.238 | | 0.2.142 | 2.1.237 | | 0.2.141 | 2.1.236 | | 0.2.140 | 2.1.235 | </details> <details><summary>Internal changes: <code>claude-agent-sdk</code> (17)</summary> - Updated bundled Claude CLI to version 2.1.276 (0.2.156) - Updated bundled Claude CLI to version 2.1.275 (0.2.155) - Updated bundled Claude CLI to version 2.1.274 (0.2.154) - Updated bundled Claude CLI to version 2.1.273 (0.2.153) - Updated bundled Claude CLI to version 2.1.259 (0.2.152) - Updated bundled Claude CLI to version 2.1.258 (0.2.151) - Updated bundled Claude CLI to version 2.1.257 (0.2.150) - Updated bundled Claude CLI to version 2.1.252 (0.2.149) - Updated bundled Claude CLI to version 2.1.251 (0.2.148) - Updated bundled Claude CLI to version 2.1.250 (0.2.147) - Updated bundled Claude CLI to version 2.1.248 (0.2.146) - Updated bundled Claude CLI to version 2.1.247 (0.2.145) - Updated bundled Claude CLI to version 2.1.246 (0.2.144) - Updated bundled Claude CLI to version 2.1.238 (0.2.143) - Updated bundled Claude CLI to version 2.1.237 (0.2.142) - Updated bundled Claude CLI to version 2.1.236 (0.2.141) - Updated bundled Claude CLI to version 2.1.235 (0.2.140) </details> <details><summary>Internal changes: <code>anthropic</code> (24)</summary> - add more unnecessary cast comments (1.7.0) - pass strict= to zip() in the MCP tool helpers (1.7.0) - remove an unused noqa comment from the model tests (1.7.0) - set ruff's target version to Python 3.10 (1.7.0) - sort the imports in beta_message.py (1.6.0) - remove generated file header comments (1.5.0) - restore package version (1.5.0) - restore package version (1.5.0) - stop stamping the package version into generated files (1.5.0) - bundle the mock server spec and update dev tooling (1.4.0) - clean up code comments (1.4.0) - fix mypy unreachable error in detect-breaking-changes script (1.4.0) - narrower codeowners scope (1.4.0) - revert codeowners change (1.4.0) - manual updates (1.3.0) - ci (1.3.0) - drop the unused discriminator argument from PropertyInfo (1.3.0) - drop the unused distro dependency (1.3.0) - ci (1.2.0) - cancel superseded CI runs (1.1.0) - minor workflow reformat (1.1.0) - remove the legacy response API (1.1.0) - use `import httpx2` directly instead of aliasing as httpx (1.1.0) - remove leftover prism references (0.123.0) </details> --- _Automated by `.github/workflows/sdk-version-bump.yml`_ ## SDK Options Drift ClaudeAgentOptions fields changed — sdk-options-manifest.json updated. Review backend allowlist and frontend schema for new/removed fields. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
Background
SDKConfigurationPanel.tsx (committed in 35da252) imports Switch component that was never added to the repository, causing runtime failures when the settings panel is accessed.
Test Plan
🤖 Generated with Claude Code