Skip to content

codev task size under-measures a slice that has been paused and resumed #38

Open

Description

@urban233

Found while publishing #37: codev task size reported 0 lines and 0 files for
a slice whose actual diff was +927/-334 across 17 files.

Cause

task.resume(task_id, head, reason, *, target) calls reopen(...) internally,
which -- by design, per its own docstring -- "only re-baselines base_snapshot
to head and appends one fresh, empty round." That is the correct behavior
for what resume exists to do: give a paused, human-driven correction a clean
round with a raised cap, without spending budget on the interruption itself.

But git_ops._measure uses task.describe_base_snapshot as the diff's base
for the size gate. base_snapshot is one field serving two purposes that
pull in opposite directions: the round-cap machinery wants it to track
"where does the current correction begin," and the size gate wants it to
track "where did this slice begin, for review purposes." resume correctly
serves the first and silently breaks the second.

#37's history: two resume calls landed in this slice's life, each moving
base_snapshot forward. By the time it published, base_snapshot pointed at
a commit two bookkeeping-only commits behind HEAD -- so every line of actual
product change in the slice (a status-matching bug fix, a gitignore rule, a
role-file rewrite, and a correctness-critical drift-check fix) sat before
the measured base and was invisible to codev task size.

Why this matters more than an earlier zero-measurement class of bugs

Earlier holes (#35, closed) reported a confident false zero for a task that
didn't exist, or had no recorded branch -- edge cases at the boundary of the
tracked flow. This one under-measures a real, actively-worked task through
its ordinary, documented lifecycle. ai-agent-guidelines.md states the size
budget's whole premise as "a reviewer reads one pull request, so the budget
applies per slice" -- if base_snapshot moves on every resume, the budget can
be defeated, deliberately or not, by pausing and resuming a slice right
before it would go over.

What is NOT proposed here

Not a specific fix. The right answer requires a real design decision: whether
base_snapshot should split into two fields (a resume-relative one for round
bookkeeping, a slice-relative one for size measurement), whether the size
gate should instead measure from the slice's original recorded base (kept
separately, never moved), or something else. That decision belongs to a
design pass, not a patch buried in an unrelated pull request.

Acceptance criteria

  • A round-tripped design decision on how base_snapshot serves the round
    cap and the size gate without one breaking the other.
  • codev task size reports a slice's real diff regardless of how many
    times it was paused and resumed.
  • A regression test: pause, resume, then assert codev task size still
    measures the slice's full history, not just what followed the last
    resume.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions