|
23 | 23 | resolve_linear_api_token, |
24 | 24 | ) |
25 | 25 | from context import assemble_prompt, fetch_github_issue |
26 | | -from jira_reactions import comment_task_finished, comment_task_started |
| 26 | +from jira_reactions import ( |
| 27 | + comment_task_started, |
| 28 | + transition_pr_opened, |
| 29 | + transition_task_started, |
| 30 | +) |
27 | 31 | from linear_reactions import react_task_finished, react_task_started |
28 | 32 | from models import AgentResult, HydratedContext, RepoSetup, TaskConfig, TaskResult |
29 | 33 | from observability import current_otel_trace_id, task_span |
@@ -862,6 +866,14 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
862 | 866 | config.channel_metadata, |
863 | 867 | ) |
864 | 868 |
|
| 869 | + # Move the Jira card To Do → In Progress so the board reflects that |
| 870 | + # work has started (issue #572). No-op for non-Jira tasks. |
| 871 | + # Best-effort; failures are logged and never block the pipeline. |
| 872 | + transition_task_started( |
| 873 | + config.channel_source, |
| 874 | + config.channel_metadata, |
| 875 | + ) |
| 876 | + |
865 | 877 | # Download attachments from S3 (version-pinned, integrity-verified) |
866 | 878 | prepared_attachments: list = [] |
867 | 879 | if config.attachments: |
@@ -1057,6 +1069,14 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1057 | 1069 | post_span.set_attribute("pr.url", pr_url or "") |
1058 | 1070 | if pr_url: |
1059 | 1071 | progress.write_agent_milestone("pr_created", pr_url) |
| 1072 | + # Move the Jira card In Progress → In Review now that a PR is |
| 1073 | + # open (issue #572). Only fires when a PR was actually opened — |
| 1074 | + # failed / no-PR tasks leave the card where humans can see the |
| 1075 | + # failure comment. No-op for non-Jira tasks; best-effort. |
| 1076 | + transition_pr_opened( |
| 1077 | + config.channel_source, |
| 1078 | + config.channel_metadata, |
| 1079 | + ) |
1060 | 1080 |
|
1061 | 1081 | # Memory write — capture task episode and repo learnings |
1062 | 1082 | memory_written = False |
@@ -1106,14 +1126,14 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1106 | 1126 | started_reaction_id=linear_eyes_reaction_id, |
1107 | 1127 | ) |
1108 | 1128 |
|
1109 | | - # Terminal status comment on the Jira issue (REST shim, with the |
1110 | | - # PR link when one was opened). No-op for non-Jira tasks. |
1111 | | - comment_task_finished( |
1112 | | - config.channel_source, |
1113 | | - config.channel_metadata, |
1114 | | - success=(overall_status == "success"), |
1115 | | - pr_url=pr_url, |
1116 | | - ) |
| 1129 | + # NOTE: the terminal status comment on the Jira issue is NOT posted |
| 1130 | + # here. Since issue #573 the deterministic fan-out plane |
| 1131 | + # (``cdk/src/handlers/fanout-task-events.ts`` ``dispatchToJira``) |
| 1132 | + # owns the Jira final-status comment — it carries cost/turns/ |
| 1133 | + # duration and, crucially, fires even if this agent crashes before |
| 1134 | + # reaching this point (max-turns, OOM). Posting here too would |
| 1135 | + # double-comment. The agent still posts the *start* comment |
| 1136 | + # (``comment_task_started`` above) for in-flight progress. |
1117 | 1137 |
|
1118 | 1138 | # --trace trajectory S3 upload (design §10.1). Runs AFTER |
1119 | 1139 | # post-hooks but BEFORE ``write_terminal`` so the resulting |
@@ -1244,14 +1264,11 @@ def _on_trace_truncated(max_bytes: int, first_dropped: int) -> None: |
1244 | 1264 | success=False, |
1245 | 1265 | started_reaction_id=linear_eyes_reaction_id, |
1246 | 1266 | ) |
1247 | | - # Best-effort failure comment on the Jira issue. No-op for |
1248 | | - # non-Jira tasks; network failures are swallowed. |
1249 | | - comment_task_finished( |
1250 | | - config.channel_source, |
1251 | | - config.channel_metadata, |
1252 | | - success=False, |
1253 | | - pr_url=None, |
1254 | | - ) |
| 1267 | + # NOTE: no Jira failure comment here — the fan-out plane's |
| 1268 | + # ``dispatchToJira`` (issue #573) owns the Jira terminal comment |
| 1269 | + # and fires on the platform side even when this crash path runs, |
| 1270 | + # so posting here would double-comment. (Contrast the Linear ❌ |
| 1271 | + # reaction above, which the fan-out plane does not replicate.) |
1255 | 1272 | raise |
1256 | 1273 |
|
1257 | 1274 |
|
|
0 commit comments