|
25 | 25 | resolve_linear_api_token, |
26 | 26 | ) |
27 | 27 | from context import assemble_prompt, fetch_github_issue |
28 | | -from jira_reactions import comment_task_finished, comment_task_started |
| 28 | +from jira_reactions import ( |
| 29 | + comment_task_started, |
| 30 | + transition_pr_opened, |
| 31 | + transition_task_started, |
| 32 | +) |
29 | 33 | from linear_reactions import react_task_finished, react_task_started |
30 | 34 | from models import AgentResult, HydratedContext, RepoSetup, TaskConfig, TaskResult |
31 | 35 | from observability import current_otel_trace_id, task_span |
@@ -995,6 +999,17 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
995 | 999 | config.channel_metadata, |
996 | 1000 | ) |
997 | 1001 |
|
| 1002 | + # Move the Jira card To Do → In Progress so the board reflects that |
| 1003 | + # work has started (issue #572). No-op for non-Jira tasks. |
| 1004 | + # Best-effort; failures are logged and never block the pipeline. |
| 1005 | + # Part of the Early-ACK block (moved before setup_repo with the 👀 |
| 1006 | + # and start comment) so board state updates immediately, not after |
| 1007 | + # the multi-minute baseline build. |
| 1008 | + transition_task_started( |
| 1009 | + config.channel_source, |
| 1010 | + config.channel_metadata, |
| 1011 | + ) |
| 1012 | + |
998 | 1013 | # Setup repo (deterministic pre-hooks). A failure/timeout/OOM in the |
999 | 1014 | # pre-agent baseline build raises here; it needs no local handler — |
1000 | 1015 | # the outer ``except Exception`` at the bottom of this ``try`` writes |
@@ -1327,6 +1342,14 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1327 | 1342 | post_span.set_attribute("pr.url", pr_url or "") |
1328 | 1343 | if pr_url: |
1329 | 1344 | progress.write_agent_milestone("pr_created", pr_url) |
| 1345 | + # Move the Jira card In Progress → In Review now that a PR is |
| 1346 | + # open (issue #572). Only fires when a PR was actually opened — |
| 1347 | + # failed / no-PR tasks leave the card where humans can see the |
| 1348 | + # failure comment. No-op for non-Jira tasks; best-effort. |
| 1349 | + transition_pr_opened( |
| 1350 | + config.channel_source, |
| 1351 | + config.channel_metadata, |
| 1352 | + ) |
1330 | 1353 |
|
1331 | 1354 | # Memory write — capture task episode and repo learnings |
1332 | 1355 | memory_written = False |
@@ -1388,14 +1411,14 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1388 | 1411 | transition_state=linear_transition_state, |
1389 | 1412 | ) |
1390 | 1413 |
|
1391 | | - # Terminal status comment on the Jira issue (REST shim, with the |
1392 | | - # PR link when one was opened). No-op for non-Jira tasks. |
1393 | | - comment_task_finished( |
1394 | | - config.channel_source, |
1395 | | - config.channel_metadata, |
1396 | | - success=(overall_status == "success"), |
1397 | | - pr_url=pr_url, |
1398 | | - ) |
| 1414 | + # NOTE: the terminal status comment on the Jira issue is NOT posted |
| 1415 | + # here. Since issue #573 the deterministic fan-out plane |
| 1416 | + # (``cdk/src/handlers/fanout-task-events.ts`` ``dispatchToJira``) |
| 1417 | + # owns the Jira final-status comment — it carries cost/turns/ |
| 1418 | + # duration and, crucially, fires even if this agent crashes before |
| 1419 | + # reaching this point (max-turns, OOM). Posting here too would |
| 1420 | + # double-comment. The agent still posts the *start* comment |
| 1421 | + # (``comment_task_started`` above) for in-flight progress. |
1399 | 1422 |
|
1400 | 1423 | # --trace trajectory S3 upload (design §10.1). Runs AFTER |
1401 | 1424 | # post-hooks but BEFORE ``write_terminal`` so the resulting |
@@ -1570,14 +1593,11 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1570 | 1593 | success=False, |
1571 | 1594 | started_reaction_id=linear_eyes_reaction_id, |
1572 | 1595 | ) |
1573 | | - # Best-effort failure comment on the Jira issue. No-op for |
1574 | | - # non-Jira tasks; network failures are swallowed. |
1575 | | - comment_task_finished( |
1576 | | - config.channel_source, |
1577 | | - config.channel_metadata, |
1578 | | - success=False, |
1579 | | - pr_url=None, |
1580 | | - ) |
| 1596 | + # NOTE: no Jira failure comment here — the fan-out plane's |
| 1597 | + # ``dispatchToJira`` (issue #573) owns the Jira terminal comment |
| 1598 | + # and fires on the platform side even when this crash path runs, |
| 1599 | + # so posting here would double-comment. (Contrast the Linear ❌ |
| 1600 | + # reaction above, which the fan-out plane does not replicate.) |
1581 | 1601 | raise |
1582 | 1602 |
|
1583 | 1603 |
|
|
0 commit comments