Repository navigation
Closed
Description
Context
create_task (in packages/api/mcp/toolsTaskSubmissions.ts) returns a receipt with submissionId, submissionState and, once associated, taskId. get_task_submission reads the task_submissions row, but its projection (projectSubmission) only includes { id, state, issueNumber, issueUrl, taskId, error }. It does not tell the caller:
- whether the associated task is queued, running, completed or failed (the caller has to call
get_taskseparately and needs to know the task id first), - whether a pull request has appeared (needs
list_tasks/list_pull_requestsand manual correlation), - the failure reason when the task failed.
The request is: "Add a way to read a submission's current state by id, so the caller can follow a queued task through to its task id and its PR without blind polling of list_tasks."
Requirements
- Extend
get_task_submissionoutput with aprogressblock, computed server-side in one read:{ "progress": { "stage": "submitted" | "issue_created" | "queued" | "running" | "completed" | "failed" | "cancelled", "issue": { "number": 123, "url": "https://github.com/a/b/issues/123" } | null, "task": { "id": "...", "state": "claude_execution", "updatedAt": "...", "startedAt": "...", "failureReason": null } | null, "pullRequest": { "number": 45, "url": "https://github.com/a/b/pull/45", "state": "open" | "merged" | "closed" | null } | null, "next": "Poll again in ~30s; the agent is implementing." // one human sentence } }stagederivation: submissionprepared/creating→submitted;issue_created→issue_created;queuedwithout task →queued; task latest history state in (pending,queued) →queued; (processing,claude_execution,post_processing) →running;completed/failed/cancelled→ same; submissionfailed→failed(witherror).- Task and PR use the latest task for the submission (
latest_task_idcolumn, falling back totask_id), matching retries. pullRequest.numberfromtasks.pr_number, falling back tofinal_result.postProcessing.pr.number(same fallbacktaskHelpers.tsuses);statevianotification_pull_request_state.merged_at(merged) elsenull(unknown without a GitHub call). Do not call GitHub from this read.failureReasonis the latest historyreasonwhen state isfailed, redacted viaredactSecrets.
- Include the same
progressincreate_task/retry_task_submissionreceipts when polled throughget_operation(viatrackTaskSubmission), so receipts and the direct read agree. Also recordartifacts(submissionId,taskId,pullRequest) on the operation lifecycle. - New tool
list_task_submissions(scoperead): your submissions (owner-scoped byuser_id), optionalrepository,stagefilter (active= submitted/issue_created/queued/running, or an exact stage),sinceMinutes(default 1440, max 10080), paginated (limit≤ 50), newest first, each item with theprogressblock. - New MCP resource
propr://instances/{instance_id}/submissions/{submission_id}that reads throughget_task_submissionguards (register next to the existing task/goal resources inserver.ts). create_taskdescription updated: "Follow progress with get_task_submission (task state and pull request) instead of polling list_tasks."
Implementation Specification
- New helper
packages/api/mcp/submissionProgress.tsexportingsubmissionProgress(db, row)andprogressStage(...). - Edit
packages/api/mcp/toolsTaskSubmissions.ts: use the helper inget_task_submission,trackTaskSubmission, addlist_task_submissions. - Edit
packages/api/mcp/server.ts: register the submission resource. - Tests: extend
packages/api/test/mcpTaskSubmissions.test.ts.
Acceptance Criteria
- After
create_task,get_task_submissionshowsprogress.stage === 'queued'and the issue link. - Inserting a task with history
processingand associating it movesstagetorunningwithprogress.task.idset. - Setting
tasks.pr_number = 45and historycompletedyieldsstage === 'completed'andprogress.pullRequest.number === 45; with anotification_pull_request_statemerged row,state === 'merged'. - A failed task yields
stage === 'failed'and a redactedfailureReason. -
list_task_submissions({ stage: 'active' })returns only the caller's active submissions; another user sees none. - No GitHub request is made by
get_task_submissionorlist_task_submissions(assert fake Octokit call count unchanged).
Created by ProPR AI Planner
Activity
propr-dev commentedon Sep 28, 2026
Suggested Implementation:
Implementation Approach
We compute submission progress purely from ProPR's database (
task_submissions,tasks,task_history,notification_pull_request_state). Calling GitHub for PR state on every poll was rejected: pollers call frequently, quota is shared with workers, and ProPR already persists the PR number and merge state. The PRstateis thereforemergedwhen known andnullotherwise, and the caller can useget_pull_request(or the new work overview) for review/check state.A single helper shared by the direct read, the receipt tracker and the list tool guarantees the three surfaces never disagree.
File:
packages/api/mcp/submissionProgress.ts(new file)Why this file: One derivation for "where is my submission now", consumed by three tools.
File:
packages/api/mcp/toolsTaskSubmissions.tsWhy this file: Owns the submission tools and
trackTaskSubmission; all three consumers of the helper live here.File:
packages/api/mcp/server.tsWhy this file: Resources are registered here (
tasks/{id},goals/{id}…). The submission resource must reuse the tool guards, exactly like existing resources invokeget_task/get_goal.File:
packages/api/test/mcpTaskSubmissions.test.tsWhy this file: Existing fixtures already build submissions, tasks and history in SQLite; extend them.
propr-dev commentedon Sep 29, 2026
🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-5.6-sol2597/gpt-5.6-sol-mcp-task-submissions-expo-20260929-1402-mu92593-epic-mcp-observability-cf6issue-2597-20260929-1402-gpt-5.6-sol-mu9🔍 Track Task Execution
fix(ai): Resolve issue #2597 - MCP task submissions: expose submissio…
fix(ai): Resolve issue #2597 - MCP task submissions: expose submissio…