Skip to content

fix(workload): let Ctrl-C stop the intercept session cleanly#6031

Draft
devantler wants to merge 12 commits into
mainfrom
claude/intercept-sigint-unwind
Draft

fix(workload): let Ctrl-C stop the intercept session cleanly#6031
devantler wants to merge 12 commits into
mainfrom
claude/intercept-sigint-unwind

Conversation

@devantler

@devantler devantler commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Engineer

Why

workload intercept tells the user to press Ctrl-C to stop, but the interrupt killed the process outright. The tunnel never drained and the in-cluster steering agent was left with a dead peer instead of an orderly teardown.

What

SIGINT and SIGTERM now cancel one signal-aware context installed before cluster setup. Resolution, steering-agent injection, readiness waits, and the tunnel all unwind through that context, and signal cancellation maps to the documented exit status 0. Regression coverage raises both termination signals and proves setup cancellation finishes before its readiness timeout. Generated command help documents the clean shutdown contract.

Scope

This PR is limited to the #6010 intercept shutdown fix. The separate schema-description generator bug discovered during review is tracked by #6035 and implemented in draft #6036; duplicate schema, autoscaler, and generated-reference hunks were removed from this branch.

Fixes #6010 · Part of #4521

Summary by CodeRabbit

  • New Features

    • workload intercept now stops cleanly when interrupted with Ctrl-C, SIGINT, or SIGTERM.
    • Clean interruptions return exit status 0.
    • Shutdown now tears down the tunnel and allows in-cluster redirect restoration.
  • Documentation

    • Updated command help and CLI documentation to describe clean interruption behavior.
  • Bug Fixes

    • Interruptions during setup no longer hang or wait for readiness timeouts.

SIGINT previously hit the default disposition and killed the process with
status 130, so the tunnel session and its local connections never unwound
through their cleanup paths and the in-cluster agent was left to notice the
dead peer on its own. Wrap the steering session in a signal-aware context
(signal.NotifyContext, SIGINT/SIGTERM), mirroring the mirror command's fix,
so an interrupt cancels the session context: ServeIntercepted maps the
cancellation to a clean stop, every pump is torn down and drained, and the
command exits 0 as its help text now documents.

Fixes #6010

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

workload intercept now handles Ctrl-C, SIGINT, and SIGTERM through signal-aware cancellation, cleanly unwinds setup and sessions, documents exit status 0, and adds tests for interruption during setup and session execution. Shared injection wiring now accepts explicit contexts.

Changes

Intercept signal shutdown

Layer / File(s) Summary
Signal-aware intercept session
pkg/cli/cmd/workload/intercept.go
Signal-aware contexts are propagated through pod resolution, steering setup, readiness, and session execution; signal cancellation returns success.
Shared injection context wiring
pkg/cli/cmd/workload/intercept.go, pkg/cli/cmd/workload/mirror.go
Injection and readiness accept explicit contexts, with mirror passing its command context.
Interrupt validation and documentation
pkg/cli/cmd/workload/intercept_test.go, docs/src/content/docs/cli-flags/workload/workload-intercept.mdx
Tests cover SIGINT, SIGTERM, setup interruption, and help text; documentation describes clean shutdown and exit status 0.

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

Possibly related issues

  • Issue 6038 — Related to the intercept command’s signal and clean-exit handling, but described as addressing a different failure mode.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making Ctrl-C stop workload intercept cleanly.
Linked Issues check ✅ Passed The PR matches #6010 by adding signal-aware cancellation, clean session teardown, and regression tests for SIGINT/SIGTERM and setup interruption.
Out of Scope Changes check ✅ Passed The changed files all support the intercept shutdown fix and its docs/tests, with no unrelated feature work visible.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

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

…nt-unwind

# Conflicts:
#	pkg/svc/chat/docs_generated.go
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

✅ Linters with no issues

actionlint, bash-exec, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, markdownlint, prettier, prettier, shellcheck, shfmt, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-code-quality

github-code-quality Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Go

Go / code-coverage/go

The overall coverage in the branch remains at 66%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File cc298ca 09a9945 +/-
pkg/cli/cmd/wor...ad/intercept.go 77% 81% +4%

Updated July 11, 2026 09:36 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Sure, I'll perform a full review of all the changes in this PR.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/svc/chat/docs_generated.go`:
- Line 7: Escape the literal pipe characters that occur inside Markdown table
cells in the declarative configuration source, including entries such as
“kind.yaml |” and “true=Enabled |”, so they no longer terminate cells; then
regenerate the embedded documentation via `go generate ./pkg/svc/chat/...`,
updating `generatedDocumentation` accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55b8a60f-8cf3-4ae7-b1a3-3348ddfc67a9

📥 Commits

Reviewing files that changed from the base of the PR and between 00f35e2 and adb3ef9.

📒 Files selected for processing (4)
  • docs/src/content/docs/cli-flags/workload/workload-intercept.mdx
  • pkg/cli/cmd/workload/intercept.go
  • pkg/cli/cmd/workload/intercept_test.go
  • pkg/svc/chat/docs_generated.go

Comment thread pkg/svc/chat/docs_generated.go Outdated
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Resolved the Docstring Coverage pre-merge failure in 4f04a873 by documenting both new interrupt regression tests. Focused validation passed:

go test ./pkg/cli/cmd/workload -run 'TestInterceptCmd(HelpDocumentsCleanInterruptExit|InterruptStopsSessionCleanly)$' -count=1

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Sounds good, thanks for the update. I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

@coderabbitai full review

Please recompute the pre-merge checks on current head 9ba125da; all changed/new named functions now carry descriptive comments.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — I'll perform a full review of the PR at head 9ba125da, including the pre-merge checks, now that the new interrupt regression test functions carry descriptive comments.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/cli/cmd/workload/intercept.go (1)

274-301: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Create the signal-aware context before setup resolveInjectionPoint and ensureSteer still run on cmd.Context(), so Ctrl-C during --wait-timeout can bypass clean shutdown and kill the process abruptly. Move signal.NotifyContext earlier and thread it through setup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/cmd/workload/intercept.go` around lines 274 - 301, Create the
signal-aware context with signal.NotifyContext before resolveInjectionPoint and
ensureSteer in the intercept command flow, then pass that context through both
setup calls and runInterceptSession. Use the derived context consistently
instead of cmd.Context(), and keep the deferred stop cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/svc/chat/docs_generated.go`:
- Line 7: Fix the truncated documentation table cells in the source declarative
configuration page for `distributionConfig`, `NodeAutoscalerConfig.enabled`, and
`NodeAutoscalerConfig.expander`, ensuring each description is complete and
properly closed. Then rerun `go generate ./pkg/svc/chat/...` so the
`generatedDocumentation` constant in `docs_generated.go` is regenerated from the
corrected source.

---

Outside diff comments:
In `@pkg/cli/cmd/workload/intercept.go`:
- Around line 274-301: Create the signal-aware context with signal.NotifyContext
before resolveInjectionPoint and ensureSteer in the intercept command flow, then
pass that context through both setup calls and runInterceptSession. Use the
derived context consistently instead of cmd.Context(), and keep the deferred
stop cleanup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd4e4acb-387d-414a-a849-03bd0ba89d49

📥 Commits

Reviewing files that changed from the base of the PR and between 00f35e2 and 9ba125d.

📒 Files selected for processing (4)
  • docs/src/content/docs/cli-flags/workload/workload-intercept.mdx
  • pkg/cli/cmd/workload/intercept.go
  • pkg/cli/cmd/workload/intercept_test.go
  • pkg/svc/chat/docs_generated.go

Comment thread pkg/svc/chat/docs_generated.go Outdated
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Resolved the outside-diff interrupt finding in eef181b. The signal-aware context is now installed before any client or cluster setup, then propagated through pod resolution, steering injection and readiness, and the tunnel session. Signal-driven context cancellation is normalized to the documented clean exit.

The regression test reproduced the pre-fix failure as signal: interrupt when SIGINT arrived during setup, then passed after the fix. Validation passed: 1,193 affected-package tests, two focused signal tests, scoped golangci-lint, the Go build, and the Astro docs build with link validation.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — I'll review the latest changes now that the signal-aware context is installed before client/cluster setup and propagated through pod resolution, steering injection/readiness, and the tunnel session.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

@coderabbitai full review

Please recompute the pre-merge checks on current head cb2c1ce. Every changed or new named function now has a descriptive comment immediately before its declaration, including the process-wide signal tests whose nolint directives were moved above their doc comments.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — I'll perform a full review of the PR at head cb2c1ced and recompute the pre-merge checks, now that every changed or new named function has a descriptive comment immediately before its declaration, including the process-wide signal tests with the nolint directives moved above their doc comments.

✅ Action performed

Full review finished.


You're currently rate limited under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. Your next review will be available in 10 minutes.

devantler and others added 2 commits July 11, 2026 00:24
The signal-aware context was installed only around the steering session, so
Ctrl-C during injection-point resolution or the steering agent's
--wait-timeout wait hit the default disposition and killed the process
abruptly. Install signal.NotifyContext before the first Kubernetes call and
thread it through setup via cmd.SetContext, so an interrupt during setup
cancels cleanly. Red/green-proven with a setup-phase interrupt test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…into claude/intercept-sigint-unwind

# Conflicts:
#	pkg/cli/cmd/workload/intercept.go
#	pkg/cli/cmd/workload/intercept_test.go
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Resolution record for the ⚠️ outside-diff-range body finding (setup runs on cmd.Context()): fixed — signal.NotifyContext now installs before the first Kubernetes call and threads through injection-point resolution, steering-agent injection, and the readiness wait, with signal-driven cancellation during setup mapped to the documented clean stop. Red/green-proven by a setup-phase interrupt test (TestInterceptCmdInterruptDuringSetupStopsCleanly); the docs-table thread is resolved via the jsonschema_description migration (class fix in #6036).

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — thanks for the detailed resolution record. I'll review the latest changes now that signal.NotifyContext is installed before the first Kubernetes call and threaded through injection-point resolution, steering-agent injection, and the readiness wait, with the setup-phase interrupt test (TestInterceptCmdInterruptDuringSetupStopsCleanly) covering the fix, and noting the docs-table thread is tracked separately in #6036.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

goconst flags the third occurrence of the "windows" literal introduced by
the setup-interrupt regression tests; fold the identical three-line skip
block into one skipIfInterruptUnsupported helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Documented the touched test functions with concise intent comments. A file-wide AST audit now finds exact-name Go documentation on 56 of 69 named functions (81.16%). Validation: go test ./docs ./pkg/cli/cmd/workload -count=1 (581 tests), scoped golangci-lint, and git diff --check all pass.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — thanks for the update on the docstring coverage (now 81.16%, 56/69 named functions documented) and the passing validation (581 tests across ./docs and ./pkg/cli/cmd/workload, scoped golangci-lint, and git diff --check). I'll perform a full review of the latest changes now.

✅ Action performed

Full review finished.


You're currently rate limited under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. Your next review will be available in 6 minutes.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Adaptive-review cooldown elapsed; re-requesting the full review for head 2526247 after the documentation-only gate fix.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — I'll perform a full review of the PR at head 25262476 now that the adaptive-review cooldown has elapsed and the documentation-only gate fix is in place.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
pkg/cli/cmd/workload/intercept_test.go (1)

204-227: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider adding SIGTERM coverage alongside the SIGINT (Ctrl-C) test.

Issue #6010 calls for handling both SIGINT and SIGTERM through the signal-aware context, and runInterceptCommand registers syscall.SIGTERM alongside os.Interrupt. The new regression tests only exercise os.Interrupt; a companion test raising syscall.SIGTERM (mirroring this stub) would close the coverage gap for the other registered signal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/cmd/workload/intercept_test.go` around lines 204 - 227, Add a
companion test for SIGTERM alongside
TestInterceptCmdInterruptStopsSessionCleanly, using the existing
stubInterruptingInterceptSession setup and command assertions; trigger
syscall.SIGTERM and verify cmd.Execute returns no error, confirming
runInterceptCommand handles both registered termination signals.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/src/content/docs/configuration/declarative-configuration.mdx`:
- Line 416: The maxNodesTotal description ends with an incomplete sentence.
Update the source description for maxNodesTotal to say “This value should be <=
serverLimit.”, then regenerate the declarative configuration MDX documentation
rather than editing the generated file directly.

In `@pkg/apis/cluster/v1alpha1/types.go`:
- Line 94: Update the jsonschema_description on DistributionConfig to include
kwok/, gke.yaml, and aks.yaml alongside the existing supported paths, then
regenerate the schema and documentation artifacts using the repository’s
standard generation workflow rather than editing generated files manually.

In `@pkg/cli/cmd/workload/intercept_test.go`:
- Around line 168-192: Replace the fixed 100ms wait in
stubInterruptingInterceptSetup and the analogous setup at the referenced
location with bounded synchronization on the cancellation signal, using the
select/polling pattern from stubInterruptingInterceptSession. Wait for
ctx.Done() or a bounded timeout before returning context.Canceled, preserving a
timeout fallback so the test cannot hang and cleanInterceptCancellation observes
the canceled context deterministically.

---

Nitpick comments:
In `@pkg/cli/cmd/workload/intercept_test.go`:
- Around line 204-227: Add a companion test for SIGTERM alongside
TestInterceptCmdInterruptStopsSessionCleanly, using the existing
stubInterruptingInterceptSession setup and command assertions; trigger
syscall.SIGTERM and verify cmd.Execute returns no error, confirming
runInterceptCommand handles both registered termination signals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af3306c0-aee0-4d1a-99a7-263e211ae8a9

📥 Commits

Reviewing files that changed from the base of the PR and between 00f35e2 and 2526247.

⛔ Files ignored due to path filters (1)
  • web/ui/src/generated/ksail-config.ts is excluded by !**/generated/**
📒 Files selected for processing (11)
  • docs/fielddocs_test.go
  • docs/src/content/docs/cli-flags/workload/workload-intercept.mdx
  • docs/src/content/docs/configuration/declarative-configuration.mdx
  • pkg/apis/cluster/v1alpha1/autoscaler.go
  • pkg/apis/cluster/v1alpha1/types.go
  • pkg/cli/cmd/workload/intercept.go
  • pkg/cli/cmd/workload/intercept_test.go
  • pkg/cli/cmd/workload/mirror.go
  • pkg/cli/cmd/workload/mirror_test.go
  • pkg/svc/chat/docs_generated.go
  • schemas/ksail-config.schema.json

Comment thread docs/src/content/docs/configuration/declarative-configuration.mdx Outdated
Comment thread pkg/apis/cluster/v1alpha1/types.go Outdated
Comment thread pkg/cli/cmd/workload/intercept_test.go
Replace timing-based setup cancellation with a context-driven readiness wait, cover SIGINT and SIGTERM through one table, and remove duplicate schema changes now owned by #6036.
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Resolved all current review findings on head 986ec04:

Validation passed: make generate; 1,128 affected tests; 561 full workload tests; scoped golangci-lint; Astro build plus link validation; git diff --check.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@devantler Understood — thanks for the detailed update. I'll perform a full review of the PR at head 986ec04f now that:

  • The fixed setup delay has been replaced with a real signal-canceled readiness wait (bounded by a 5s timeout, sub-2s assertion).
  • Table-driven SIGINT and SIGTERM clean-shutdown coverage has been added.
  • The duplicate #6035/fix(schema): stop commas truncating jsonschema description tags #6036 schema, autoscaler, and generated-reference changes have been removed, keeping this PR scoped to #6010.
✅ Action performed

Full review finished.


You're currently rate limited under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. Your next review will be available in 20 minutes.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

Please recompute only the pre-merge checks at current head 986ec04f. The schema, autoscaler, and generated-reference files named by the prior Out of Scope result were removed from this PR and are handled by #6035/#6036.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

The current head 986ec04f contains exactly five files, all required by the #6010 interrupt-shutdown fix: intercept.go, its signal/cancellation regression tests, the generated intercept CLI reference, mirror.go's matching help text, and the generated chat-doc mirror. There are no autoscaler, schema, or fielddocs files in the current diff; those moved to #6036. Please refresh the walkthrough against the current head and recompute the Out of Scope result.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler Understood — I'll refresh the walkthrough against head 986ec04f and recompute the Out of Scope result now that the diff is scoped to exactly the five files needed for the #6010 interrupt-shutdown fix (intercept.go, its signal/cancellation regression tests, the generated intercept CLI reference, mirror.go's matching help text, and the generated chat-doc mirror), with the autoscaler/schema/fielddocs changes moved to #6036.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

The Out of Scope Changes warning refers to autoscaler/schema/fielddocs changes that are no longer on this branch — the diff is now exactly the five files needed for the #6010 interrupt fix (intercept.go, its tests, the generated intercept CLI reference, mirror.go help text, and the generated chat doc). The class-wide schema/doc migration lives in #6036. Please recompute against head.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Live-cluster evidence for this PR from the #5971 validation pass (Kind/Docker, 2026-07-11): on current main (without this fix), a plain SIGINT kills the intercept client without a graceful exec-channel close, and the in-cluster steering agent — whose stdin never sees EOF — keeps the pod's REDIRECT rule installed indefinitely (observed: rule + agent process still live 35s after client death, workload traffic black-holed; filed as #6040 for the crash-class liveness fix). This PR's signal-aware context threading is the load-bearing fix for the common Ctrl-C path reaching the graceful teardown. Full findings on #5971.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai The Out of Scope Changes warning (re-evaluated 02:20Z) cites "config schema/docs and fielddoc tests", but none of those are in the current 5-file diff: intercept.go, intercept_test.go, mirror.go (the shared signal-context helper the fix extracts), plus two generated artifacts — docs/src/content/docs/cli-flags/workload/workload-intercept.mdx and pkg/svc/chat/docs_generated.go — which the docs generator re-emits for the intercept command's own flag-text change (repo convention: generated files are regenerated in the same PR, never hand-edited). There is no config-schema or fielddoc-test change on this branch. Please re-evaluate the Out of Scope Changes check against the current head.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
cd /repo 2>/dev/null || true
gh pr diff 6031 --name-only 2>/dev/null || true

Length of output: 426


@devantler I've verified this directly against the repository — gh pr diff 6031 --name-only on the current head returns exactly the five files you listed:

  • docs/src/content/docs/cli-flags/workload/workload-intercept.mdx
  • pkg/cli/cmd/workload/intercept.go
  • pkg/cli/cmd/workload/intercept_test.go
  • pkg/cli/cmd/workload/mirror.go
  • pkg/svc/chat/docs_generated.go

There is no config-schema, fielddocs, or autoscaler file in the current diff. I'll re-run the review now so the pre-merge checks and Out of Scope Changes result are recomputed against this head.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/svc/chat/docs_generated.go`:
- Line 7: Fix the upstream jsonschema descriptions for the fields represented by
distributionConfig, NodeAutoscalerConfig.enabled, and
NodeAutoscalerConfig.expander so they contain complete, properly escaped
table-safe text rather than truncating at pipe characters; locate the
corresponding schema/type definitions by their field names and verify all
descriptions are complete. Then regenerate the artifact with go generate
./pkg/svc/chat/... and confirm the generated configuration table contains the
full descriptions; do not edit generatedDocumentation directly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c02bba6-afb8-4d3e-a723-131bee6f6969

📥 Commits

Reviewing files that changed from the base of the PR and between 2526247 and 986ec04.

📒 Files selected for processing (2)
  • pkg/cli/cmd/workload/intercept_test.go
  • pkg/svc/chat/docs_generated.go

Comment thread pkg/svc/chat/docs_generated.go Outdated
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Resolved the current-main conflict in 09a9945. The only merge conflict was generated pkg/svc/chat/docs_generated.go, rebuilt with make generate rather than hand-edited. Scoped lint also exposed and fixed one whitespace-only WSL finding in pkg/svc/mirror/replay_test.go.

Validation passed: focused SIGINT/SIGTERM intercept tests; workload, chat, mirror, API-type, and docs tests; scoped golangci-lint with 0 issues; generator idempotence; gofmt; and git diff --check. The draft is mergeable again and fresh CI is running. CodeRabbit remains fail-closed until a current-head review/pre-merge result is available.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Resolution record for the two review-body findings, verified against current head 09a9945e:

  1. ⚠️ Outside-diff (intercept.go 274-301, create signal-aware context before setup): already implemented — signal.NotifyContext is installed at the top of runInterceptCommand (line 258), before resolveInjectionPoint (268) and ensureSteer (279), and TestInterceptCmdInterruptDuringSetupStopsCleanly pins exactly this behaviour. The finding was emitted against an earlier head.

  2. 🧹 Nitpick (SIGTERM coverage): already implemented — TestInterceptCmdTerminationSignalsStopSessionCleanly is table-driven over both os.Interrupt (SIGINT) and syscall.SIGTERM.

No code change needed; both were addressed by later commits on this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🫴 Ready

Development

Successfully merging this pull request may close these issues.

workload intercept Ctrl-C kills the process instead of unwinding the session

1 participant