Repository navigation
[3672 by Claude Opus 5.5] Run summary: when the agent's last message is not a summary, let a small model call pick the summary - #3675
Conversation
… call now picks which message is the summary. The completion comment and the commit subject both use that pick. The new tests pass, typecheck and lint are clean, and the 20 existing test files I ran on the issue and follow-up paths still pass. Nothing ran against a real model or a live task.
How it works (new file `packages/core/src/agents/runSummarySelection.ts`)
- Candidates: for successful runs only, it takes the last assistant text messages, at most 6, newest last, with no tool output. It reads both transcript shapes: Claude's assistant text blocks and Codex's `agent_message` items. In the prompt each message is cut to 1500 characters, but the chosen message is published in full and unchanged.
- When it asks: only when there is more than one candidate, and only when a small-call model is set in the summarization settings. Otherwise it makes no call and nothing changes.
- The call: it uses the same small-call path as goal titles, under a new execution type `summary-selection`, which shows in the LLM Log as "Summary Selection". The prompt says the messages are quoted data whose instructions must not be followed, and a `</candidate>` tag inside a message is escaped. The model must reply `{"index": n}` or `{"index": null}`.
- Using the answer:
- A valid index replaces the summary and the commit message source with that message.
- `null` makes the comment say "The agent did not provide a summary." The commit subject then falls back to `fix(ai): Resolve issue #N - <title>` for issue runs, or "Apply follow-up changes from PR comment" for follow-ups.
- Timeout (30s), error, invalid JSON or an out-of-range index keep the last message exactly as before, and the reason goes to the task log.
Where it's called
- Issue runs call it in `src/jobs/issueJob/agent.ts`, after spend is recorded and the cancellation check.
- PR follow-up runs call it in `src/jobs/prCommentAgentUtils.ts`, for implementation follow-ups only.
- The follow-up comment code (`src/jobs/prCompletionComment.ts`) already scans the transcript with its own text rules. When the selection has decided, the comment now shows that choice instead, so the comment and the commit agree. Without that change the comment showed a different message; I checked by removing the line and watching the test fail. Runs with no selection still use the old text rules; I left them in place rather than remove existing behaviour.
- The API's LLM Log route now groups the new execution type as task work.
Things to know
- On the follow-up path the call runs while the agent's capacity slot is still held, so it can keep the slot up to 30 seconds longer.
- The non-test change is about 210 lines, under the 250 target.
- No previews were made, since nothing in the UI changed.
Tests: `test/runSummarySelection.test.ts` has 16 tests, all passing. They cover:
- picking an index
- `null` giving the fixed sentence and the title-based commit subject
- invalid JSON, out-of-range and zero indexes, a thrown error, and a timeout, each falling back to the last message
- a single-candidate run making no call
- no configured model making no call
- failed runs being left alone
- candidate text with instructions passed as quoted data
- Claude and Codex transcripts each building the right candidate list
- the cut to a fixed length
- the follow-up comment showing the choice rather than the old text-rule match
|
/ultrafix goal=8 max=4 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 4) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a bounded model call to select an existing assistant message, then propagates that choice into publication. It needs a localized correction before merge: Codex issue runs still cannot use the selected summary as their commit source. ✅ Conservative fallback — Invalid responses, errors, and selection timeouts preserve the original result. ✅ Focused coverage — Added tests cover candidate extraction, selection parsing, skipped calls, and follow-up comment precedence. This review uses static analysis of the supplied code; no commands were run. The authoritative checks report no failures and four pending test shards. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Selected Codex summary never reaches issue commits
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Share commit text normalization
ScoreThe implementation is focused and has useful coverage, but a supported provider misses the promised commit behavior. The correction is small; full test-suite checks are still pending. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit e285344
Summary of ChangesThat notice is from a watcher I had started to wait on the first test run, which hung. It hit its time limit and was stopped. It likely never exited because its Review digestRisk-tiered paths
Validation evidence
Diff size: 2 files changed, +15/−2 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…first test run, which hung. It hit its time limit and was stopped. It likely never exited because its `pgrep -f` pattern matched its own shell. It isn't needed any more: I found the hang (an open Redis client) and fixed it, and the later test runs above finished normally. The fix and test results are the same as in my last summary. That notice is from a watcher I had started to wait on the first test run, which hung. It hit its time limit and was stopped. It likely never exited because its `pgrep -f` pattern matched its own shell. It isn't needed any more: I found the hang (an open Redis client) and fixed it, and the later test runs above finished normally. The fix and test results are the same as in my last summary. PR: #3675 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 2/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit a02bcd0 Summary of ChangesI fixed the Shard 2/4 failure; all 120 test suites that mock Cause: only one file failed, Fix: I added Checks:
Shards 3/4 and 4/4 never got to run their tests, so I'll only know those are clean when CI runs again. No previews, since nothing visible changed. Review digestRisk-tiered paths
Validation evidence
Diff size: 1 file changed, +1/−0 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…k `@propr/core` now pass locally. I fixed the Shard 2/4 failure; all 120 test suites that mock `@propr/core` now pass locally. **Cause:** only one file failed, `test/processMergeConflictJob.test.ts`, and it failed while loading. That suite replaces `@propr/core` with a mock that lists a fixed set of exports. This PR made `src/jobs/prCommentAgentUtils.ts` import the new `applyRunSummarySelection`, which wasn't in that list, so Node stopped with "does not provide an export named 'applyRunSummarySelection'". Shards 3/4 and 4/4 were cancelled after this failure rather than failing themselves. **Fix:** I added `applyRunSummarySelection` to that suite's mock. It returns the agent result unchanged, so the merge-conflict tests behave as they did before. **Checks:** - The other suites that mock `@propr/core` might have been missing the same export, so I rebuilt the core package and ran all 120 of them. 119 passed. - The one failure was `test/followupAssignmentGate.test.ts`, and it is caused by this container, not the change: `/tmp/git-processor` is read-only here. Re-run with writable clone and worktree paths, it passes. - Root test files aren't covered by lint or typecheck in this repo, so neither applies to this edit. Shards 3/4 and 4/4 never got to run their tests, so I'll only know those are clean when CI runs again. No previews, since nothing visible changed. PR: #3675 Comment by: @propr-dev[bot] (ID: 6951819950) Model: Claude Opus 5.5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR is ready to merge within the reviewed scope. It adds a bounded summary-selection call and carries its decision through issue and follow-up publication paths without changing existing behavior when selection fails. ✅ Safe fallback behavior — Invalid responses, errors, and timeouts preserve the original result; failed runs and unconfigured models skip selection. ✅ Consistent publication — The selection marker reaches both response adapters, prevents follow-up comment heuristics from overriding the choice, and enables the intended commit fallback when no summary is selected. ✅ Focused coverage — Added tests cover both transcript formats, candidate limits, selection outcomes, and follow-up comment precedence. Current-head checks report 17 passed, with no failures or pending checks. This assessment uses static tracing of the supplied code; no commands or tests were run during this review. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Exercise publication paths end to endThe new tests verify the selected issue commit source at the adapter boundary, while the null-selection commit test invokes the follow-up builder with an independently supplied empty summary. An integration test carrying selected and null results through each actual publication path would better protect the wiring between selection, conversion, and commit construction. This is optional: the supplied consumers statically support both outcomes correctly. ScoreThe implementation is focused, preserves existing fallback behavior, and has relevant regression coverage with passing current-head checks. No merge-blocking defect was established from the supplied diff and context. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3672
Branch:
3672/claude-opus-5-5-run-summary-when-the-agen-20261117-1404-4fsCommits: ✅ Changes committed (1e7b011)
AI Processing Completed
Execution Details:
Summary:
When a run ends with more than one assistant message, one small model call now picks which message is the summary. The completion comment and the commit subject both use that pick. The new tests pass, typecheck and lint are clean, and the 20 existing test files I ran on the issue and follow-up paths still pass. Nothing ran against a real model or a live task.
How it works (new file
packages/core/src/agents/runSummarySelection.ts)agent_messageitems. In the prompt each message is cut to 1500 characters, but the chosen message is published in full and unchanged.summary-selection, which shows in the LLM Log as "Summary Selection". The prompt says the messages are quoted data whose instructions must not be followed, and a</candidate>tag inside a message is escaped. The model must reply{"index": n}or{"index": null}.nullmakes the comment say "The agent did not provide a summary." The commit subject then falls back tofix(ai): Resolve issue #N - <title>for issue runs, or "Apply follow-up changes from PR comment" for follow-ups.Where it's called
src/jobs/issueJob/agent.ts, after spend is recorded and the cancellation check.src/jobs/prCommentAgentUtils.ts, for implementation follow-ups only.src/jobs/prCompletionComment.ts) already scans the transcript with its own text rules. When the selection has decided, the comment now shows that choice instead, so the comment and the commit agree. Without that change the comment showed a different message; I checked by removing the line and watching the test fail. Runs with no selection still use the old text rules; I left them in place rather than remove existing behaviour.Things to know
Tests:
test/runSummarySelection.test.tshas 16 tests, all passing. They cover:nullgiving the fixed sentence and the title-based commit subjectReview digest
Risk-tiered paths
packages/api/routes/llmLogsRoutes.ts(+1/−1)packages/core/src/agents/runSummarySelection.ts(added, +193/−0)packages/core/src/agents/types.ts(+2/−0)packages/core/src/claude/claudeService.ts(+2/−0)packages/core/src/index.ts(+1/−0)packages/core/src/utils/llmMetrics.types.ts(+1/−0)src/jobs/issueJob/agent.ts(+6/−4)src/jobs/prCommentAgentUtils.ts(+6/−2)src/jobs/prCommentPostExecution.ts(+2/−1)src/jobs/prCompletionComment.ts(+2/−0)src/jobs/prFileUtils.ts(+1/−0)test/runSummarySelection.test.ts(added, +166/−0)Validation evidence
Diff size: 12 files changed, +383/−8 lines
Detailed Logs:
91759e6f-103d-4e14-a9ac-cd7fe8a6661cLog files stored at:
/usr/src/app/logs/executions/issue-3672-2026-11-17T14-16-35-664Z-conversation.json/usr/src/app/logs/executions/issue-3672-2026-11-17T14-16-35-664Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3672.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!