fix(lock): prevent socket crash when locking agent blocks (#3245)

This commit is contained in:
Waleed
2026-02-18 00:32:09 -08:00
committed by GitHub
parent eab01e0272
commit 11f3a14c02
2 changed files with 19 additions and 0 deletions

View File

@@ -618,6 +618,15 @@ export function Editor() {
<div className='h-[1.25px] flex-1' style={DASHED_DIVIDER_STYLE} />
</div>
)}
{hasAdvancedOnlyFields && !canEditBlock && displayAdvancedOptions && (
<div className='flex items-center gap-[10px] px-[2px] pt-[14px] pb-[12px]'>
<div className='h-[1.25px] flex-1' style={DASHED_DIVIDER_STYLE} />
<span className='whitespace-nowrap font-medium text-[13px] text-[var(--text-secondary)]'>
Additional fields
</span>
<div className='h-[1.25px] flex-1' style={DASHED_DIVIDER_STYLE} />
</div>
)}
{advancedOnlySubBlocks.map((subBlock, index) => {
const stableKey = getSubBlockStableKey(

View File

@@ -232,6 +232,7 @@ async function flushSubblockUpdate(
}
let updateSuccessful = false
let blockLocked = false
await db.transaction(async (tx) => {
const [block] = await tx
.select({
@@ -250,6 +251,7 @@ async function flushSubblockUpdate(
// Check if block is locked directly
if (block.locked) {
logger.info(`Skipping subblock update - block ${blockId} is locked`)
blockLocked = true
return
}
@@ -266,6 +268,7 @@ async function flushSubblockUpdate(
if (parentBlock?.locked) {
logger.info(`Skipping subblock update - parent ${parentId} is locked`)
blockLocked = true
return
}
}
@@ -308,6 +311,13 @@ async function flushSubblockUpdate(
serverTimestamp: Date.now(),
})
})
} else if (blockLocked) {
pending.opToSocket.forEach((socketId, opId) => {
io.to(socketId).emit('operation-confirmed', {
operationId: opId,
serverTimestamp: Date.now(),
})
})
} else {
pending.opToSocket.forEach((socketId, opId) => {
io.to(socketId).emit('operation-failed', {