Skip to content

fix(daemon): a relay lets go of its target Request once it answers - #1533

Merged
V3RON merged 2 commits into
mainfrom
bug/1409
Nov 11, 2026
Merged

V3RON merged 2 commits into
mainfrom
bug/1409

Conversation

@V3RON

@V3RON V3RON commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1409

Status

Implement: done (1/1 green) Review: round 1, 0 blocking Hardware: n/a Gate: parked, CI install step red twice (runner DNS)
Next: rerun CI when runners resolve the Ubuntu mirror, then the gate

Done when

  • A worker's relay lets every Request it handed a target be collected once the relay has answered (test: src/daemon/relay.test.ts, "lets every Request it handed a target be collected once the relay has answered") — the test fails without the fix and passes 6/6 with it (audit probe and code review)

Assumptions

none

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 1 notes.
Rounds: 1. Tokens: 2.2M.
Runs: 6. Cost USD: 0.9475. Agent seconds: 1580.
Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

After #run completes, RelayConnection.#admitted clears active.request in a finally block. A new test sends bodyless GET and body-bearing PUT requests through the relay. It then runs garbage collection and checks that both request objects are no longer reachable through their weak references.

Severity of issue fixed: High

Merge Risk: Minimal · up to cf6b9

The change releases request objects once the relay has answered, which reduces memory retention in the worker daemon. No concrete merge-blocking risk was found in the changed code.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: releasing target Request objects after the relay answers.
Linked Issues check Passed Issue #1409 identifies request retention in relay paths as one possible source of worker memory growth. The PR clears active.request in RelayConnection.#admitted inside finally, so cleanup also …
Out of Scope Changes check Passed The changes are limited to src/daemon/relay.ts and src/daemon/relay.test.ts. The source change releases the retained Request that the test verifies. The garbage-collection helper and the two req…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Description check Passed The description directly relates to the changes. It identifies the Request-retention fix, the relay garbage-collection test, and the linked issue.
Full details: Linked Issues check

Explanation

Issue #1409 identifies request retention in relay paths as one possible source of worker memory growth. The PR clears active.request in RelayConnection.#admitted inside finally, so cleanup also occurs on errors and early returns. The added relay.test.ts test covers a bodyless GET and a body-bearing PUT and verifies that both handed-off Request objects become collectible after the relay answers. The PR does not claim to implement unrelated issue suggestions such as response streaming, device pruning, heap diagnostics, or lease reattachment.

Full details: Out of Scope Changes check

Explanation

The changes are limited to src/daemon/relay.ts and src/daemon/relay.test.ts. The source change releases the retained Request that the test verifies. The garbage-collection helper and the two request cases provide automated regression coverage for the linked issue objective. No unrelated behavior or files are changed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 345efc71-6fa2-444b-98db-abea616734e3
Commits

Reviewing files that changed from the base of the PR and between 84c85b1 and cf6b90f.

Files selected for processing: 2

  • src/daemon/relay.test.ts
  • src/daemon/relay.ts

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

@V3RON

V3RON commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: cf6b90f

Runs: 6. Cost USD: 0.9475. Agent seconds: 1580.
Tokens input 72, output 19121, cache read 858688, cache write 194226.
- build implementer: claude-sonnet-5-5 309 s $0.0724
- audit implementer: claude-sonnet-5-5 18 s $0.07
- review 1 reviewer: claude-sonnet-5-5 1135 s $0.3013
- review 1 code both: claude-opus-5-5 83 s $0.3695
- review 1 claims: claude-sonnet-5-5 21 s $0.0734
- review 1 spec: claude-sonnet-5-5 14 s $0.0609
Finding outcomes: {"nonblocking":1}. Classes: {"comment imprecise: listener closes over active":1}.
{"findings":[{"id":"R1","role":"claims","class":"comment imprecise: listener closes over active","outcome":"nonblocking","path":"src/daemon/relay.ts","round":"1"}]}

Written by an agent.

@V3RON

V3RON commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • claims: src/daemon/relay.ts:159 the comment says the abort listener closes over active, but the listener at :153 names only channel; it holds in effect because V8 closures in that scope share one context.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 11, 2026 16:16
@V3RON
V3RON merged commit 5ccccba into main Nov 11, 2026
100 of 109 checks passed
@V3RON
V3RON deleted the bug/1409 branch November 11, 2026 22:40
V3RON added a commit that referenced this pull request Nov 29, 2026
…s unattended work, and a red main gets a triage (#1944)

## Not verified

- Stays a draft until #1950 (the gh shim) is on `main` and merged in
here.
- Then one fix-check.
- Reading `AGENTS_PAUSED` through a cloud proxy (a refusal stops cloud
routines); the revert on a real PR.

## Why

Before webhook deliveries: an outsider's issue could reach `main`
unread, nothing paused agents, nothing watched `main` (autonomy 7-10).

## What

- **Outsider hold.** The exit check holds any fix of an issue whose
author cannot write (read from GitHub); `fast-track-review` marks it.
- **Kill switch.** Claim, fast track, gate and red-main stop while repo
variable `AGENTS_PAUSED` exists.
- **Daily cap.** The exit check holds the 9th fix of a `fast-track` bug
merged in 24 hours.
- **Gate.** Checks every bug a PR closes; rereads holds and pause before
merging.
- **Issue text as data.** `claim.mjs <n> --text` writes the issue as
data, quoting non-writers.
- **Red main.** `red-main.mjs` reruns every first try; a test failing
both tries, not `flaky-test`, gets a `bug:new`; a lone `fast-track`
merge gets a ready revert and its bug reopens `bug:blocked`.
- **CI.** A push to `main` no longer cancels the previous push's run.
- **Docs.** Rules 8, 15, 17; DELIVERY.md; the label.
- **Sandbox:** dropped (Proof).

## Proof

Read-only `gh` shims; no write reached GitHub.

```
Outsider hold   entry check (--dry-run) on all 126 bugs filed since 2026-11-01, each as it stood
                when it became bug:ready: 41 pass, 33 of them the historic fast-track bugs (0 lost).
                fast-track-review on 4 outsiders' bugs: #1409 (PR #1533), #1487 (#1518),
                #1583 (#1890) - the 3 unattended merges - and #1714 (#1786), set ready by hand.
Cap             31 fast-track fixes merged since 2026-11-01; busiest 24 hours: 5; held by the cap: 0.
Kill switch     unit tests with a fake gh: claim, fast-track, merge-pr, red-main stop; a 502 stops.
Red main        36 failed CI push runs on main since 2026-11-01, none rerun at the time.
                1st try: 36 reruns. 2nd try, proxied by the next push run: 26 green,
                9 red but no test or job failed in both, 1 with no later run yet.
                Filed: 0. Reverts: 0. (The first rule would have filed 6, 4 followed by green.)
                No real break in the data: the one known (d7bd191, 2026-11-20) has a
                cancelled run, not a failed one. A real break costs one rerun of the failed jobs.
Sandbox         #1912's triage commands under @anthropic-ai/sandbox-runtime 0.0.83:
                gh fails TLS (x509 OSStatus -26276) without enableWeakerNetworkIsolation;
                daemon tests fail listen EPERM on their socket without allowAllUnixSockets;
                with both: gh reads, git fetch, git worktree, 28/28 tests pass.
                Still broken: git push -u (writing .git/config is denied).
                Not settable from .claude/settings.json: strictAllowlist (user or managed only),
                so in bypassPermissions any host is reached; and sandbox.enabled there would also
                sandbox hardware stages.
```

## Review

Spec review: skipped. Code review: 11 blocking, 11 fixed, 1 notes.
Claims review: 2 blocking, 2 fixed, 0 notes.
Rounds: 5. Tokens: 8.1M.
Assessment: complete

*Written by an agent.*
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.

Worker daemon aborts on a V8 out-of-memory error after hours of agent-device e2e traffic, ending every lease

1 participant