Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(hitl): fix stream endpoint, pause persistence, and resume page#3995
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c1a7f41
Fix hitl stream
Sg312 afb8522
fix hitl pause persistence
icecrasher321 42c0774
Fix /stream endpoint allowing api key usage
a38d0c4
resume page cleanup
waleedlatif1 c47b4a6
fix type
waleedlatif1 0cdaa49
make resume sync
icecrasher321 1330254
fix types
icecrasher321 e0147eb
address bugbot comments
icecrasher321 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 32 additions & 2 deletions
34 apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 5 additions & 15 deletions
20 apps/sim/app/api/workflows/[id]/executions/[executionId]/stream/route.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 52 additions & 9 deletions
61 apps/sim/app/resume/[workflowId]/[executionId]/resume-page-client.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation' | ||
| import { | ||
| Badge, | ||
| Button, | ||
| Code, | ||
| Input, | ||
| Label, | ||
| Table, | ||
| @@ -155,14 +156,54 @@ function getBlockNameFromSnapshot( | ||
| const parsed = JSON.parse(executionSnapshot.snapshot) | ||
| const workflowState = parsed?.workflow | ||
| if (!workflowState?.blocks || !Array.isArray(workflowState.blocks)) return null | ||
| // Blocks are stored as an array of serialized blocks with id and metadata.name | ||
| const block = workflowState.blocks.find((b: { id: string }) => b.id === blockId) | ||
| return block?.metadata?.name || null | ||
| } catch { | ||
| return null | ||
| } | ||
| } | ||
| function renderStructuredValuePreview(value: unknown) { | ||
| if (value === null || value === undefined) { | ||
| return <span style={{ fontSize: '12px', color: 'var(--text-muted)' }}>—</span> | ||
| } | ||
| if (typeof value === 'object') { | ||
| return ( | ||
| <div style={{ minWidth: '220px' }}> | ||
| <Code.Viewer | ||
| code={JSON.stringify(value, null, 2)} | ||
| language='json' | ||
| wrapText | ||
| className='max-h-[220px]' | ||
| /> | ||
| </div> | ||
| ) | ||
| } | ||
| const stringValue = String(value) | ||
| return ( | ||
| <div | ||
| style={{ | ||
| display: 'inline-flex', | ||
| maxWidth: '100%', | ||
| borderRadius: '6px', | ||
| border: '1px solid var(--border)', | ||
| background: 'var(--surface-5)', | ||
| padding: '4px 8px', | ||
| whiteSpace: 'pre-wrap', | ||
| wordBreak: 'break-word', | ||
| fontFamily: 'var(--font-mono, monospace)', | ||
| fontSize: '12px', | ||
| lineHeight: '16px', | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| color: 'var(--text-primary)', | ||
| }} | ||
| > | ||
| {stringValue} | ||
| </div> | ||
| ) | ||
| } | ||
| export default function ResumeExecutionPage({ | ||
| params, | ||
| initialExecutionDetail, | ||
| @@ -874,8 +915,11 @@ export default function ResumeExecutionPage({ | ||
| <Tooltip.Trigger asChild> | ||
| <Button | ||
| variant='outline' | ||
| size='sm' | ||
| onClick={refreshExecutionDetail} | ||
| disabled={refreshingExecution} | ||
| className='gap-1.5 px-2.5' | ||
| aria-label='Refresh execution details' | ||
| > | ||
| <RefreshCw | ||
| style={{ | ||
| @@ -884,6 +928,7 @@ export default function ResumeExecutionPage({ | ||
| animation: refreshingExecution ? 'spin 1s linear infinite' : undefined, | ||
| }} | ||
| /> | ||
| Refresh | ||
| </Button> | ||
| </Tooltip.Trigger> | ||
| <Tooltip.Content>Refresh</Tooltip.Content> | ||
| @@ -1123,11 +1168,7 @@ export default function ResumeExecutionPage({ | ||
| <TableRow key={row.id}> | ||
| <TableCell>{row.name}</TableCell> | ||
| <TableCell>{row.type}</TableCell> | ||
| <TableCell> | ||
| <code style={{ fontSize: '12px' }}> | ||
| {formatStructureValue(row.value)} | ||
| </code> | ||
| </TableCell> | ||
| <TableCell>{renderStructuredValuePreview(row.value)}</TableCell> | ||
| </TableRow> | ||
| ))} | ||
| </TableBody> | ||
| @@ -1243,6 +1284,8 @@ export default function ResumeExecutionPage({ | ||
| }} | ||
| placeholder='{"example": "value"}' | ||
| rows={6} | ||
| spellCheck={false} | ||
| className='min-h-[180px] border-[var(--border-1)] bg-[var(--surface-3)] font-mono text-[12px] leading-5' | ||
| /> | ||
| </div> | ||
| </div> | ||
| @@ -1267,10 +1310,10 @@ export default function ResumeExecutionPage({ | ||
| {/* Footer */} | ||
| <div | ||
| style={{ | ||
| marginTop: '32px', | ||
| padding: '16px', | ||
| maxWidth: '1200px', | ||
| margin: '24px auto 0', | ||
| padding: '0 24px 24px', | ||
| textAlign: 'center', | ||
| borderTop: '1px solid var(--border)', | ||
| fontSize: '13px', | ||
| color: 'var(--text-muted)', | ||
| }} | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.