Skip to content

The clamp comment described the wrong failure - #1407

Merged
rbuergi merged 2 commits into
mainfrom
feat/circuit-drain-on-stop
Aug 13, 2026
Merged

rbuergi merged 2 commits into
mainfrom
feat/circuit-drain-on-stop

Conversation

@rbuergi

@rbuergi rbuergi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1342 (Copilot's second finding there; the first — wget → curl — was already fixed on main, with a better fail-open command -v guard, so nothing of that is carried here).

ActiveCircuitTracker.Closed() clamps at zero, and the comment justified it with the wrong direction: "a negative count reads as drained forever after". Drained is Count == 0, so a negative count reads as still busy — the pod would sit out its whole grace period on every roll before being SIGKILLed. And the next open only brings it back to zero, so a live session would then read as drained and get cut off.

Both directions are wrong, which is exactly why the clamp is there; the test already said so and only the source comment was misleading. Comment-only — no behaviour change.

🤖 Generated with Claude Code

rbuergi and others added 2 commits August 13, 2026 11:53
Copilot caught a real defect, not a doc nit. The base image installs curl and has NO wget
(deploy/base-images/portal-ai/Dockerfile), so `until wget …` fails with 127 on every iteration:
the loop never ends and EVERY roll sits out the full 1800s grace before being SIGKILLed — the
opposite of this PR. Verified in the image itself: `command -v curl` → /usr/bin/curl,
`command -v wget` → missing. -f makes the 503 a failure so the loop continues, the 200 ends it.

Also corrects the clamp comment: Drained is Count == 0, so a negative count reads as "still busy"
(hang), and the next open only brings it back to zero (a live session read as drained, cut off).
Both directions are wrong — the test already said so, the source comment did not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…-stop

# Conflicts:
#	deploy/helm/templates/memex-portal/deployment.yaml
Copilot AI lite review requested due to automatic review settings August 13, 2026 09:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Clarifies the XML doc comment on ActiveCircuitTracker.Closed() to correctly explain why the circuit count is clamped at zero, aligning the source comment with the already-correct behavior and existing tests.

Changes:

  • Corrects the rationale in the Closed() documentation: a negative Count makes Drained false (“still busy”), not “drained forever”.
  • Expands the comment to describe both failure modes the clamp prevents (hang-to-grace-period vs. premature drain on subsequent opens).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 0)

723 tests  ±0   723 ✅ ±0   9m 37s ⏱️ - 1m 12s
 10 suites ±0     0 💤 ±0 
 10 files   ±0     0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 3)

   11 files  ±0     11 suites  ±0   5m 19s ⏱️ -2s
1 767 tests ±0  1 662 ✅ ±0  105 💤 ±0  0 ❌ ±0 
2 066 runs  ±0  1 961 ✅ ±0  105 💤 ±0  0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 5)

1 906 tests  ±0   1 714 ✅ ±0   5m 41s ⏱️ -16s
   11 suites ±0     192 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 4)

1 959 tests  ±0   1 951 ✅ ±0   8m 5s ⏱️ -35s
   11 suites ±0       8 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 2)

2 517 tests  ±0   2 516 ✅ ±0   6m 15s ⏱️ +26s
   12 suites ±0       1 💤 ±0 
   12 files   ±0       0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results (shard 1)

1 350 tests  ±0   1 350 ✅ ±0   7m 33s ⏱️ -3s
   11 suites ±0       0 💤 ±0 
   11 files   ±0       0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    66 files  ±0      66 suites  ±0   42m 33s ⏱️ - 1m 41s
10 222 tests ±0   9 916 ✅ ±0  306 💤 ±0  0 ❌ ±0 
10 521 runs  ±0  10 215 ✅ ±0  306 💤 ±0  0 ❌ ±0 

Results for commit b916263. ± Comparison against base commit d8a229b.

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.

2 participants