fix task v2 block + post action code gen (#3605)

This commit is contained in:
Shuchang Zheng
2025-10-02 21:21:02 -07:00
committed by GitHub
parent 07cfcc14d9
commit 936282afdb
2 changed files with 10 additions and 8 deletions

View File

@@ -1741,6 +1741,7 @@ async def generate_workflow_script_python_code(
script_id=script_id, script_id=script_id,
organization_id=organization_id, organization_id=organization_id,
block_label=block_name, block_label=block_name,
update=pending,
) )
except Exception as e: except Exception as e:
LOG.error("Failed to create task_v2 script block", error=str(e), exc_info=True) LOG.error("Failed to create task_v2 script block", error=str(e), exc_info=True)
@@ -1845,13 +1846,11 @@ async def create_or_update_script_block(
block_code_bytes = block_code if isinstance(block_code, bytes) else block_code.encode("utf-8") block_code_bytes = block_code if isinstance(block_code, bytes) else block_code.encode("utf-8")
try: try:
# Step 3: Create script block in database # Step 3: Create script block in database
script_block = None script_block = await app.DATABASE.get_script_block_by_label(
if update: organization_id=organization_id,
script_block = await app.DATABASE.get_script_block_by_label( script_revision_id=script_revision_id,
organization_id=organization_id, script_block_label=block_label,
script_revision_id=script_revision_id, )
script_block_label=block_label,
)
if not script_block: if not script_block:
script_block = await app.DATABASE.create_script_block( script_block = await app.DATABASE.create_script_block(
script_revision_id=script_revision_id, script_revision_id=script_revision_id,

View File

@@ -249,6 +249,9 @@ class WorkflowService:
) )
context: skyvern_context.SkyvernContext | None = skyvern_context.current() context: skyvern_context.SkyvernContext | None = skyvern_context.current()
current_run_id = context.run_id if context and context.run_id else workflow_run.workflow_run_id current_run_id = context.run_id if context and context.run_id else workflow_run.workflow_run_id
root_workflow_run_id = (
context.root_workflow_run_id if context and context.root_workflow_run_id else workflow_run.workflow_run_id
)
skyvern_context.set( skyvern_context.set(
SkyvernContext( SkyvernContext(
organization_id=organization.organization_id, organization_id=organization.organization_id,
@@ -256,7 +259,7 @@ class WorkflowService:
request_id=request_id, request_id=request_id,
workflow_id=workflow_id, workflow_id=workflow_id,
workflow_run_id=workflow_run.workflow_run_id, workflow_run_id=workflow_run.workflow_run_id,
root_workflow_run_id=workflow_run.workflow_run_id, root_workflow_run_id=root_workflow_run_id,
run_id=current_run_id, run_id=current_run_id,
workflow_permanent_id=workflow_run.workflow_permanent_id, workflow_permanent_id=workflow_run.workflow_permanent_id,
max_steps_override=max_steps_override, max_steps_override=max_steps_override,