-
Notifications
You must be signed in to change notification settings - Fork 31
Lang graph #241
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
Lang graph #241
Conversation
- Updated Dockerfile to include retry logic for dependency downloads. - Added database initialization in main.go. - Introduced new routes for managing LangGraph workflows in routes.go. - Enhanced session handling to support workflow references and inputs in sessions.go. - Updated session types to accommodate new workflow structures in session.go. - Configured PostgreSQL environment variables in backend deployment manifest. - Added new CRD properties for workflow references and status conditions in agenticsessions-crd.yaml. This commit lays the groundwork for integrating LangGraph workflows into the backend, improving session management and database interactions.
Pull Request Review: LangGraph IntegrationThis PR adds substantial LangGraph workflow support to vTeam. I've reviewed the changes following the project's CLAUDE.md guidelines. Here's my comprehensive feedback: 🎯 SummaryThis PR adds ~4000 lines introducing:
Overall Assessment: This is a significant architectural addition that extends the platform beyond Claude-based sessions. The core design is sound, but there are several critical issues that must be addressed before merging. ❌ CRITICAL ISSUES (Must Fix)1. Merge Conflict in .gitignoreImpact: Build will fail 2. Password Hardcoded in Database Code (components/backend/server/db.go:35)pgPassword := os.Getenv("POSTGRES_PASSWORD")
if pgPassword == "" {
pgPassword = "langgraph-change-me" // ❌ INSECURE DEFAULT
}Security Risk: Default passwords are a critical vulnerability
Same issue in: components/runners/langgraph-wrapper/runner/server.py:92 3. SQL Injection via JSON Marshaling (components/backend/handlers/runs.go:47)payloadJSON, _ := json.Marshal(event.Payload) // ❌ Ignoring error
_, err := server.DB.Exec(
"INSERT INTO run_events ... VALUES ($1, $2, $3, $4, $5, $6) ...",
runID, event.Seq, event.Ts, event.Type, checkpointID, payloadJSON,
)Issues:
Fix: payloadJSON, err := json.Marshal(event.Payload)
if err != nil {
log.Printf("Failed to marshal event payload: %v", err)
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid payload"})
return
}Same pattern in: components/backend/handlers/workflows.go (multiple locations) 4. Missing Error Handling in Database OperationsMultiple locations throughout handlers/workflows.go and handlers/runs.go: json.Unmarshal(payloadJSON, &payload) // ❌ No error check (line 133)Fix: Always check unmarshal errors: if err := json.Unmarshal(payloadJSON, &payload); err != nil {
log.Printf("Failed to unmarshal payload: %v", err)
payload = map[string]interface{}{"error": "invalid payload"}
}5. No Database Connection Health CheckThe backend calls // main.go:36
if err := server.InitDB(); err != nil {
log.Fatalf("Failed to initialize database: %v", err)
}
// No Ping() or connection verificationFix in server/db.go after opening connection: if err := DB.Ping(); err != nil {
return fmt.Errorf("failed to ping database: %w", err)
}6. Dockerfile Build Workarounds Are Fragilecomponents/backend/Dockerfile:11-13: RUN GOPROXY=direct GOSUMDB=off go mod download || \
(sleep 2 && GOPROXY=direct GOSUMDB=off go mod download) || \
(sleep 5 && GOPROXY=direct GOSUMDB=off go mod download)Issues:
Better approach: # Use buildkit cache mounts for faster, more reliable builds
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
|
Code Review: LangGraph Integration PRThis is a substantial PR adding LangGraph workflow support to vTeam. Here's my detailed feedback: 🎯 Architecture & Design: Excellent ✅The integration follows a clean architecture:
Strengths:
🔒 Security Issues: CRITICAL
|
d92931a to
6e32919
Compare
LangGraph MVP Integration - Code ReviewOverviewThis PR adds LangGraph workflow support to vTeam, including workflow registration, execution orchestration, and PostgreSQL-backed checkpointing. This is a substantial feature addition with 4018 additions across 48 files. ✅ StrengthsArchitecture & Design
Code Quality
🔴 Critical Issues (Must Fix Before Merge)1. SQL Injection VulnerabilityLocation: The Recommendation: Use a proper database migration framework (golang-migrate, goose, or Atlas) instead of inline SQL. 2. Missing Authentication on Critical EndpointsLocation: The event ingestion endpoint ( Fix Required: // Add service account token validation or pod identity verification
func IngestRunEvent(c *gin.Context) {
// Verify request is from a legitimate runner pod
// Option 1: Check service account token
// Option 2: Verify source IP is from cluster
// Option 3: Use shared secret per session
}3. Panic Risk in Type AssertionsLocation: Missing null checks before type assertions. According to CLAUDE.md backend standards, you MUST use three-value returns from Example violation: // ❌ WRONG
status := obj.Object["status"].(map[string]interface{})
// ✅ CORRECT
status, found, err := unstructured.NestedMap(obj.Object, "status")
if !found || err != nil {
// handle error
}4. Database Connection Pool Not ConfiguredLocation: The Fix Required: DB.SetMaxOpenConns(25)
DB.SetMaxIdleConns(5)
DB.SetConnMaxLifetime(5 * time.Minute)5. Operator Missing RBAC for SecretsLocation: Postgres secret access mentioned in Runner pods need to read Fix Required: Either:
|
- Updated __init__.py to include a comment indicating that the file makes the app directory a Python package.
Code Review: LangGraph Integration PROverviewThis PR adds significant LangGraph workflow support to vTeam, including workflow registration, run management, event streaming, and Postgres-based state persistence. Overall, this is a substantial and well-architected feature addition. Below are my findings organized by severity. 🔴 Critical Issues1. SQL Injection Vulnerability in Event IngestionLocation: The _, err := server.DB.Exec(
"INSERT INTO run_events (run_id, seq, ts, kind, checkpoint_id, payload) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (run_id, seq) DO NOTHING",
runID, event.Seq, event.Ts, event.Type, checkpointID, payloadJSON,
)While the parameterized values are safe, ensure all table/column names are validated. The Recommendation: Add validation for 2. Missing Error Handling for JSON UnmarshalingLocation: json.Unmarshal(payloadJSON, &payload)This silently ignores errors. If the payload is corrupted, this could cause silent data loss. Recommendation: Log the error if unmarshaling fails. 3. Postgres Password in Plaintext LogsLocation: logger.info(f"Initializing PostgresSaver with DSN: {pg_dsn.replace(pg_password, '***')}")This attempts to redact the password, but Recommendation: # Extract password from DSN for redaction
import re
redacted_dsn = re.sub(r':[^:@]+@', ':***@', pg_dsn)
logger.info(f"Initializing PostgresSaver with DSN: {redacted_dsn}")
|
No description provided.