Skip to content

fix(dispatch): surface merged work on feature branches with no own commits (ENT-1201)#1801

Open
alishakawaguchi wants to merge 2 commits into
mainfrom
ent-1201-dispatch-empty
Open

fix(dispatch): surface merged work on feature branches with no own commits (ENT-1201)#1801
alishakawaguchi wants to merge 2 commits into
mainfrom
ent-1201-dispatch-empty

Conversation

@alishakawaguchi

@alishakawaguchi alishakawaguchi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/898

dispatch --local returned an empty dispatch when run from a feature-branch
worktree that has no commits of its own

The local engine scopes a non-default branch to ..HEAD to isolate the
branch's own work. When the branch has no unique commits that range is empty,
so the reachable-checkpoint-trailer set is empty and every merged checkpoint is
dropped — "no activity" reported while HEAD is sitting on a full window of
merged work.

ENT-1188 already recognized this empty-range problem but patched it only for the
literal default branch, matched by name. The real predicate is "is there any
branch-specific history to isolate?", so detect the empty range directly and
fall back to summarizing everything reachable from HEAD — the same reasoning
ENT-1188 applied to the default branch, generalized. Feature branches with their
own commits keep the scoped ..HEAD view unchanged.

A git failure while measuring the range is treated as non-empty, so the
exclusion is preserved on error (never widens scope).

Note: the default/cloud entire dispatch emptiness for entireio/cli is a
separate backend dispatches/generate bug (the backend holds the checkpoints —
its activity view reports them — but the dispatch generator returns 0); the CLI
sends a correct request. That half is out of scope for this repo.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01XL2teZnsLbEw2xPSy2f9Rs
Entire-Checkpoint: 01KXRRKGDK6VHPYCVE28QW1R8R


Note

Low Risk
Localized change to local dispatch rev-range selection with conservative git-error handling and a dedicated regression test; no auth, data, or API surface changes.

Overview
dispatch --local no longer returns an empty summary when run from a feature-branch worktree that shares HEAD with the default branch and has no commits of its own (typical git-worktree / marvin wt setup).

branchLocalRevRange still scopes non-default branches to <default>..HEAD to isolate branch-only work, but it now checks whether that range is empty via revRangeIsEmpty (git rev-list --count). When the count is zero, it falls back to HEAD so merged checkpoint trailers on the current tip are included—the same behavior ENT-1188 applied only when the current branch matched the default by name. Feature branches that actually have unique commits keep the scoped range unchanged.

If measuring the range fails, the code treats the range as non-empty so scope is never widened on error. A regression test covers the fresh worktree-branch scenario (ENT-1201).

Reviewed by Cursor Bugbot for commit f70b18a. Configure here.

alishakawaguchi and others added 2 commits July 17, 2026 12:24
…mmits (ENT-1201)

`dispatch --local` returned an empty dispatch when run from a feature-branch
worktree that has no commits of its own — the standard `marvin wt` /
git-worktree setup where the branch sits on the up-to-date default branch.

The local engine scopes a non-default branch to <default>..HEAD to isolate the
branch's own work. When the branch has no unique commits that range is empty,
so the reachable-checkpoint-trailer set is empty and every merged checkpoint is
dropped — "no activity" reported while HEAD is sitting on a full window of
merged work.

ENT-1188 already recognized this empty-range problem but patched it only for the
literal default branch, matched by name. The real predicate is "is there any
branch-specific history to isolate?", so detect the empty range directly and
fall back to summarizing everything reachable from HEAD — the same reasoning
ENT-1188 applied to the default branch, generalized. Feature branches with their
own commits keep the scoped <default>..HEAD view unchanged.

A git failure while measuring the range is treated as non-empty, so the
exclusion is preserved on error (never widens scope).

Note: the default/cloud `entire dispatch` emptiness for entireio/cli is a
separate backend `dispatches/generate` bug (the backend holds the checkpoints —
its activity view reports them — but the dispatch generator returns 0); the CLI
sends a correct request. That half is out of scope for this repo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XL2teZnsLbEw2xPSy2f9Rs
Entire-Checkpoint: 01KXRRKGDK6VHPYCVE28QW1R8R
@alishakawaguchi
alishakawaguchi requested a review from a team as a code owner July 17, 2026 23:07
Copilot AI review requested due to automatic review settings July 17, 2026 23:07
@alishakawaguchi

Copy link
Copy Markdown
Contributor Author

bugbot run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a local-dispatch edge case where dispatch --local could incorrectly report “no activity” when run from a feature-branch worktree that has no commits unique to that branch (i.e., <default>..HEAD is empty), by falling back to summarizing everything reachable from HEAD in that situation.

Changes:

  • Generalize the “default branch has nothing to exclude” logic to any empty <base>..HEAD rev-range, ensuring merged work is still surfaced.
  • Add revRangeIsEmpty to detect empty rev-ranges and keep scope conservative on git errors (do not widen).
  • Add a regression test covering feature-branch worktrees with no unique commits (ENT-1201).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/entire/cli/dispatch/mode_local.go Detects empty <base>..HEAD and falls back to HEAD so merged checkpoint trailers aren’t dropped in local dispatch.
cmd/entire/cli/dispatch/mode_local_test.go Adds regression coverage for feature-branch worktrees that share HEAD with the default branch (empty range).

Comment on lines +406 to +411
func revRangeIsEmpty(ctx context.Context, repoRoot, revRange string) bool {
out, ok := runGitOutput(ctx, repoRoot, "rev-list", "--count", revRange)
if !ok {
return false
}
return base + "..HEAD"
return strings.TrimSpace(out) == "0"

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f70b18a. Configure here.

@alishakawaguchi

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f70b18a. Configure here.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants