Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Code-subblock fix: validation to not parse non-variables as variables; wand prompt bar styling; improved error messaging for connected blocks (#1240)

Whitelabel fix: move redirects (build-time) for whitelabeling to middleware

Add input/output multipliers

Improvement (Copilot): billing multiplier adjustments (#1245)

Hydration fix: prevent duplicate overlay after idle + subblocks race condition; cleanup redundant logic (#1246)

Workflow switching fix: race condition between registry and workflow stores; cleanup + simplify (#1247)

Enterprise plan webhooks feature: skip webhook queue for enterprise plan users; reuse subscription record (#1250)

Rehydration fix: consolidate store rehydration code; fix stale closure (#1249)

Sidebar fix: order by created at (#1251)

waleedlatif1 and others added 15 commits September 3, 2025 16:09
…riables in the code subblock (#1240)

* fix(code-subblock): added validation to not parse non-variables as variables in the code subblock

* fix wand prompt bar styling

* fix error message for available connected blocks to only show connected available blocks, not block ID's

* ui
improvement(copilot): billing multiplier adjustments
…on (#1246)

* fix(hydration): duplicate overlay after idle + subblocks race condition

* remove random timeout

* re-use correct helper

* remove redundant check

* add check

* remove third init func
…n registry and workflow stores (#1247)

* fix(race-condition-workflow-switching): another race condition between regitry and workflow stores"

* fix initial load race cond + cleanup

* fix initial load issue + simplify
…n users (#1250)

* feat(enterprise-plan-webhooks): skip webhook queue for enterprise plan users

* reuse subscription record instead of making extra db call
* fix(rehydration): consolidate store rehydration code

* fix stale closure
@vercel
Copy link

vercel bot commented Sep 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim (staging) Ready Ready Comment Sep 5, 2025 5:24am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 5, 2025 5:24am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR addresses multiple critical race conditions and consolidates store rehydration logic across the workflow management system. The changes fix workflow switching race conditions by making the workflow registry the single source of truth for active workflow state, preventing inconsistent UI states that occurred when multiple stores competed to manage workflow transitions.

Key architectural improvements include:

Store Rehydration Consolidation: The Socket.IO context now uses a shared rehydrateWorkflowStores function that replaces complex merge-based state updates with complete state replacement using authoritative server data. This eliminates duplicate overlays and stale state issues during workflow switching.

Race Condition Fixes: The workflow switching logic has been simplified by removing hacky timeout-based solutions and consolidating initialization into focused useEffect hooks. The registry store now atomically updates multiple stores together, preventing the flickering and empty canvas issues that occurred during rapid workspace transitions.

Billing System Enhancements: The cost calculation system now supports separate input and output token multipliers instead of a single multiplier. This enables more granular billing control, with Copilot implementing 1.0x for input tokens (at-cost) and 1.5x for output tokens.

Enterprise Webhook Optimization: Enterprise users can now bypass the webhook queue system for immediate execution, providing better performance and reliability for high-volume webhook traffic.

UI/UX Improvements: Multiple styling fixes address dark mode visibility issues with wand prompt bars, improved error messaging for code validation, and stable workflow ordering by creation date instead of modification date.

Code Quality: The resolver now properly validates variable references to prevent parsing comparison operators or HTML tags as variables, and test coverage has been updated to match the new error message formatting.

Confidence score: 4/5

  • This PR addresses complex race conditions and store synchronization issues with well-structured solutions that consolidate logic and improve reliability
  • Score reflects the comprehensive nature of changes affecting multiple critical systems, requiring careful review of the state management flow and Socket.IO integration
  • Pay close attention to the socket context rehydration logic and workflow switching sequences to ensure the new atomic updates work correctly across all scenarios

26 files reviewed, 5 comments

Edit Code Review Bot Settings | Greptile

<AlertTriangle className='h-4 w-4 cursor-pointer text-destructive' />
</TooltipTrigger>
<TooltipContent side='top'>
<p>Invalid JSON</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The tooltip shows generic 'Invalid JSON' message but the actual schemaError state contains more specific validation messages. Consider showing the specific error in the tooltip for better user experience.

Suggested change
<p>Invalid JSON</p>
<p>{schemaError}</p>

Comment on lines +447 to +448
inputMultiplier?: number,
outputMultiplier?: number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The optional parameters inputMultiplier and outputMultiplier should be grouped into an options object for better maintainability when dealing with multiple optional parameters.

Context Used: Context - Group optional parameters into an options object for better maintainability when defining functions or methods. (link)

Comment on lines +88 to +91
const termsUrl = process.env.NEXT_PUBLIC_TERMS_URL
if (termsUrl?.startsWith('http')) {
return NextResponse.redirect(termsUrl)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The URL validation only checks if the URL starts with 'http' but doesn't validate if it's a properly formed URL. Consider using URL constructor with try-catch for more robust validation.

Comment on lines +95 to +98
const privacyUrl = process.env.NEXT_PUBLIC_PRIVACY_URL
if (privacyUrl?.startsWith('http')) {
return NextResponse.redirect(privacyUrl)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Duplicate validation logic - consider extracting into a helper function to avoid code duplication.

Comment on lines +51 to +53
setActiveWorkflow(firstWorkflowId).then(() => {
router.replace(`/workspace/${workspaceId}/w/${firstWorkflowId}`)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding error handling for the setActiveWorkflow promise to prevent silent failures that could leave users stuck on the loading screen

Suggested change
setActiveWorkflow(firstWorkflowId).then(() => {
router.replace(`/workspace/${workspaceId}/w/${firstWorkflowId}`)
})
setActiveWorkflow(firstWorkflowId).then(() => {
router.replace(`/workspace/${workspaceId}/w/${firstWorkflowId}`)
}).catch((error) => {
console.error('Failed to set active workflow:', error)
// Still redirect even if setting active workflow fails
router.replace(`/workspace/${workspaceId}/w/${firstWorkflowId}`)
})

@railway-app railway-app bot temporarily deployed to sim (sim / staging) September 5, 2025 04:12 Inactive
@vercel vercel bot temporarily deployed to Preview – docs September 5, 2025 04:12 Inactive
* feat(duplicate): duplicate variables when duplicating a workflow

* better typing
…1255)

* fix(ratelimits): enterprise and team checks should be pooled limit"

* fix

* fix dynamic imports

* fix tests"
;
@railway-app railway-app bot temporarily deployed to sim (sim / staging) September 5, 2025 05:15 Inactive
@vercel vercel bot temporarily deployed to Preview – docs September 5, 2025 05:15 Inactive
@waleedlatif1 waleedlatif1 merged commit 60a061e into main Sep 5, 2025
17 checks passed
@waleedlatif1 waleedlatif1 deleted the staging branch September 5, 2025 05:50
@icecrasher321 icecrasher321 restored the staging branch September 5, 2025 06:32
@railway-app railway-app bot temporarily deployed to sim (sim / staging) September 5, 2025 06:32 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants