fix: display llm robot create on reload or tab switch#1113
Conversation
WalkthroughThe PR adds a ChangesCreating status workflow for LLM robots
Sequence DiagramsequenceDiagram
participant Client
participant CreateRoute as CreateRobotRoute
participant RobotDB as Robot DB
participant Enricher as WorkflowEnricher
Client->>CreateRoute: POST LLM robot creation
CreateRoute->>RobotDB: create stub<br/>(status=creating)
CreateRoute->>Enricher: generateWorkflow
Enricher-->>CreateRoute: workflow result
alt workflow success
CreateRoute->>RobotDB: update stub<br/>(status=ready, url, pairs)
CreateRoute-->>Client: return ready robot
else workflow failure
CreateRoute->>RobotDB: destroy stub
CreateRoute-->>Client: 400 error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/src/routes/storage.ts (1)
792-795: 💤 Low valueAdd warning log when stub cleanup fails.
Silently swallowing the destroy error makes debugging harder if cleanup consistently fails. Consider logging a warning before rethrowing the original error.
💡 Suggested improvement
} catch (llmError) { - try { await stubRobot.destroy(); } catch (_) {} + try { await stubRobot.destroy(); } catch (cleanupErr) { + logger.log('warn', `Failed to cleanup stub robot ${stubRobot.id} after LLM error: ${cleanupErr}`); + } throw llmError; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/src/routes/storage.ts` around lines 792 - 795, In the catch block that handles the stubRobot.destroy() error (the inner try-catch where the error is currently being silently swallowed), add a warning log statement that captures and logs the destroy error before swallowing it. This will help with debugging if cleanup consistently fails while still preserving the original llmError being rethrown. Update the empty catch handler to log the destroy failure with appropriate context before continuing with the error handling flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@server/src/routes/storage.ts`:
- Around line 792-795: In the catch block that handles the stubRobot.destroy()
error (the inner try-catch where the error is currently being silently
swallowed), add a warning log statement that captures and logs the destroy error
before swallowing it. This will help with debugging if cleanup consistently
fails while still preserving the original llmError being rethrown. Update the
empty catch handler to log the destroy failure with appropriate context before
continuing with the error handling flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 44224c54-1437-4133-8dca-b54418c9dedc
📒 Files selected for processing (2)
server/src/models/Robot.tsserver/src/routes/storage.ts
✅ Files skipped from review due to trivial changes (1)
- server/src/models/Robot.ts
Previously, the creation state of an LLM robot was stored only in memory, causing the creation placeholder to disappear if the page was reloaded or the user switched tabs during creation.
This PR persists the robot in the database with a
creatingstate, ensuring the creation placeholder remains visible until the robot is fully created.Summary by CodeRabbit
New Features
Refactor