fetch-review-threads emits `"threads": null` for PRs with zero threads, triggering a false "invalid or truncated" warning

Open Beginner friendly
#9,237 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, go, json
Domain
api, devtools

Research direction

Start in internal/forge/github/github.go where the review-thread fetch initializes its result as forge.ReviewThreadPage{} and appends threads; the nil slice is what encodes as null in internal/cli/fetchreviewthreads.go. Initialize Threads as an empty slice and add a unit test in internal/cli asserting a zero-thread PR emits "threads": []. Done when that test passes and the empty-result output is a JSON array.

Written by the indexing model from the issue text.

Description

What happened

Review 2 on PR #45 (run 42694315057, pre-script at about 20:36 UTC) logged "Review thread fetch was invalid or truncated — human dismissals cannot be verified". At that point the PR had zero review threads; the first was created at 20:45:29.

Cause:

  • In fullsend v0.54.0, the GitHub forge starts from result := forge.ReviewThreadPage{} and only appends threads (github.go#L4056, #L4131).
  • With no threads, the slice stays nil and internal/cli/fetchreviewthreads.go encodes it as "threads": null.
  • The agents-side consumer forge_get_human_dismissals requires .threads to be an array, so it reports invalid or truncated output (review-ops.lib.sh#L79-L84).

What could go better

I'm confident about the cause, from reading the code paths at the pinned versions. It is not proven in a debugger.

The impact today is mostly noise: with zero threads there are no dismissals to apply. But the warning claims human dismissals "cannot be verified", which wrongly suggests a data-integrity problem. Every first re-review of a PR without inline threads will hit it. That misleads maintainers and retro analysis, and it masks the real truncation case the warning was written to catch.

Proposed change

In internal/forge/github/github.go, in the review-thread fetch, initialize the result with Threads: []forge.ReviewThread{} (or the equivalent field and type in internal/forge/forge.go), so an empty page encodes as "threads": []. Do the same in the GitLab implementation if it uses the same pattern.

Add a unit test in internal/cli for fetch-review-threads: a PR with zero threads must produce a JSON array, not null.

Optionally, also make the agents-side check in scripts/lib/review-ops.lib.sh accept null as empty (.threads // []) for backward compatibility with older CLI versions. That would be a separate small change in fullsend-ai/agents.

Validation criteria

  • Unit test: fetch-review-threads output for a zero-thread PR contains "threads": [].
  • Live check: across the next 5 re-reviews of PRs with no inline review threads, the pre-review log no longer prints "Review thread fetch was invalid or truncated".

Related issues checked

Searched: review thread fetch truncated / invalid or truncated human dismissals (fullsend-ai/fullsend, fullsend-ai/agents, shairevivo/react-shopping-cart); reviewThreads pagination / fetch-review-threads null / ReviewThreadPage threads empty
Considered: fullsend-ai/agents#1515, #8174
agents#1515: test coverage for the reviewThreads pagination loop; does not cover nil-slice encoding of an empty result. #8174 (closed): normalizing thread position metadata across forges; unrelated to empty-result encoding.


Generated by retro agent from https://github.com/shairevivo/react-shopping-cart/pull/45

Dominant language
Go
Stars
146
Forks
112
Avg merge
1d 16h
Merged PRs (30d)
358

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fullsend-ai/fullsend

All issues in fullsend-ai/fullsend

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.