Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/forge/workflow/nodes/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async def implement_task(state: WorkflowState) -> WorkflowState:
**state,
"last_error": str(exc),
"current_node": implementation_node,
"retry_count": state.get("retry_count", 0) + 1,
}

same_workspace_survived = local_workspace_survived and workspace_path == recorded_workspace
Expand Down
14 changes: 13 additions & 1 deletion tests/unit/workflow/nodes/test_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ def _make_state(
current_repo="acme/backend",
tasks_by_repo=None,
implemented_tasks=None,
retry_count=0,
):
return {
"ticket_key": ticket_key,
"ticket_type": ticket_type,
"current_node": "implement_task",
"is_paused": False,
"retry_count": 0,
"retry_count": retry_count,
"last_error": None,
"workspace_path": workspace_path,
"current_task_key": current_task_key,
Expand Down Expand Up @@ -211,6 +212,17 @@ async def test_bug_missing_workspace_keeps_bug_implementation_node(self):
assert result["current_node"] == "implement_bug_fix"
assert result["last_error"] == "Workspace not set up"

@pytest.mark.asyncio
async def test_prepare_workspace_failure_increments_retry_count(self):
"""Workspace setup failures must increment retry_count to avoid unbounded loops."""
from forge.workflow.nodes.implementation import implement_task

state = _make_state(workspace_path=None, retry_count=1)
result = await implement_task(state)

assert result["retry_count"] == 2
assert result["last_error"] is not None

@pytest.mark.asyncio
async def test_feature_container_failure_uses_feature_implementation_node(self):
"""Feature container failures must not checkpoint bug workflow node names."""
Expand Down
Loading