Skip to content

Surface code-change claim tasks in the tasks list, with their originating prompt - #5071

Open
Evanfeenstra wants to merge 2 commits into
masterfrom
codechange-claim-task-visibility
Open

Surface code-change claim tasks in the tasks list, with their originating prompt#5071
Evanfeenstra wants to merge 2 commits into
masterfrom
codechange-claim-task-visibility

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Contributor

What

Approving a propose_code_change proposal creates a claim Task — but you couldn't see it in the workspace tasks list. This makes it visible, and gives it the prompt that produced it.

Why it was hidden

The list only shows a TODO task if it's agent-mode or Stakwork-backed (tasks/route.ts). The claim is mode: "live" with stakworkProjectId: null and never set status, so it defaulted to TODO and matched none of the three branches. It rendered only in Kanban, which groups by workflowStatus and skips that check entirely.

Changes

Create the claim IN_PROGRESS. Also the honest state — the PR run is in flight. No new terminal transition was needed: the claim already gets a PULL_REQUEST artifact, so pr-monitor and the GitHub webhook carry it to DONE on merge / CANCELLED on close.

Exempt claims from the stale-task halt sweep. This is the part that would have bitten. The halt branch in releaseStaleTaskPods matches any IN_PROGRESS task with no open PR and no pod — no tenant, source, or assignee filter. A claim would be halted after the stale threshold, overwriting the workflowStatus: COMPLETED that pr-monitor's fix path depends on, in precisely the case worth preserving: a PR that never reported back, which code-change-reconcile still expects to recover. Guarded with proposalId: null, which is exact — Task.proposalId is written only by approveCodeChange.

Carry the originating prompt into the claim. It was consumed by the read-only preview run and dropped, so the Task view showed a diff and a PR with no record of what was asked. It now rides on CodeChangeProposalPayload and is seeded as a USER message ahead of the diff. Optional field — proposals stored before this replay result-only.

Scope attachPrArtifact to the ASSISTANT message. Both seed rows are written in one transaction, so createdAt alone can tie and hand back the prompt row. The role filter keeps the PR artifact beside its diff.

Also tightens the propose_code_change prompt guidance from the enforced cap (≤ 50 files) to a focus target of < 10 files, in both the system prompt and the capability snippet. The enforced cap is unchanged.

Verification

  • handleApproval-code-change, codeChangeCompletion, codeChangeTools, code-change-webhook, and the full unit/services + unit/lib/proposals suites: 2863 passed, 1 skipped.
  • New coverage: claim created IN_PROGRESS; prompt seeded as USER ahead of the diff and read from the stored proposal rather than the caller's transcript; back-compat when prompt is absent; attachPrArtifact role targeting and its no-duplicate path.
  • Updated the two release-stale-task-pods assertions that pin the sweep's where-clause.
  • tsc --noEmit clean for production code; eslint clean on changed files.

Note: the repo isn't Prettier-clean on these files, so I formatted by hand to keep the diff reviewable rather than running npm run format.

🤖 Generated with Claude Code

Evanfeenstra and others added 2 commits August 19, 2026 11:10
…ting prompt

Approving a `propose_code_change` proposal creates a claim Task, but it was
invisible in the default tasks list: the list only shows a TODO task when it is
agent-mode or Stakwork-backed, and the claim is neither. It rendered only in
Kanban, which groups by workflowStatus and skips that check.

Create the claim `IN_PROGRESS` instead of letting it default to TODO. That is
also the honest state — the PR run is in flight — and the existing merge paths
(pr-monitor, the GitHub webhook) already carry it to DONE on merge or CANCELLED
on close off the PULL_REQUEST artifact, so no new terminal transition is needed.

Exempt claims from the stale-task halt sweep. That branch matches any IN_PROGRESS
task with no open PR and no pod, with no tenant or source filter, so a claim
would be halted after the stale threshold — overwriting the `workflowStatus:
COMPLETED` that pr-monitor's fix path depends on, in exactly the case worth
keeping intact: a PR that never reported back, which code-change-reconcile still
expects to recover. `proposalId` is written only by approveCodeChange, so it
identifies claims precisely.

Also carry the originating `repo_agent` prompt into the claim. It was dropped
after the preview run, so the Task view showed a diff and a PR with no record of
what was asked. It now rides on the proposal payload and is seeded as a USER
message ahead of the diff. The field is optional: proposals stored before this
replay result-only.

Scope `attachPrArtifact` to the ASSISTANT message. Both seed rows are written in
one transaction, so `createdAt` alone can tie and hand back the prompt row; the
role filter keeps the PR artifact beside its diff.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Test environment is now live.

View it at: https://hive-preview-2.sphinx.chat

Database expires at: Aug 19, 2026, 11:14 PM UTC

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant