Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/forge/workflow/nodes/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,25 @@ async def implement_task(state: WorkflowState) -> WorkflowState:
settings = get_settings()
jira = JiraClient(settings)

# Initialize task_summary to handle early failures before Jira fetch
task_summary = "unknown"

try:
# Get Task details from Jira
task_issue = await jira.get_issue(current_task)
task_description = task_issue.description or ""
task_summary = task_issue.summary

logger.info(
f"Implementation started for task {current_task}",
extra={
"event": "implementation_started",
"task_name": task_summary,
"feature_id": ticket_key,
"task_id": current_task,
},
)

# Post status comment at task implementation start
await post_status_comment(
jira,
Expand Down Expand Up @@ -154,6 +167,16 @@ async def implement_task(state: WorkflowState) -> WorkflowState:

if result.success:
logger.info(f"Container completed successfully for {current_task}")
logger.info(
f"Implementation completed for task {current_task}",
extra={
"event": "implementation_completed",
"task_name": task_summary,
"feature_id": ticket_key,
"task_id": current_task,
"success": True,
},
)

# Post status comment at task implementation completion
await post_status_comment(
Expand Down Expand Up @@ -186,6 +209,17 @@ async def implement_task(state: WorkflowState) -> WorkflowState:

except Exception as e:
logger.error(f"Implementation failed for {current_task}: {e}")
# Emit structured end log for failed implementation
logger.info(
f"Implementation ended for task {current_task or 'unknown'}",
extra={
"event": "implementation_ended",
"task_name": task_summary,
"feature_id": ticket_key,
"task_id": current_task or "unknown",
"success": False,
},
)
return {
**state,
"last_error": str(e),
Expand Down
Loading
Loading