-
Notifications
You must be signed in to change notification settings - Fork 3.3k
v0.2.5: feat, improvement, fix (#595) #603
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
Conversation
waleedlatif1
commented
Jul 2, 2025
- feat(function): added more granular error logs for function execution for easier debugging (feat(function): added more granular error logs for function execution for easier debugging #593)
- feat(models): added temp controls for gpt-4.1 family of models (feat(models): added temp controls for gpt-4.1 family of models #594)
- improvement(knowledge-upload): create and upload document to KB (improvement(knowledge-upload): create and upload document to KB #579)
- fix(remove workflow.state usage): no more usage of deprecated state column in any routes (fix(remove workflow.state usage): no more usage of deprecated state column in any routes #586)
- fix(doc-selector-kb): enable doc selector when kb is selected (fix(doc-selector-kb): enable doc selector when kb is selected #596)
- fix(unload): remove beforeunload warning since we communicate via wss (fix(unload): remove beforeunload warning since we communicate via wss #597)
- fix(executor): fix dependency resolution, allow blocks with multiple inputs to execute (fix(executor): fix dependency resolution, allow blocks with multiple inputs to execute #598)
- feat(billing): added migrations for usage-based billing (feat(billing): added migrations for usage-based billing #601)
… 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>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces usage-based billing, enhanced function debugging, and significant architectural improvements to workflow execution.
- Added granular workflow execution tracking with new tables (workflow_execution_blocks, logs, snapshots) in migrations 0048-0049 for cost and token usage monitoring
- Implemented detailed function execution error reporting with line numbers, stack traces, and helpful debugging suggestions in
/api/function/execute - Added temperature controls (0-2 range) for GPT-4.1 model family in
providers/models.ts - Refactored workflow state management to use normalized tables, removing deprecated state column across all routes
- Fixed dependency resolution in
executor/index.tsto properly handle blocks with multiple inputs from inactive paths
37 files reviewed, 16 comments
Edit PR Review Bot Settings | Greptile
| state: { | ||
| blocks: workflowData.state.blocks || {}, | ||
| edges: workflowData.state.edges || [], | ||
| loops: workflowData.state.loops || {}, | ||
| parallels: workflowData.state.parallels || {}, | ||
| isDeployed: workflowData.isDeployed || false, | ||
| deployedAt: workflowData.deployedAt | ||
| ? new Date(workflowData.deployedAt) | ||
| : undefined, | ||
| }, | ||
| timestamp: Date.now(), | ||
| action: 'Loaded from database', | ||
| action: 'Loaded from database (normalized tables)', | ||
| subblockValues: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: History state now uses normalized data structure consistently. Consider extracting this state shape into a type definition to ensure consistency across the codebase
| @@ -0,0 +1,9 @@ | |||
| ALTER TABLE "user_stats" ADD COLUMN "current_usage_limit" numeric DEFAULT '5' NOT NULL;--> statement-breakpoint | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider specifying numeric precision and scale for monetary/limit values to ensure consistent handling across the platform
| const buffer = Buffer.from(base64Data, 'base64') | ||
| const result = await parseBuffer(buffer, extension) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Re-using buffer from line 352 would be more efficient than creating new Buffer instance.
| const buffer = Buffer.from(base64Data, 'base64') | |
| const result = await parseBuffer(buffer, extension) | |
| const result = await parseBuffer(buffer, extension) |
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using timestamptz instead of timestamp to handle timezone data properly
| @@ -83,6 +97,10 @@ export const functionExecuteTool: ToolConfig<CodeExecutionInput, CodeExecutionOu | |||
| }, | |||
|
|
|||
| transformError: (error: any) => { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: type 'any' should be avoided - consider creating an interface for the error object with expected properties
| transformError: (error: any) => { | |
| transformError: (error: Error & { enhancedError?: boolean; line?: number; column?: number; errorType?: string }) => { |
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Double encoding of content - already encoded in TextEncoder step, then again in Buffer/btoa
| createdAt: new Date().toISOString(), | ||
| updatedAt: new Date().toISOString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Timestamps should come from the server response rather than being generated client-side
| describe('Router downstream path activation', () => { | ||
| beforeEach(() => { | ||
| // Create router workflow with downstream connections | ||
| mockWorkflow = { | ||
| version: '1.0', | ||
| blocks: [ | ||
| { | ||
| id: 'router1', | ||
| metadata: { id: 'router', name: 'Router' }, | ||
| position: { x: 0, y: 0 }, | ||
| config: { tool: 'router', params: {} }, | ||
| inputs: {}, | ||
| outputs: {}, | ||
| enabled: true, | ||
| }, | ||
| { | ||
| id: 'api1', | ||
| metadata: { id: 'api', name: 'API 1' }, | ||
| position: { x: 0, y: 0 }, | ||
| config: { tool: 'api', params: {} }, | ||
| inputs: {}, | ||
| outputs: {}, | ||
| enabled: true, | ||
| }, | ||
| { | ||
| id: 'api2', | ||
| metadata: { id: 'api', name: 'API 2' }, | ||
| position: { x: 0, y: 0 }, | ||
| config: { tool: 'api', params: {} }, | ||
| inputs: {}, | ||
| outputs: {}, | ||
| enabled: true, | ||
| }, | ||
| { | ||
| id: 'agent1', | ||
| metadata: { id: 'agent', name: 'Agent' }, | ||
| position: { x: 0, y: 0 }, | ||
| config: { tool: 'agent', params: {} }, | ||
| inputs: {}, | ||
| outputs: {}, | ||
| enabled: true, | ||
| }, | ||
| ], | ||
| connections: [ | ||
| { source: 'router1', target: 'api1' }, | ||
| { source: 'router1', target: 'api2' }, | ||
| { source: 'api1', target: 'agent1' }, | ||
| { source: 'api2', target: 'agent1' }, | ||
| ], | ||
| loops: {}, | ||
| parallels: {}, | ||
| } | ||
|
|
||
| pathTracker = new PathTracker(mockWorkflow) | ||
| mockContext = { | ||
| workflowId: 'test-router-workflow', | ||
| blockStates: new Map(), | ||
| blockLogs: [], | ||
| metadata: { duration: 0 }, | ||
| environmentVariables: {}, | ||
| decisions: { router: new Map(), condition: new Map() }, | ||
| loopIterations: new Map(), | ||
| loopItems: new Map(), | ||
| completedLoops: new Set(), | ||
| executedBlocks: new Set(), | ||
| activeExecutionPath: new Set(), | ||
| workflow: mockWorkflow, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: consider extracting the workflow setup to a shared helper function since it's reused across multiple test cases
| error: any, | ||
| userCodeStartLine: number, | ||
| userCode?: string | ||
| ): EnhancedError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: error parameter should be typed with a specific error type rather than any to ensure type safety
| // Check if this is a syntax error in wrapper code caused by incomplete user code | ||
| const isWrapperSyntaxError = | ||
| stackLine > userCodeStartLine && | ||
| error.name === 'SyntaxError' && | ||
| (error.message.includes('Unexpected token') || | ||
| error.message.includes('Unexpected end of input')) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider extracting this complex condition into a named function like isIncompleteSyntaxError for better readability
|
✅ No security or compliance issues detected. Reviewed everything up to 6779ec7. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. Reply to this PR with |
* 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> --------- 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 <vikhyathvikku@gmail.com> 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>