Skip to content

Skip branches HEAD already contains when harvesting - #129

Merged
moodmosaic merged 1 commit into
protocol-security:masterfrom
orsissimo:fix/harvest-merged-branches
Nov 3, 2026
Merged

moodmosaic merged 1 commit into
protocol-security:masterfrom
orsissimo:fix/harvest-merged-branches

Conversation

@orsissimo

@orsissimo orsissimo commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

  • harvest.sh: report 0 new commits and skip branches already contained in HEAD. If the ancestry comparison fails with an unexpected status, remove the temporary remote and exit with that status.
  • tests/test_harvest.sh: add section 7.7 covering repeat harvests after merging agent and interactive work, including --dry, unchanged HEAD and tag count, and remote cleanup. Check that an older interactive branch is skipped while new agent work is merged.
  • Document the fix under Unreleased in CHANGELOG.md.

Not in this PR: If agents keep pushing to agent-work after an interactive branch was harvested, or the user committed locally after start, agent-work still does not descend from HEAD and harvest still refuses with the old "does not descend from HEAD" message. Telling this apart from rewritten upstream history needs the bare repo to record where it started, which belongs with step 2 of the bare repo lifecycle work in #115.

Self-review checklist

  • This PR addresses a single concern (why?). If it covers multiple independent changes, I've split them into separate PRs.

Test plan

Validation after rebase onto ad6237d (2026-11-03):

  • Unit suite on macOS: 14 files, 1725 tests, 0 failures.
  • Docker runtime signal tests: 16 passed, 0 failed on the rebased commit. ./tests/test.sh --all passes its unit and runtime phases; API and OAuth phases are skipped as noted below.
  • ShellCheck with the CI flags and git diff --check pass.
  • API and OAuth integration phases skipped: ANTHROPIC_API_KEY and CLAUDE_CODE_OAUTH_TOKEN are not set in this session.

Earlier validation, before this rebase:

  • bash tests/test_harvest.sh: 55 passed. With master's harvest.sh, 8 checks in the new section 7.6 fail.
  • ./tests/test.sh --unit: macOS Bash 3.2.57, 1403 tests; Ubuntu 24.04, 1415 tests as UID 501 and UID 1000. Each run covered 13 files with 0 failures in three full rounds.
  • ./tests/test.sh --runtime: 16 passed on macOS and Ubuntu as UID 501 and UID 1000, in three rounds.
  • ShellCheck: CI command passes.
  • ./tests/test.sh --oauth: passed with a real agent on macOS and Ubuntu as UID 501 and UID 1000.
  • Live run with two real agents on macOS and Ubuntu as UID 501, alongside the same run on master: start, mid-run harvest, stop, interactive session, post-process, harvest, costs.sh, progress.sh, Cleanup and git fsck. The harvest after post-process exits 0 with nothing new; master stops with "does not descend from HEAD" once the interactive branch is merged. Every other step matches master, including the object mode and Cleanup checks that fail on master and that Clone the bare repo and mirrors without hardlinks #127 fixes.
  • ./tests/test.sh --all: not run.

@orsissimo

Copy link
Copy Markdown
Contributor Author

What this doesn't fix (we can brainstorm on how/if to fix it in another PR)

  • Agents still running: if agents keep pushing after you've harvested an interactive session, harvest still refuses the merge.
  • Local commits: the same happens if you committed locally after start.
  • Bad suggestion: in both cases harvest suggests rm -rf of the bare repo, which would throw away the agents' work.

@moodmosaic

Copy link
Copy Markdown
Member

Thank you, @orsissimo! Can you rebase this?

@orsissimo
orsissimo force-pushed the fix/harvest-merged-branches branch 2 times, most recently from 8e4d369 to 2fe0744 Compare November 3, 2026 16:18
@moodmosaic

Copy link
Copy Markdown
Member

One more rebase, @orsissimo. 🚀

@orsissimo
orsissimo force-pushed the fix/harvest-merged-branches branch from 2fe0744 to eed5ebd Compare November 3, 2026 16:24
@moodmosaic
moodmosaic merged commit 90fa087 into protocol-security:master Nov 3, 2026
5 checks passed
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.

2 participants