Skip to content

fix(server): threads settle as soon as branch status sees their PR merge - #17148

Merged
t3dotgg merged 2 commits into
mainfrom
fix/status-pr-settles-thread
Oct 8, 2026
Merged

t3dotgg merged 2 commits into
mainfrom
fix/status-pr-settles-thread

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Oct 8, 2026

Copy link
Copy Markdown
Member

A merged PR showed "Merged" in the thread details panel, but the sidebar badge stayed open and the thread did not settle for about 40 seconds (seen on #17137).

#16761 fixed this for one read path: a PullRequestService.detail read that sees a new state tells the sync reactor, which re-reads the PR and updates the thread's link right away. But for a worktree thread on the PR branch, the panel shows the branch status lookup (GitManager → lookupStatusPr). That lookup told nobody, so only the 1-minute sweep caught the merge.

Now GitManager remembers the state its PR lookup last read for each PR. When the state changes, it announces the PR. The sync reactor listens to that stream as well as the detail stream. The status result is never trusted directly: the reactor still does its own fresh read before it changes the link.

Cost: at most one extra summary read when a branch lookup sees a PR change state.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high.

Created with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

t3dotgg and others added 2 commits October 8, 2026 02:29
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 8, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 8, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Oct 8, 2026
Comment thread apps/server/src/git/GitManager.ts
@macroscopeapp

macroscopeapp Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d85a48c

Macroscope's review found this PR approvable — This is a focused server-side bug fix that adds in-memory PR state notifications and reuses the existing sync path, with targeted tests and no default, schema, deployment, security, billing, or authentication changes. An unresolved Medium automated finding notes that GitHub Enterprise URLs can still miss notifications, so that limitation remains a known risk.

Notes:

  • This verdict was updated automatically after the outstanding correctness findings were resolved. Macroscope did not re-review the code.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 4.9 KiB 5.0 KiB +23 B (+0.5%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB +23 B (+1.9%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.8 KiB 20.9 KiB +41 B (+0.2%) 29.3 KiB ✅
Codex Live turn messages 1 2 +1 (+100.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Baseline: 9381533 · PR result: d85a48c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 46800b26-d710-401e-b4a4-443a3cc10e9d
📥 Commits

Reviewing files that changed from the base of the PR and between 9381533 and d85a48c.

📒 Files selected for processing (4)
  • apps/server/src/git/GitManager.test.ts
  • apps/server/src/git/GitManager.ts
  • apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
  • apps/server/src/orchestration-v2/PullRequestSyncReactor.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

GitManager now publishes pull-request state changes observed during lookups. PullRequestSyncReactor merges those notifications with pull-request service notifications and requests synchronization when either stream emits.

Changes

Pull-request state sync

Layer / File(s) Summary
Track and publish lookup state changes
apps/server/src/git/GitManager.ts, apps/server/src/git/GitManager.test.ts
GitManager validates and normalizes pull-request lookup results, remembers observed states in a bounded map, and publishes keys when states change. Tests cover changes from open to merged and a first lookup that is merged.
Use state notifications to request sync
apps/server/src/orchestration-v2/PullRequestSyncReactor.ts, apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
PullRequestSyncReactor merges notifications from GitManager and PullRequestService. The test harness provides an empty GitManager notification stream.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant GitManager
  participant PullRequestService
  participant PullRequestSyncReactor
  GitManager->>PullRequestSyncReactor: Publish pull-request state change
  PullRequestService->>PullRequestSyncReactor: Publish pull-request state change
  PullRequestSyncReactor->>PullRequestSyncReactor: Request sync for either notification
Loading

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to d85a4

No confirmed issue currently prevents merging. Normal checks should still run.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main server fix: threads settle when branch status detects that a pull request has merged.
Description check ✅ Passed The description clearly explains the problem and the implementation. It references related issue context and describes the expected verification scope. It does not use the required section headings an…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@t3dotgg
t3dotgg merged commit 0ce6b9d into main Oct 8, 2026
33 checks passed
@t3dotgg
t3dotgg deleted the fix/status-pr-settles-thread branch October 8, 2026 09:38
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 8, 2026
## What's Changed
* feat(providers): run Muse Code as a native provider by @t3dotgg in pingdotgg/t3code#17082
* feat(web): compact-before-send is a chip that shows the token count by @t3dotgg in pingdotgg/t3code#17127
* fix(clients): copy button is back in its old spot, before fork by @t3dotgg in pingdotgg/t3code#17137
* fix(usage): repeat usage scans no longer decode unchanged Antigravity databases by @t3dotgg in pingdotgg/t3code#17139
* fix(server): shell snapshots no longer block other database reads while decoding by @t3dotgg in pingdotgg/t3code#17141
* perf(server): ACP tool updates no longer persist a snapshot per streamed chunk by @darjss in pingdotgg/t3code#16682
* feat(web): filter the Usage page to just the providers you want by @t3dotgg in pingdotgg/t3code#16970
* fix(usage): Cursor account history loads about 4x faster by @t3dotgg in pingdotgg/t3code#17140
* fix(server): threads settle as soon as branch status sees their PR merge by @t3dotgg in pingdotgg/t3code#17148
* perf(usage): the Usage page shows numbers in under a second and dims only what is still loading by @t3dotgg in pingdotgg/t3code#17147
* fix(server): an agent can settle its own thread when its turn ends by @t3dotgg in pingdotgg/t3code#17145
* feat(web): Add provider button sits with the provider list by @t3dotgg in pingdotgg/t3code#17152

## New Contributors
* @darjss made their first contribution in pingdotgg/t3code#16682

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261008.2813...v0.0.46-nightly.20261008.2819

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261008.2819
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 8, 2026
## What's Changed
* feat(providers): run Muse Code as a native provider by @t3dotgg in pingdotgg/t3code#17082
* feat(web): compact-before-send is a chip that shows the token count by @t3dotgg in pingdotgg/t3code#17127
* fix(clients): copy button is back in its old spot, before fork by @t3dotgg in pingdotgg/t3code#17137
* fix(usage): repeat usage scans no longer decode unchanged Antigravity databases by @t3dotgg in pingdotgg/t3code#17139
* fix(server): shell snapshots no longer block other database reads while decoding by @t3dotgg in pingdotgg/t3code#17141
* perf(server): ACP tool updates no longer persist a snapshot per streamed chunk by @darjss in pingdotgg/t3code#16682
* feat(web): filter the Usage page to just the providers you want by @t3dotgg in pingdotgg/t3code#16970
* fix(usage): Cursor account history loads about 4x faster by @t3dotgg in pingdotgg/t3code#17140
* fix(server): threads settle as soon as branch status sees their PR merge by @t3dotgg in pingdotgg/t3code#17148
* perf(usage): the Usage page shows numbers in under a second and dims only what is still loading by @t3dotgg in pingdotgg/t3code#17147
* fix(server): an agent can settle its own thread when its turn ends by @t3dotgg in pingdotgg/t3code#17145
* feat(web): Add provider button sits with the provider list by @t3dotgg in pingdotgg/t3code#17152

## New Contributors
* @darjss made their first contribution in pingdotgg/t3code#16682

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261008.2813...v0.0.46-nightly.20261008.2819

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261008.2819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants