Conversation
… for easier debugging (#593) * added more granular error logs for function execution * added tests * fixed syntax error reporting
* improvement: added knowledge upload * improvement: added greptile comments (#579) * improvement: changed to text to doc (#579) * improvement: removed comment (#579) * added input validation, tested persistence of KB selector * update docs --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: Waleed Latif <walif6@gmail.com>
…olumn in any routes (#586) * fix(remove workflow.state usage): no more usage of deprecated state col in routes * fix lint * fix chat route to only use deployed state * fix lint * better typing * remove useless logs * fix lint * restore workflow handler file * removed all other usages of deprecated 'state' column from workflows table, updated tests --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-MacBook-Air.local> Co-authored-by: Waleed Latif <walif6@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan>
…inputs to execute (#598)
* feat(billing): added migrations for usage-based billing * lint * lint
* feat(logging): add new schemas + types for logging * fix lint * update migration * fix lint * Remove migration 48 to avoid conflict with staging * fixed merge conflict * fix lint --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-Air.attlocal.net>
) * fix(createWorkflow): no more client side id, duplicate schedules calls * fix lint * more cleanup * fix lint * fix spamming of create button causing issues * fix lint * add more colors + default workflow name changed * Update apps/sim/stores/workflows/registry/utils.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-Air.attlocal.net> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* fix: added proper markdown * fix: reverted route.ts file --------- Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
* fix(kb-upload): fix and consolidate logic * fix lint * consolidated presigned routes, fixed temp id kb store issue, added nav to next/prev chunk on edit chunk modal * fix ci test --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan> Co-authored-by: Waleed Latif <walif6@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
✅ No security or compliance issues detected. Reviewed everything up to ce0a71d. Security Overview
Detected Code Changes
Reply to this PR with |
There was a problem hiding this comment.
PR Summary
Major architectural improvements focusing on normalized database tables, improved error handling, and enhanced logging systems for workflow execution.
- Replaced monolithic workflow state with normalized tables (
workflowExecutionBlocks,workflowExecutionLogs,workflowExecutionSnapshots) inapps/sim/db/migrations/0049_fancy_cardiac.sqlfor better performance and maintainability - Enhanced function execution error reporting with line numbers and context in
apps/sim/tools/function/execute.ts - Added temperature controls (0-2 range) for GPT-4.1 series models in
apps/sim/providers/models.ts - Implemented comprehensive usage tracking and billing system with new columns in
apps/sim/db/migrations/0048_flawless_ultron.sql - Added document creation capabilities to knowledge base with new
knowledgeCreateDocumentToolinapps/sim/tools/knowledge/create_document.ts
56 files reviewed, 42 comments
Edit PR Review Bot Settings | Greptile
| folderId: null, | ||
| name: 'Workflow 1', | ||
| name: 'default-agent', | ||
| description: 'Your first workflow - start building here!', |
There was a problem hiding this comment.
style: Description still references 'first workflow' which doesn't match the new 'default-agent' name convention
| test('should handle enhanced runtime error with line and column', async () => { | ||
| // Setup enhanced runtime error response | ||
| tester.setup( | ||
| { | ||
| success: false, | ||
| error: | ||
| "Type Error: Line 2:16: `return obj.someMethod();` - Cannot read properties of null (reading 'someMethod')", | ||
| output: { | ||
| result: null, | ||
| stdout: 'ERROR: {}\n', | ||
| executionTime: 12, | ||
| }, | ||
| debug: { | ||
| line: 2, | ||
| column: 16, | ||
| errorType: 'TypeError', | ||
| lineContent: 'return obj.someMethod();', | ||
| stack: 'TypeError: Cannot read properties of null...', | ||
| }, | ||
| }, | ||
| { ok: false, status: 500 } | ||
| ) | ||
|
|
||
| // Execute the tool with runtime error | ||
| const result = await tester.execute({ | ||
| code: 'const obj = null;\nreturn obj.someMethod();', | ||
| }) | ||
|
|
||
| // Check enhanced error handling | ||
| expect(result.success).toBe(false) | ||
| expect(result.error).toContain('Type Error') | ||
| expect(result.error).toContain('Line 2:16') | ||
| expect(result.error).toContain('return obj.someMethod();') | ||
| expect(result.error).toContain('Cannot read properties of null') | ||
| }) |
There was a problem hiding this comment.
style: Consider extracting the test setup into a shared helper function since similar setup patterns are repeated across multiple tests
| | `knowledgeBaseId` | string | Yes | ID of the knowledge base containing the document | | ||
| | `name` | string | Yes | Name of the document | | ||
| | `content` | string | Yes | Content of the document | |
There was a problem hiding this comment.
style: knowledgeBaseId parameter description should clarify whether this is for new or existing knowledge bases
| ALTER TABLE "user_stats" ADD COLUMN "usage_limit_updated_at" timestamp DEFAULT now();--> statement-breakpoint | ||
| ALTER TABLE "user_stats" ADD COLUMN "current_period_cost" numeric DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
| ALTER TABLE "user_stats" ADD COLUMN "billing_period_start" timestamp DEFAULT now();--> statement-breakpoint | ||
| ALTER TABLE "user_stats" ADD COLUMN "billing_period_end" timestamp;--> statement-breakpoint |
There was a problem hiding this comment.
logic: billing_period_end allows NULL but billing_period_start doesn't. Consider if both should require values for data consistency.
| | `data` | string | | ||
| | `name` | string | |
There was a problem hiding this comment.
logic: Output parameters 'data' and 'name' need more detailed type specifications and descriptions
| // Mock normalized tables helper for this specific test | ||
| vi.doMock('@/lib/workflows/db-helpers', () => ({ | ||
| loadWorkflowFromNormalizedTables: vi.fn().mockResolvedValue({ | ||
| blocks: { | ||
| 'starter-id': { | ||
| id: 'starter-id', | ||
| type: 'starter', | ||
| name: 'Start', | ||
| position: { x: 100, y: 100 }, | ||
| enabled: true, | ||
| subBlocks: {}, | ||
| outputs: {}, | ||
| data: {}, | ||
| }, | ||
| 'agent-id': { | ||
| id: 'agent-id', | ||
| type: 'agent', | ||
| name: 'Agent', | ||
| position: { x: 300, y: 100 }, | ||
| enabled: true, | ||
| subBlocks: {}, | ||
| outputs: {}, | ||
| data: {}, | ||
| }, | ||
| }, | ||
| edges: [ | ||
| { | ||
| id: 'edge-1', | ||
| source: 'starter-id', | ||
| target: 'agent-id', | ||
| sourceHandle: 'source', | ||
| targetHandle: 'target', | ||
| }, | ||
| ], | ||
| loops: {}, | ||
| parallels: {}, | ||
| isFromNormalizedTables: true, | ||
| }), | ||
| })) |
There was a problem hiding this comment.
style: Duplicate mock definition of loadWorkflowFromNormalizedTables. Extract into a shared test helper to maintain DRY principle
| processingOptions: { | ||
| chunkSize: 1024, | ||
| minCharactersPerChunk: 100, | ||
| chunkOverlap: 200, | ||
| recipe: 'default', | ||
| lang: 'en', | ||
| }, |
There was a problem hiding this comment.
style: Processing options should be extracted to a config file rather than hardcoded in the component
| const utf8Bytes = new TextEncoder().encode(textContent) | ||
| const base64Content = | ||
| typeof Buffer !== 'undefined' | ||
| ? Buffer.from(textContent, 'utf8').toString('base64') | ||
| : btoa(String.fromCharCode(...utf8Bytes)) | ||
|
|
There was a problem hiding this comment.
style: Redundant encoding - TextEncoder is already used for contentBytes. Can reuse utf8Bytes for Buffer.from
| documentId: firstDocument?.documentId || firstDocument?.id || '', | ||
| }, | ||
| } | ||
| } catch (error: any) { |
There was a problem hiding this comment.
style: Avoid using 'any' type for error. Consider using Error | unknown
| } catch (error: any) { | |
| } catch (error: Error | unknown) { |
| "checkConstraints": { | ||
| "check_enterprise_metadata": { | ||
| "name": "check_enterprise_metadata", | ||
| "value": "plan != 'enterprise' OR (metadata IS NOT NULL AND (metadata->>'perSeatAllowance' IS NOT NULL OR metadata->>'totalAllowance' IS NOT NULL))" | ||
| } |
There was a problem hiding this comment.
logic: Subscription plan constraint requires either perSeatAllowance or totalAllowance for enterprise plans, ensure this is handled in application code
* feat(function): added more granular error logs for function execution for easier debugging (simstudioai#593) * added more granular error logs for function execution * added tests * fixed syntax error reporting * feat(models): added temp controls for gpt-4.1 family of models (simstudioai#594) * improvement(knowledge-upload): create and upload document to KB (simstudioai#579) * improvement: added knowledge upload * improvement: added greptile comments (simstudioai#579) * improvement: changed to text to doc (simstudioai#579) * improvement: removed comment (simstudioai#579) * added input validation, tested persistence of KB selector * update docs --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: Waleed Latif <walif6@gmail.com> * fix(remove workflow.state usage): no more usage of deprecated state column in any routes (simstudioai#586) * fix(remove workflow.state usage): no more usage of deprecated state col in routes * fix lint * fix chat route to only use deployed state * fix lint * better typing * remove useless logs * fix lint * restore workflow handler file * removed all other usages of deprecated 'state' column from workflows table, updated tests --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-MacBook-Air.local> Co-authored-by: Waleed Latif <walif6@gmail.com> * fix(doc-selector-kb): enable doc selector when kb is selected (simstudioai#596) Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan> * fix(unload): remove beforeunload warning since we communicate via wss (simstudioai#597) * fix(executor): fix dependency resolution, allow blocks with multiple inputs to execute (simstudioai#598) * feat(billing): added migrations for usage-based billing (simstudioai#601) * feat(billing): added migrations for usage-based billing * lint * lint * feat(logging): add new schemas + types for new logging system (simstudioai#599) * feat(logging): add new schemas + types for logging * fix lint * update migration * fix lint * Remove migration 48 to avoid conflict with staging * fixed merge conflict * fix lint --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-Air.attlocal.net> * fix(createWorkflow): cleanup create workflow to prevent re-renders (simstudioai#607) * fix(createWorkflow): no more client side id, duplicate schedules calls * fix lint * more cleanup * fix lint * fix spamming of create button causing issues * fix lint * add more colors + default workflow name changed * Update apps/sim/stores/workflows/registry/utils.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-Air.attlocal.net> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * fix(telegram): added markdown text rendering (simstudioai#611) * fix: added proper markdown * fix: reverted route.ts file --------- Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local> * fix(kb-upload): fix and consolidate KB file uploads logic (simstudioai#610) * fix(kb-upload): fix and consolidate logic * fix lint * consolidated presigned routes, fixed temp id kb store issue, added nav to next/prev chunk on edit chunk modal * fix ci test --------- Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan> Co-authored-by: Waleed Latif <walif6@gmail.com> --------- Co-authored-by: Waleed Latif <walif6@gmail.com> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-MacBook-Air.local> Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan> Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-Air.attlocal.net> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
Description
Changelog:
Type of change
Please delete options that are not relevant.
Checklist:
bun run test)Security Considerations: