Skip to content

fix(nightly-survey-files): print bucket/count to stderr - #531

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-530
May 16, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-530

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

nightly-survey-files.sh exits 0 with no output when today's bucket maps to zero tracked files. The nightly bot can't distinguish empty-bucket success from script breakage, so it spends extra tool calls re-running with stderr capture, cating the source, and re-deriving the bucket math before proceeding. Reported in #530 with two confirmed occurrences on max-sixty/cargo-affected (~5 extra tool calls each).

Solution

Print a one-line status to stderr with the bucket index and match count. Stdout stays clean for callers that pipe the file list. The bot sees # bucket=9/28 files=0 and proceeds immediately.

Switching from git ls-files | while to while … done < <(git ls-files) is required so the count increment survives outside the loop subshell.

Testing

Verified manually in a throwaway repo whose only tracked file hashes to a non-today bucket:

$ bash nightly-survey-files.sh > /tmp/out 2> /tmp/err
$ echo exit=$? lines=$(wc -l < /tmp/out); cat /tmp/err
exit=0 lines=0
# bucket=9/28 files=0

And against this repo (non-empty bucket):

$ bash nightly-survey-files.sh > /tmp/out 2> /tmp/err
$ echo exit=$? lines=$(wc -l < /tmp/out); cat /tmp/err
exit=0 lines=6
# bucket=9/28 files=6

shellcheck is clean.

There is no existing shell-script test framework in this repo to add a regression test to.


Closes #530 — automated triage

Empty buckets are common on small repos; silent stdout was
indistinguishable from a script error and cost the nightly bot
several extra tool calls per occurrence to convince itself the
silence was correct.

Closes #530

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 8c9f1fa into main May 16, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/issue-530 branch May 16, 2026 17:04
This was referenced May 16, 2026
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.23. 6 commits since 0.0.22:

- #520 Cut tend's CI over to the Codex harness — tend now dogfoods Codex
- #531 fix(nightly-survey-files): print bucket/count to stderr — keep
JSON output uncontaminated
- #536 docs(claude-auth): correct June 15 2026 framing; recommend OAuth
for subscribers
- #538 **breaking:** rename default bot-token secret `BOT_TOKEN` →
`TEND_BOT_TOKEN`. Adopters using the default must add a `TEND_BOT_TOKEN`
repo secret before their next regen (or set `secrets.bot_token` in
`.config/tend.yaml` to keep using the old name)
- #539 fix(codex-action): export `CLAUDE_PLUGIN_ROOT` so plugin-bundled
scripts resolve under Codex
- #533 chore: regenerate workflows with tend 0.0.22

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate tend's own workflows to `@0.0.23`

Co-authored-by: Claude <[email protected]>

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.23 — unblocks the review-reviewers Codex migration.

Since 0.0.22:
- #539 — codex-action exports `CLAUDE_PLUGIN_ROOT` so skills using
`${CLAUDE_PLUGIN_ROOT}/scripts/...` work unchanged under Codex (the
blocker on PR #537)
- #538 — `TEND_BOT_TOKEN` as the default bot-token secret name
- #540 — `install-tend --with-install-test` for pre-merge verification
- #536 — docs(claude-auth) framing for 2026-06-15
- #531 — nightly-survey-files prints bucket/count to stderr
- #520 — tend's own CI flipped to the Codex harness (live; consumer
regen moves it forward)

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate main's workflows to `@0.0.23`
- [ ] Regenerate #537's codex workflows to `@0.0.23` and unblock the
review-reviewers migration

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.23. 6 commits since 0.0.22:

- #520 Cut tend's CI over to the Codex harness — tend now dogfoods Codex
- #531 fix(nightly-survey-files): print bucket/count to stderr — keep
JSON output uncontaminated
- #536 docs(claude-auth): correct June 15 2026 framing; recommend OAuth
for subscribers
- #538 **breaking:** rename default bot-token secret `BOT_TOKEN` →
`TEND_BOT_TOKEN`. Adopters using the default must add a `TEND_BOT_TOKEN`
repo secret before their next regen (or set `secrets.bot_token` in
`.config/tend.yaml` to keep using the old name)
- #539 fix(codex-action): export `CLAUDE_PLUGIN_ROOT` so plugin-bundled
scripts resolve under Codex
- #533 chore: regenerate workflows with tend 0.0.22

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate tend's own workflows to `@0.0.23`

Co-authored-by: Claude <[email protected]>

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.23 — unblocks the review-reviewers Codex migration.

Since 0.0.22:
- #539 — codex-action exports `CLAUDE_PLUGIN_ROOT` so skills using
`${CLAUDE_PLUGIN_ROOT}/scripts/...` work unchanged under Codex (the
blocker on PR #537)
- #538 — `TEND_BOT_TOKEN` as the default bot-token secret name
- #540 — `install-tend --with-install-test` for pre-merge verification
- #536 — docs(claude-auth) framing for 2026-06-15
- #531 — nightly-survey-files prints bucket/count to stderr
- #520 — tend's own CI flipped to the Codex harness (live; consumer
regen moves it forward)

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate main's workflows to `@0.0.23`
- [ ] Regenerate #537's codex workflows to `@0.0.23` and unblock the
review-reviewers migration

Co-authored-by: Claude <[email protected]>
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.

nightly-survey-files.sh: print bucket/count to stderr so empty days are unambiguous

2 participants