-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Current State
Headless mode (tunacode run) is implemented in src/tunacode/ui/main.py:
Entry Point:
run_headless()function (lines 194-262)- Takes:
prompt,--output-json,--auto-approve,--timeout,--cwd,--baseurl,--model
Flow:
- Validates
cwdif provided - Sets model and base URL overrides on session
- Enables auto_approve in user config settings
- Creates async task for
process_request() - Uses
asyncio.wait_for()withasyncio.shield()for timeout enforcement - On success: outputs JSON trajectory or plain text via
resolve_output() - On timeout/exception: cancels task and prints error
Related Files:
src/tunacode/ui/headless.py- Output resolution logictests/system/cli/test_headless_cli.py- REMOVED (flaky test)
Problem
The headless mode implementation has reliability issues:
- The removed test was intermittently timing out at 15s despite the 5s timeout being configured correctly
- Test passed in isolation but failed in full suite run
- Suggests deeper issues with async task handling, subprocess management, or test environment interaction
Required Action
Complete overhaul of headless mode. The current implementation needs to be reconsidered from the ground up to ensure reliable, deterministic behavior.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels