Skip to content

Add a "blocked" run outcome so a run that stops to report a blocker is not reported as done #3431

Closed

Description

@integry

Problem

There is no way for an implementation or follow-up run to say "I could not do what was asked, here is the blocker". A successful run with no diff goes through handleMissingCommit to handleNoCodeChanges, which posts "No code changes needed - the implementation was already complete", adds the done label and can mark the plan issue as merged. Neither TaskTerminalReason nor AgentTerminationReason has a blocked value. In practice agents therefore either deliver a quietly reduced version of the task or get reported as complete.

Goal

Give runs an explicit, opt-in "stop and report the blocker" outcome with correct downstream handling. Default behaviour is unchanged.

Acceptance criteria

  • A new optional key in .propr/workflow.yml enables the behaviour (suggested: on_blocker: report, default continue = today's behaviour). It follows the existing pattern for optional keys: runtime allow-list and validator, the JSON schema in docs/static/schemas/repository-workflow.schema.json (parity test stays green), the propr init scaffold comment, and the docs page docs/docs/features/repository-workflow.md.
  • When enabled, the implementation prompt and the PR follow-up prompt instruct the agent: if the task cannot be completed as specified, do not deliver a reduced or placeholder version; leave the workspace without partial changes and end with a final message that carries a documented machine-readable blocker marker followed by a short explanation of what blocked it and what is needed.
  • ProPR detects the marker in the agent's final message only (not in arbitrary tool output or file contents) and only when the option is enabled.
  • Issue runs that report a blocker: no commit, no PR, no done label, the plan issue is not marked merged or completed. ProPR posts an issue comment that states the run stopped on a blocker and quotes the agent's explanation (bounded and redacted like other agent text).
  • PR follow-up and /fix runs that report a blocker: nothing is committed or pushed; the completion comment states the blocker instead of the no-change text.
  • The task ends in a terminal state with a distinct terminal reason blocked, visible in task history and MCP get_task/get_task_events. A blocked run is not retried and does not trigger provider replacement.
  • Inside an Ultrafix loop, a blocked fix step stops the loop with a clear reason instead of counting as a completed fix.
  • A warning-severity Inbox notification is created for a blocked run (reuse kind: 'task' with a metadata.event, as the spend-cap notification does; no new notification kind).
  • If the agent emits the marker but also left changes in the worktree, the changes are not committed and the comment says so.
  • With the option absent or set to continue, prompts and outcomes are byte-for-byte what they are today.
  • Tests cover: marker detection (present, absent, marker inside quoted/tool text), issue path, follow-up path, option off, plan-issue status untouched, no replacement/retry, and the workflow schema parity.

Out of scope

  • Detecting silent downscoping from the diff (separate follow-up).
  • Letting the agent ask a question and wait for an answer.
  • UI work beyond what existing task-state rendering already shows.

Implementation

Key files:

  • Outcomes: packages/core/src/utils/workerStateManager.types.ts (TaskTerminalReason), packages/core/src/agents/types.ts (AgentTerminationReason).
  • Issue path: src/jobs/issueJobPostProcessing.ts (handleMissingCommit, handleUnpublishableAgentFailure, performPostProcessing), src/jobs/issueJobPostProcessingHelpers.ts (handleNoCodeChanges), src/jobs/noChangeCompletion.ts, src/jobs/issueJob/completion.ts.
  • Follow-up path: src/jobs/prCompletionComment.ts (buildCompletionComment no-change branch), src/jobs/prCommentPostExecution.ts, src/jobs/prCommentNoAuthorizedFindings.ts (precedent for a non-commit outcome).
  • Prompts: packages/core/src/claude/prompts/promptGenerator.ts (generateClaudePrompt), src/jobs/prCommentJobUtils.ts (buildPrompt), packages/core/src/workflow/repositoryWorkflow.ts (repositoryWorkflowPrompt).
  • Workflow schema: packages/core/src/workflow/repositoryWorkflow.ts (RepositoryWorkflow, parseRepositoryWorkflow allow-lists and validators), docs/static/schemas/repository-workflow.schema.json, packages/cli/src/commands/initCommands.ts, docs/docs/features/repository-workflow.md.
  • Retry/replacement: src/taskReplacement/policy.ts, src/jobs/errorHandlers.ts.
  • Ultrafix: src/jobs/ultrafixLoopContinuation.ts, src/jobs/ultrafixFailedStep.ts, src/jobs/ultrafixLoopContinuationHelpers.ts (finishUltrafixLoop).
  • Notification precedent: notifySpendCap in src/jobs/runCostCap.ts.
  • Marker precedent: src/shared/workEvidenceMarker.ts.

Approach: add the workflow key and thread it into prompt generation; add a small pure parser for the blocker marker in the agent's final message; branch on it before the no-change/commit handling in both the issue and follow-up paths; add the blocked terminal reason and make replacement policy and Ultrafix treat it as terminal and non-retryable.

Tests: test/issueJobPostProcessing.test.ts, test/noChangePlanIssueCompletion.test.ts, test/prCommentAgentUtils.test.ts, test/taskReplacement.test.ts, test/ultrafixLoopContinuation.test.ts, packages/core/test/repositoryWorkflow.test.ts, test/cliInitCommand.test.ts.

Verification: npm run test:prepare, npm run typecheck, node scripts/run-test-suite.mjs <changed test files>, and eslint --max-warnings 0 in each touched package.

Activity

  1. propr-dev commented on Nov 11, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3431/claude-opus-5-5-add-a-blocked-run-outcome-20261111-1911-053
    • Base Branch: main
    • Worktree: issue-3431-20261111-1911-claude-opus-5-5-053

    🔍 Track Task Execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions