GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): auto-settle no longer kills an agent's background commands by Pho3niX90 · Pull Request #128 · Pho3niX90/par3

Conversation

@Pho3niX90

@Pho3niX90 Pho3niX90 commented Oct 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

Problem

Auto-settlement detaches a thread's provider session, and that kills any run_in_background command the agent started and is waiting to be woken by. isAutoSettlementCandidate only refused to settle for the background work that keeps a thread in the sidebar's Waiting state. That rule (backgroundWorkHoldsCompletion) deliberately leaves out kind: "command", so a pending background command never held settlement.

What happened in practice: a delegated agent started a 15-minute background poll waiting for CodeRabbit on its PR, then ended its turn. Par3 had the poll recorded in the thread's pendingBackgroundTasks. The PR merged, and the next sweep's thread.settled (server:auto-settle) was followed by provider-session.detached ("Thread settled."). The Claude process exited, the poll died, and the agent was never woken. The same thing happens when a thread settles after three days of inactivity.

The user docs (docs/user/thread-sidebar.md) already promise that "live background work prevent[s] automatic settlement".

Fix

isAutoSettlementCandidate now refuses to settle while any background task is pending, commands included. The sidebar's Waiting status is unchanged. Settling a thread by hand still stops its background work, as before.

Trade-off

A command the user forgot about, such as a dev server, now delays auto-settlement instead of being killed by it:

  • Claude: the idle reaper keeps the session open while it has background work, for up to 4 h (DEFAULT_MAX_IDLE_PIN_MS) on top of the 30-minute idle timeout. It then releases the session, which ends the process and clears the roster (Claude sets backgroundTasksEndWithProcess). The next sweep settles the thread, so the delay is about 4.5 h at most.
  • Codex: the reaper keeps the session open the same way (hasPendingBackgroundWork is true while command items run) and releases it after 4 h. Releasing does not mark the leftover running command_execution item as finished, though. Nothing on the release path or in the adapter finishes it; only Stop, or startup/shutdown recovery, cancels it. So a Codex thread with a forgotten background command stays unsettled until the user presses Stop or the server restarts. Before this PR the sweep settled such a thread anyway; now it waits. Marking Codex command items finished when their session is released would remove that wait, and is a separate fix.

Upstream divergence

This intentionally reverses the settlement part of upstream pingdotgg/t3code#15355, which made a background command settle the thread ("a dev server left running is staleness"). A comment at the changed line says so, and the #15355 test is flipped to the new behaviour, so the next upstream merge conflict is easy to resolve: keep our version.

Tests

  • ThreadSettlementService.test.ts: a thread whose agent waits on a background command is no longer an auto-settlement candidate.
  • vp test run passed for ThreadSettlementService, ProjectionSettlement, Orchestrator.control-reads, runtimeLayer and BackgroundWorkStop.integration. tsc-rs --noEmit for apps/server passed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Pho3niX90
fix(server): auto-settle no longer kills an agent's background commands
d4c9252
Auto-settlement skipped only the background work that keeps a thread
Waiting, which leaves out commands. Settling detaches the provider
session, so a run_in_background command an agent was waiting on (such as
a PR-check poll) was killed when its PR merged or the thread went
inactive. Any pending background task now blocks auto-settlement, as the
user docs already promise. Settling by hand still stops it.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af692471-8126-4d5d-9bec-8fe25eb540e4
📥 Commits

Reviewing files that changed from the base of the PR and between 75ab83f and d4c9252.

📒 Files selected for processing: 2
  • apps/server/src/orchestration-v2/ThreadSettlementService.test.ts
  • apps/server/src/orchestration-v2/ThreadSettlementService.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 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 5.0 KiB 5.0 KiB 0 B (0.0%) 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 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB −7 B (−0.1%) 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 −7 B (−0.6%) 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 2 2 0 (0.0%) 8 ✅

Baseline: 75ab83f · PR result: d4c9252 · 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Pho3niX90 Pho3niX90 closed this Oct 18, 2026
@Pho3niX90
Pho3niX90 deleted the fix/auto-settle-keeps-background-commands branch October 18, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:XS vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Pho3niX90
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.