Log Levels
Configure logging verbosity in.env:
.env
- debug
- info
- warn
- error
Maximum verbosity:
- All LLM requests/responses
- Git operations
- Sandbox lifecycle events
- Merge queue operations
- Task state transitions
NDJSON Logs
Longshot writes structured NDJSON (newline-delimited JSON) logs tologs/run-*.ndjson:
Analyzing Logs
Usejq to filter and analyze logs:
Dashboard Debugging
The Rich TUI dashboard is your primary debugging interface.Identifying Stuck Tasks
In the Planner Tree (In Progress panel), look for:- Long durations: Tasks showing
[5m30s]or longer in yellow/red - No progress updates: Tasks without recent “Worker progress” messages
- Pending state: Tasks that stay pending despite available workers
Activity Feed Analysis
PressTab to view the Activity Feed. Look for patterns:
Rapid Failures
WORKER_TIMEOUT, LLM endpoint health, or task complexity.
Merge Conflicts
LLM Errors
Metrics Analysis
Low Commits/Hour
If commits/hour is below expectations:- Check Velocity sparkline - is it consistently low?
- Review Active Workers - are agents actually running?
- Look at Pending count - is the planner creating tasks?
- Check Failed count - are tasks failing silently?
High Failure Rate
If Failed count grows:- Switch to Activity Feed to see error messages
- Check Merge Queue - are failures due to merge issues?
- Review logs for common error patterns
- Verify LLM endpoint health in metrics panel
Poor Merge Success Rate
If merge rate is <70%:- Review Conflicts count in Merge Queue panel
- Check if conflict retries are working (Activity Feed)
- Consider switching merge strategy (see Merge Strategies)
- Review task boundaries for overlap
Span Traces
Longshot includes a distributed tracing system for detailed execution analysis.Enabling Traces
Traces are automatically written tologs/spans/:
Span Structure
Each span captures a unit of work:Common Span Types
planner.decomposeTask- Task decomposition by plannersandbox.worker- Full worker executionllm.complete- LLM requestmerge.attempt- Merge queue operationreconciler.sweep- Build/test validation
Analyzing Traces
Find slow operations:Common Issues
Planner Not Creating Tasks
Symptoms:- Dashboard shows 0 active workers
- Pending count is 0
- No “Task created” events in Activity Feed
- Check planner LLM requests in debug logs
- Verify
planningPrompt.mdexists and is valid - Review planner span traces for errors
- Check if iteration completed successfully
Workers Timing Out
Symptoms:- Tasks show “TIMEOUT” in red in Activity Feed
- Workers run for exactly
WORKER_TIMEOUTseconds - Tasks stay in “running” state until timeout
- Check worker logs:
grep "\[worker:task-" logs/run-latest.ndjson - Review sandbox progress events
- Check if agent is stuck in a loop
- Verify tests aren’t hanging
Merge Conflicts Not Resolving
Symptoms:- Same branch conflicts multiple times
- Conflict retry count reaches max (2)
- Fix tasks are created but don’t help
- Check conflicting files in merge result data
- Review if files overlap across multiple tasks
- Verify rebase is working (check for “rebased” in logs)
- Check if fix task is actually resolving conflicts
LLM Endpoint Failures
Symptoms:- “All N LLM endpoints failed” errors
- Tasks fail immediately after assignment
- Planner shows “PLANNING” indefinitely
- Check endpoint health:
curl -H "Authorization: Bearer $LLM_API_KEY" $LLM_BASE_URL/v1/models - Review LLM client logs for HTTP status codes
- Check API key validity and rate limits
- Verify network connectivity to provider
Sandbox Creation Slow
Symptoms:- “sandbox created” messages take >10 seconds
- Workers spend most time in “Dispatching task to ephemeral sandbox” phase
- Low overall throughput despite high
MAX_WORKERS
- Check Modal dashboard for cold start times
- Review sandbox image size
- Verify Modal account has sufficient capacity
- Check regional availability
Git Push Failures
Symptoms:- Workers complete successfully but branches aren’t pushed
- “Failed to push origin/main” errors in merge queue
- Dashboard shows completed tasks but merge queue is empty
- Verify
GIT_TOKENhas push access:git ls-remote https://x-access-token:[email protected]/org/repo.git - Check for branch protection rules
- Review git credentials configuration
- Verify network connectivity to GitHub
Debug Workflow
Follow this systematic approach when debugging:1. Observe
Start the dashboard and observe:- Are tasks being created? (Pending count increasing)
- Are workers running? (Active count > 0)
- Are tasks completing? (Completed count increasing)
- What’s the failure rate? (Failed count growth)
2. Narrow Down
Identify the failing component:- Planner: No tasks created → Check planner logs
- Worker Pool: Tasks pending but not assigned → Check worker pool
- Sandboxes: Tasks assigned but timing out → Check sandbox logs
- Merge Queue: Tasks complete but not merged → Check merge logs
3. Enable Debug Logging
4. Isolate
Reduce parallelism to isolate issues:5. Reproduce
Create a minimal reproduction:- Use a small test repository
- Create a single simple task
- Run with
MAX_WORKERS=1 - Review logs for the specific failure
6. Review Logs
Analyze NDJSON logs for the failing task:Advanced Debugging
Attach to Sandbox
For deep debugging, you can attach to a running sandbox:Replay NDJSON Logs
Replay a previous run for analysis:Custom Instrumentation
Add custom logging to the orchestrator:Getting Help
If you’re stuck:- Check logs: Review
logs/run-latest.ndjsonwithjq - Enable debug logging: Set
LOG_LEVEL=debug - Review spans: Analyze
logs/spans/for slow operations - Search issues: Check GitHub issues for similar problems
- Create reproduction: Minimize the issue to a small test case
- Report bug: Open an issue with logs and reproduction steps
Next Steps
Running with Dashboard
Master the dashboard for real-time debugging
LLM Configuration
Troubleshoot LLM endpoint issues