Repository navigation
[3598 by Claude Opus 5.5] MCP: contradictory state fields and mixed timestamp formats in results - #3637
Conversation
…/mcp*` and `goal*` suite passes when run from the repo root. Lint and the API typecheck are clean. 1. Goal artifacts agree with the goal's pull requests (`services/goalProjection.ts`) - The goal projection that `get_goal` and the REST goal routes both use now checks the stored artifact list against recorded merges. - A pull request whose merge ProPR has seen is reported as `merged` with `draft: false`, and `artifactStats.openPullRequests` drops by one for it. - The REST response shape is unchanged; only these values are corrected. Nothing stored is rewritten. 2. Submission state matches the task (`mcp/toolsTaskSubmissions.ts`) - The stored submission row stops at `queued` once dispatched. `get_task_submission` and `list_task_submissions` now report `state` and `submissionState` from the task's stage once it is running, completed, failed or cancelled. - The `create_task` receipt and operation polling are unchanged, so operation tracking behaves as before. 3. One timestamp format (`mcp/resultTimestamps.ts`, wired into `mcp/toolExecution.ts`) - One recursive pass runs on every tool result. It rewrites fields whose names mark a time (`*_at`, `*At`, `timestamp`, `*Time`, `since`, `until`) to ISO 8601 UTC with `Z`. - That covers SQLite `YYYY-MM-DD HH:MM:SS` text, ISO strings with no zone or with an offset, and epoch milliseconds. - Values that are already UTC ISO strings are left exactly as they are. Durations, cursors, free text and other fields are not touched, and field names stay the same. 4. Plans and tasks - `list_plans` rows now have `pull_requests_truncated`, which is true when the short `pull_requests` list leaves some out. - In `list_tasks`, a missing `agent_alias` is filled from the agent recorded during execution, using the same source as the REST task status the CLI reads (`loadTaskModelIdentities`). A task with no such record still shows `null`. 5. `list_followup_handoffs` (`mcp/toolsMaintenance.ts`) - By default it returns only handoffs that are held for an operator or in automatic recovery. - New inputs: `includeReleased` (default false), `offset`, and `limit` (default 20, max 100). The result has a `nextOffset` for the next page. Tests and docs - New tests cover each point: - goal artifacts: `goalProjection.test.ts` - submission state: `mcpTaskSubmissions.test.ts` - timestamps (unit and through `executeTool`): `mcpResultTimestamps.test.ts` - plan truncation: `mcpPresentation.test.ts` - task agent: `mcpTaskLineage.test.ts` - handoff filter and paging: `mcpMaintenance.test.ts` - I changed the expected values in `mcpGoalTaskDepth` and `mcpTaskLineage`, which asserted the old zone-less timestamps in MCP results. - I added the new field names that `docs/mcp.md` now mentions to the doc-word allowlist in `mcpObservableSurface`. - `docs/mcp.md` describes the timestamp rule, the agreeing state fields, the truncation flag, the agent fallback and the handoff options. `mcpResultTimestamps.test.ts` exits normally when run from the repo root, as CI runs it. Run from inside `packages/api`, importing the tool catalog opens a second database connection that is never closed, so the process doesn't exit. That also happens on unchanged HEAD. This changes MCP results only, nothing in the UI, so there are no previews.
|
/ultrafix goal=8 max=6 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 6) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR addresses the five presentation inconsistencies with focused changes and targeted tests. It needs a localized correction before merge: the new agent fallback can pair an execution agent with a stale submission model. ✅ Submission lifecycle isolation — Read responses follow task progress while mutation receipts retain their existing tracking behavior. ✅ Repository-scoped merge evidence — Goal artifacts use observed merges from the goal’s repository and adjust the open count without rewriting storage. ✅ Authorized handoff pagination — Repository access filtering occurs before pagination, so inaccessible records do not occupy returned pages. This review used static analysis of the supplied code only; no commands were run. The authoritative check summary reports no failures and four pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Keep fallback agent and model consistent
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Qualify plan detail completenessThe new comment and documentation say ScoreThe changes are focused and have useful regression coverage, but the execution identity fallback introduces a contradictory result requiring correction. Current checks show no failures, with four 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 fb80750
Summary of ChangesI fixed F1. When What changed
Other callers: Checks: Disk ran out: the workspace disk filled to 100% partway through, and the failed write left Review digestRisk-tiered paths
Validation evidence
Diff size: 4 files changed, +29/−6 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… what the execution recorded, it now takes the model from that same record, so a task can't show an agent paired with a model it never ran. I fixed F1. When `list_tasks` fills in a missing agent from what the execution recorded, it now takes the model from that same record, so a task can't show an agent paired with a model it never ran. **What changed** - **`packages/api/mcp/taskListing.ts` (`fillExecutionAgents`)**: when the execution record supplies `agentAlias`, `model_name` is now set from that record's `modelName` too, with the same 100-character limit. In your example the task now reports `codex`/`gpt-5.6` instead of `codex`/`opus`. Tasks that already had an agent from submission are unchanged. - **`packages/api/mcp/listSummaries.ts`**: `MODEL_LIMIT` is now exported so the fill uses the same limit as `summarizeTask`. - **Test** (`packages/api/test/mcpTaskLineage.test.ts`): a new case where submission recorded only `opus` and execution ran `gpt-5.6` with `codex`. It asserts the pair `['codex', 'gpt-5.6']`. With the old code put back, it fails with `['codex', 'opus']`. - **`docs/mcp.md`**: the fallback sentence now says the task reports the model that agent ran. A docs test rejects the literal `model_name` there, so I reworded rather than adding it to that test's allowed-word list. **Other callers:** `fillExecutionAgents` is the only place in the PR's changes that copies an agent out of the execution record. The REST task status path in `routes/taskHelpers.ts` reads agent and model from the same record together, so it doesn't have this bug. **Checks:** `mcpTaskLineage`, `mcpPresentation` and `mcpObservableSurface` pass (18 tests). Lint (zero warnings) and the API typecheck are clean. **Disk ran out:** the workspace disk filled to 100% partway through, and the failed write left `packages/api/mcp/listSummaries.ts` empty. I restored it from HEAD and checked it matched before editing again. To make room I deleted `/tmp/node-compile-cache`, which is only a cache. Free space then rose to about 20G, more than that deletion accounts for, so something else also released space. Most of the disk is in `/tmp/git-processor` (93G), so it may fill up again. PR: #3637 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
❌ ProPR could not start on The job failed 3 times before processing began: Post the command again once the cause is resolved. |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
|
❌ ProPR could not start on The ProPR worker refused the job because the disk that holds its working copies is nearly full. Nothing was changed on this pull request. Once space has been freed on the worker host, post the command again. |
1 similar comment
|
❌ ProPR could not start on The ProPR worker refused the job because the disk that holds its working copies is nearly full. Nothing was changed on this pull request. Once space has been freed on the worker host, post the command again. |
|
|
|
/ultrafix goal=8 max=4 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 4) First action:
|
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR is ready to merge within the reviewed scope. It addresses the five consistency issues with focused projection changes, matching documentation, and regression coverage. Review was static; no commands were run. The supplied current-head checks show 16 passed, none failed or pending, and 23 neutral/skipped. ✅ Submission lifecycle consistency — Reads derive running and terminal states from task progress while preserving mutation receipt tracking. ✅ Repository-scoped merge reconciliation — Goal artifacts use observed merges from the matching repository, clear draft status, and adjust the open count without rewriting storage. ✅ Shared timestamp boundary — Normalization covers nested results while preserving non-timestamp fields, with both unit and executor-level coverage. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Stabilize handoff pagination order
S3: 🟢 Cover cancellation and replacement readsThe new submission tests cover queued, running, completed, and failed states. Adding cancellation and a completed-to-replacement transition would strengthen coverage of reads following the latest attempt. This is optional because the shared stage mapping and latest-task selection support those paths in the supplied code. ScoreThe implementation is focused, has substantial relevant coverage, and has no verified merge blockers. Current-head checks are successful; validation here was limited to the supplied code and context. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
…e worker refuses an Ultrafix step for disk pressure, the loop now waits and retries that step, and it posts one waiting notice instead of a refusal comment per attempt. If space doesn't come back, it stops with a notice that gives the real reason, last score and cycle. Everything already in the PR is kept, and the new regression tests pass. I've implemented the Correction section from #3642. When the worker refuses an Ultrafix step for disk pressure, the loop now waits and retries that step, and it posts one waiting notice instead of a refusal comment per attempt. If space doesn't come back, it stops with a notice that gives the real reason, last score and cycle. Everything already in the PR is kept, and the new regression tests pass. **Waiting instead of failing** - When a step's job has used up its attempts and the error is `WorktreeDiskPressureError`, the refusal is recorded on the loop as a wait (new `src/jobs/ultrafixDiskPressureWait.ts`, wired in through `ultrafixExhaustedStep.ts`). It does not count toward the "failed N times in a row" limit. - The same step is retried after 2, 5, 10, 20 and 20 minutes, 57 minutes in total. The re-arm code itself enforces this, so neither the daemon sweep nor a check event can retry sooner. If a fix was refused, the fix is retried, not swapped for a review. - The first refusal posts "⏳ Ultrafix is waiting for free disk space on the worker" once. Later refusals post nothing, and the per-attempt "could not start" comment from `prCommentUnstartedFailure.ts` is skipped for these steps. - Once a step is admitted and completes, the wait ends and the loop carries on as usual. **Stop notice when space doesn't return** - After the sixth refusal (about an hour), the loop finishes as failed with the reason "The worker had no free disk space". The notice says how long it waited, how many times the step was refused and that the loop stopped at cycle N of M, and the `ultrafix` label is removed. - "Last score: unknown" on #3637 happened because an active loop has no final score until it finishes. The loop now keeps its latest review score as it goes, and the stop notice uses it. This also fixes the score on the recovery-limit stop notice. **Tests** - In `test/ultrafixCiFailureRecovery.test.ts`: - Two refusals then a successful admission: the loop continues, posts one notice and no refusal comments, and nothing is counted as failed. - Persistent refusals: the loop ends with one stop notice ("Last score: 5", "no free disk space", "stopped at cycle 1 of 5"), and the label is removed. - A refusal for a job that is no longer the loop's current step still gets the ordinary refusal comment. - In `test/prCommentTaskStateFinalizers.test.ts`, a new test checks that the per-attempt comment is skipped. - I temporarily broke five parts of the fix one at a time; the new tests caught each one. - All 33 Ultrafix-related suites, `checkRunHandler` and the docs manifest test pass. Typecheck and zero-warning lint on the changed files are clean. - The real-Redis integration suite was skipped because there's no Redis in this container, and nothing was tried against a real worker with a full disk. **Docs:** `docs/docs/features/pr-commands.md` now describes the disk-space wait. Decision for you: the wait is 57 minutes, short of the full hour. Your example gaps (2, 5, 10, 20) add up to 37 minutes, so I added a second 20-minute wait; the schedule is one constant, `ULTRAFIX_DISK_PRESSURE_RETRY_DELAYS_MS`, if you want it changed. Limitation: if the job for the `/ultrafix` command itself is refused, it still gets the ordinary "post the command again" comment. That is the existing behaviour, and only the loop's own review and fix steps wait for space. No previews, since nothing visible in the UI changed. PR: #3649 Comment by: @integry (ID: 6941588329) Model: Claude Opus 5.5
AI Implementation Summary
Closes #3598
Branch:
3598/claude-opus-5-5-mcp-contradictory-state-f-20261117-0248-lqkCommits: ✅ Changes committed (eb70e17)
AI Processing Completed
Execution Details:
Summary:
I've fixed all five points from issue #3598. Every
packages/api/test/mcp*andgoal*suite passes when run from the repo root. Lint and the API typecheck are clean.1. Goal artifacts agree with the goal's pull requests (
services/goalProjection.ts)get_goaland the REST goal routes both use now checks the stored artifact list against recorded merges.mergedwithdraft: false, andartifactStats.openPullRequestsdrops by one for it.2. Submission state matches the task (
mcp/toolsTaskSubmissions.ts)queuedonce dispatched.get_task_submissionandlist_task_submissionsnow reportstateandsubmissionStatefrom the task's stage once it is running, completed, failed or cancelled.create_taskreceipt and operation polling are unchanged, so operation tracking behaves as before.3. One timestamp format (
mcp/resultTimestamps.ts, wired intomcp/toolExecution.ts)*_at,*At,timestamp,*Time,since,until) to ISO 8601 UTC withZ.YYYY-MM-DD HH:MM:SStext, ISO strings with no zone or with an offset, and epoch milliseconds.4. Plans and tasks
list_plansrows now havepull_requests_truncated, which is true when the shortpull_requestslist leaves some out.list_tasks, a missingagent_aliasis filled from the agent recorded during execution, using the same source as the REST task status the CLI reads (loadTaskModelIdentities). A task with no such record still showsnull.5.
list_followup_handoffs(mcp/toolsMaintenance.ts)includeReleased(default false),offset, andlimit(default 20, max 100). The result has anextOffsetfor the next page.Tests and docs
goalProjection.test.tsmcpTaskSubmissions.test.tsexecuteTool):mcpResultTimestamps.test.tsmcpPresentation.test.tsmcpTaskLineage.test.tsmcpMaintenance.test.tsmcpGoalTaskDepthandmcpTaskLineage, which asserted the old zone-less timestamps in MCP results.docs/mcp.mdnow mentions to the doc-word allowlist inmcpObservableSurface.docs/mcp.mddescribes the timestamp rule, the agreeing state fields, the truncation flag, the agent fallback and the handoff options.mcpResultTimestamps.test.tsexits normally when run from the repo root, as CI runs it. Run from insidepackages/api, importing the tool catalog opens a second database connection that is never closed, so the process doesn't exit. That also happens on unchanged HEAD.This changes MCP results only, nothing in the UI, so there are no previews.
Review digest
Risk-tiered paths
packages/api/mcp/listSummaries.ts(+2/−0)packages/api/mcp/resultTimestamps.ts(added, +64/−0)packages/api/mcp/taskListing.ts(+19/−2)packages/api/mcp/toolExecution.ts(+3/−1)packages/api/mcp/toolsMaintenance.ts(+12/−3)packages/api/mcp/toolsTaskSubmissions.ts(+19/−4)packages/api/services/goalProjection.ts(+35/−2)docs/mcp.md(+22/−3)packages/api/test/goalProjection.test.ts(+30/−0)packages/api/test/mcpGoalTaskDepth.test.ts(+11/−11)packages/api/test/mcpMaintenance.test.ts(+53/−0)packages/api/test/mcpObservableSurface.test.ts(+3/−0)packages/api/test/mcpPresentation.test.ts(+7/−0)packages/api/test/mcpResultTimestamps.test.ts(added, +108/−0)packages/api/test/mcpTaskLineage.test.ts(+34/−2)packages/api/test/mcpTaskSubmissions.test.ts(+41/−0)Validation evidence
Diff size: 16 files changed, +463/−28 lines
Detailed Logs:
c6a89214-351f-4c0f-9467-18e49b9ff1deLog files stored at:
/usr/src/app/logs/executions/issue-3598-2026-11-17T03-27-03-561Z-conversation.json/usr/src/app/logs/executions/issue-3598-2026-11-17T03-27-03-561Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3598.
💡 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!