CLAUDE_CODE_DISABLE_BACKGROUND_TASKS — runtime test
Hands-on runtime battle-test of CLAUDE_CODE_DISABLE_BACKGROUND_TASKS. Result: INCONCLUSIVE.
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS is an environment variable that suppresses all background task spawning and Ctrl+B backgrounding in Claude Code, tested in v2.1.4 against runtime 2.1.9 with inconclusive results.
How It Works
When set (e.g., export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1), this flag disables three behaviors: auto-backgrounding of long-running tasks, the Ctrl+B shortcut for manual backgrounding, and all related background task infrastructure. The intended effect is to force all task execution to run synchronously in the foreground.
Test Design and Result
The test suite outlined four manual steps: start Claude without the env var and observe Ctrl+B and auto-backgrounding behavior; then restart with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 and verify both features are disabled. However, the test was never executed at runtime. Code review confirmed the feature was implemented as designed, but interactive terminal behavior and task-duration-dependent auto-backgrounding could not be verified in an automated setting. Status: CODE REVIEW ONLY (manual verification needed).
Stated Use Cases
The feature targets CI/CD pipelines (background tasks are meaningless non-interactively), scripted usage via claude -p, debugging workflows (forcing synchronous execution), and resource-constrained environments seeking to prevent spawned processes.
Epistemic Status
INCONCLUSIVE. The implementation appears sound, but runtime behavior remains unvalidated. A manual test—comparing behavior with and without the environment variable across multiple task types—would be required to confirm the feature works as specified.
Test Results: CLAUDE_CODE_DISABLE_BACKGROUND_TASKS
Feature: Added CLAUDE_CODE_DISABLE_BACKGROUND_TASKS environment variable to disable all background task functionality including auto-backgrounding and the Ctrl+B shortcut
Tested: 2026-01-16 Version: 2.1.4 features on 2.1.9
Feature Description
When set, this env var disables:
- Auto-backgrounding of long-running tasks
- Ctrl+B shortcut to manually background tasks
- All background task functionality
Use Cases
- CI/CD environments - Background tasks don't make sense in non-interactive pipelines
- Scripted usage - When using
claude -pin scripts, backgrounding is irrelevant - Debugging - Force all tasks to run foreground for easier debugging
- Resource-constrained environments - Prevent spawning background processes
Expected Usage
export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
claude
# Now: Ctrl+B does nothing, tasks won't auto-background
Or inline:
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 claude -p "do something"
Test Results
Status: CODE REVIEW ONLY
Cannot runtime-test because:
- Ctrl+B requires interactive terminal
- Auto-backgrounding depends on task duration and conditions
- Would need to compare behavior with/without env var set
Manual Test Steps
- Start claude WITHOUT env var
- Run a long task, verify Ctrl+B works or auto-backgrounds
- Exit, restart WITH
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 - Run same long task, verify Ctrl+B does nothing
- Verify no auto-backgrounding occurs
Notes
Simple, focused feature. Provides control over background behavior for environments where it's undesirable.
Status: CODE REVIEW (manual verification needed)
test_5754eb545e918147a4a839a5ed255199b87705613b1e2fd064d57fa75a6b679d2856ceafad6b1daa8f982493871b6dd154196f6675d96520aaa58794367fcbf6566be54eb66011d776456ddc69465aaccbe6be64a55d9b6ff9abbdca29a6b0319a5d5016a782465004b58db507f0803Signed with an ed25519 key held off the repo. Anyone can verify against the published public key; nobody without the secret key can forge it. Click verify: it recomputes the signature in your browser. The signature proves integrity and authorship of this exact content — not a third-party timestamp or that the underlying claim is objectively true. signedAt is when the @f3/attest pipeline ran, not when the work happened; the evidence refs carry the source dates.
- verifies CLAUDE_CODE_DISABLE_BACKGROUND_TASKS Primitive