Skip to content

Commit 6648b53

Browse files
declan-scaleclaude
andcommitted
fix(cli): address Greptile review on template hardening
- default-codex: evict the per-task turn lock on cancel so _task_locks does not grow unbounded for the process lifetime. - temporal-langgraph: increment _turn_number after the non-text guard so a skipped non-text event no longer desyncs the turn counter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 14976f2 commit 6648b53

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/agentex/lib/cli/templates/default-codex/project/acp.py.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,6 @@ async def handle_task_event_send(params: SendEventParams):
257257
@acp.on_task_cancel
258258
async def handle_task_canceled(params: CancelTaskParams):
259259
logger.info("Task canceled: %s", params.task.id)
260+
# Evict the per-task turn lock so it doesn't accumulate for the lifetime of
261+
# the process (one Lock per task otherwise lives forever).
262+
_task_locks.pop(params.task.id, None)

src/agentex/lib/cli/templates/temporal-langgraph/project/workflow.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ class {{ workflow_class }}(BaseWorkflow):
9393
async def on_task_event_send(self, params: SendEventParams) -> None:
9494
"""Handle a new user message: echo it, then run the agent graph durably."""
9595
logger.info(f"Received task event for task {params.task.id}")
96-
self._turn_number += 1
9796
content = params.event.content
9897
if not isinstance(content, TextContent):
9998
logger.warning("Ignoring non-text event content (type=%s)", getattr(content, "type", "?"))
10099
return
100+
self._turn_number += 1
101101
user_text = content.content
102102

103103
# Echo the user's message so it shows up as a chat bubble.

0 commit comments

Comments
 (0)