Skip to content

chore: execute_work_impl's pre-claim/claim-denied failures are invisible: 0-byte job log, no item comment - #650

Merged
getappz merged 1 commit into
masterfrom
task/204-execute-work-impl-s-pre-claim-claim-deni
Sep 2, 2026
Merged

getappz merged 1 commit into
masterfrom
task/204-execute-work-impl-s-pre-claim-claim-deni

Conversation

@getappz

@getappz getappz commented Sep 2, 2026 •

Copy link
Copy Markdown
Owner

Fixed the silent-failure gap in execute_work_impl (src/cli/work.rs) tracked in this item.

Every pre-pipeline early-return branch — unknown agent, claim failed, claim denied/held/blocked, item-fetch failure after claim, agent-resolution error, no headless print mode, and run_in_worktree failure — now writes its failure message to the log parameter (mirroring the one branch that already did this correctly, the pipeline's own Err arm at the bottom of the function). Previously these only called crate::ui::error, which for an in-process dispatch job goes to the daemon's own stderr, not the job's captured stdout_log_path/stderr_log_path — the only failure surface the dashboard/operators actually see.

Added src/cli/work_claim_denied_tests.rs: a regression test reproducing the literal aY19fOWVYnG9pr9Ws1lUt scenario (job #196) — claims an item under one owner, then runs execute_work_impl under a different owner and asserts the returned log capture names the real "held by" reason instead of coming back empty.

Also found a live instance of exactly this bug while investigating: 7 consecutive dispatch jobs on a different project's item (flare-desktop #3) all showed the identical signature — started_at == finished_at, 0 stdout/stderr bytes, generic wrapper error, zero item comments. Confirms this is a real, currently-occurring gap, not just the original historical repro.

Out of scope per the item's own note, not touched: orphan_reconcile.rs, and root-causing why concurrent dispatches happen in the first place.

Verification: cargo check --all-targets clean, targeted execute_work_impl/work_claim_denied tests pass, full workspace cargo test exits 0 (no failures).


Opened by claude-code on flared:51bb8de6c33b for item #204 via agentflare.

Summary by CodeRabbit

  • Bug Fixes
    • Improved work execution error reporting by recording explicit claim, worktree, agent, and pipeline errors in job logs before displaying them.
    • Claim-denied work now exits with an error without starting the associated pipeline.
  • Tests
    • Added regression coverage verifying claim-denied executions, exit codes, pipeline behavior, and captured log messages.

execute_work_impl had several early-return branches before the
sdd_loop pipeline runs -- unknown agent, claim failed, claim
denied/held/blocked, item-fetch failure, agent-resolution error, no
headless print mode, and run_in_worktree failure -- that reported the
failure only via crate::ui::error, the process's own stderr. For an
in-process dispatch (the path every daemon-dispatched item takes),
that's the daemon's stderr, not the job's own captured
stdout_log_path/stderr_log_path -- the only failure surface the
dashboard/operators actually see. None of these branches wrote
anything to the log parameter already threaded through for exactly
this purpose (mirrored here from the one branch that already did it
correctly, the pipeline's own Err arm).

Reproduced live: job aY19fOWVYnG9pr9Ws1lUt (item #196) started and
finished at the same second with 0 stdout/stderr bytes and no item
comment -- a concurrent-dispatch claim collision that left zero
diagnostic trace anywhere.

Added a regression test reproducing that exact scenario (a claim held
by another owner) and asserting the returned log capture names the
real denial reason instead of coming back empty.

Agentflare-Agent: claude-code
Agentflare-Branch: task/204-execute-work-impl-s-pre-claim-claim-deni
Agentflare-Item: 204
Agentflare-Session: 73d3ceb5-5889-4eb8-aab0-dbe3dbfa4cd1
@getappz

getappz commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

Tracking this PR for automated review (flared:51bb8de6c33b).

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 3cf9dbf0-f21a-48d4-a19d-1cd7b3588d4f

📥 Commits

Reviewing files that changed from the base of the PR and between d45488a and 649a7aa.

📒 Files selected for processing (2)
  • src/cli/work.rs
  • src/cli/work_claim_denied_tests.rs

📝 Walkthrough

Walkthrough

execute_work now records work execution errors in the job log before showing them through the UI. A regression test covers claim denial when another owner holds the claim.

Changes

Work error logging

Layer / File(s) Summary
Record work execution errors
src/cli/work.rs
Explicit-agent, claim, worktree, item-detail, agent-resolution, headless-agent, and execution errors are written to the execution log before UI reporting.
Validate denied-claim logging
src/cli/work.rs, src/cli/work_claim_denied_tests.rs
The test suite includes an integration test that verifies claim denial, exit code 1, no pipeline execution, and the denial reason in the captured log.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/204-execute-work-impl-s-pre-claim-claim-deni

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit 5f33241 into master Sep 2, 2026
1 of 16 checks passed
@getappz
getappz deleted the task/204-execute-work-impl-s-pre-claim-claim-deni branch September 2, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant