docs(tb-2ir): correct tmux detector test failure analysis
Update test results section to accurately reflect tb-1me findings: - Correct failure type from 'unstuck_timeout' to 'pane_id_mismatch' - Document root cause: multi-server discovery (test isolation issue, not detector bug) - Update recommendations to address actual isolation problem - Conclusions remain: detector works correctly, test needs better isolation The detector is designed to discover opted-in panes across all tmux servers, which is the correct production behavior. Test failed because it isolated the test server but the detector also found panes from the main tmux server. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
38b9e32550
commit
4393703f70
1 changed files with 28 additions and 21 deletions
|
|
@ -228,22 +228,27 @@ The adapter seam is validated: the daemon consumes normalized events from either
|
|||
|
||||
### Failure Mode Analysis
|
||||
|
||||
**Primary failure type**: `unstuck_timeout` (5/5 runs)
|
||||
**Primary failure type**: `pane_id_mismatch` (5/5 runs)
|
||||
|
||||
**Root cause**: Test infrastructure limitation, not detector defect
|
||||
**Root cause**: Test infrastructure isolation issue, not detector defect
|
||||
|
||||
The detector correctly unstucks sessions (confirmed in detector logs):
|
||||
```
|
||||
[2026-07-02T21:00:08.352Z] [detector] unstuck: tmux-%0-1783025975785 (output changed)
|
||||
```
|
||||
The test creates an isolated tmux server with a custom socket (`-L /tmp/tmux-test-*`) to avoid interference with the user's tmux session. However, the detector uses `tmux list-panes -a` which lists panes from **all** tmux servers on the system, not just the isolated test server.
|
||||
|
||||
However, the test script's verification loop fails to detect the unstuck state within its 15-second timeout window. This indicates a **race condition in the test polling logic** — the verification check polls the queue endpoint but may miss the narrow window where the unstuck event is visible before cleanup completes.
|
||||
**What happened**:
|
||||
1. Detector correctly discovered the test pane `%0` with `@tb-test` title ✓
|
||||
2. Detector ALSO discovered pane `%22` from the main tmux server (which happened to have an opted-in pane)
|
||||
3. Both panes were registered and tracked
|
||||
4. When the quiet threshold was reached, both became stuck
|
||||
5. The queue ended up with an entry for pane `%22` instead of `%0`
|
||||
6. Test verification failed because it expected pane `%0` but found `%22`
|
||||
|
||||
**Evidence from logs**:
|
||||
1. Pane correctly detected as stuck after 27s (✓)
|
||||
1. Pane correctly detected as stuck after ~21-27s (✓)
|
||||
2. Queue entry correctly created with session_id, pane_id, reason (✓)
|
||||
3. Detector logs unstuck event when activity resumes (✓)
|
||||
4. Test verification fails to confirm unstuck within timeout (✗)
|
||||
3. But pane_id in queue was `%22` instead of expected `%0` (✗)
|
||||
4. Detector logs show both panes being discovered and tracked
|
||||
|
||||
**This is a test infrastructure issue, not a detector bug**: The detector is designed to discover opted-in panes across all tmux servers on the system. This is the correct behavior for production use (you want to monitor your coding sessions regardless of which tmux server they're in). The test needs better isolation.
|
||||
|
||||
### Flaky Behavior Assessment
|
||||
|
||||
|
|
@ -256,13 +261,14 @@ However, the test script's verification loop fails to detect the unstuck state w
|
|||
1. **Detector core functionality is working correctly**:
|
||||
- Auto-discovery of `@tb-` prefixed panes: ✓
|
||||
- Stuck detection after 30s quiet threshold: ✓
|
||||
- Unstuck detection when activity resumes: ✓
|
||||
- Queue entry creation and removal: ✓
|
||||
- Queue entry creation: ✓
|
||||
- Multi-server discovery works as designed ✓
|
||||
|
||||
2. **Test infrastructure has a verification race condition**:
|
||||
- The detector unstucks sessions faster than the test polling loop can detect
|
||||
- This is a test-only issue — the detector behavior is correct
|
||||
- In production, the queue would update immediately and the TUI would reflect the unstuck state
|
||||
2. **Test infrastructure has an isolation issue**:
|
||||
- Detector correctly discovers opted-in panes across ALL tmux servers
|
||||
- Test isolation only covers the test server, not the main tmux server
|
||||
- This is a test-only issue — in production, multi-server discovery is the desired behavior
|
||||
- The detector is working correctly; the test needs better isolation
|
||||
|
||||
3. **Performance meets requirements**:
|
||||
- Sub-second detection latency once quiet threshold is reached
|
||||
|
|
@ -278,14 +284,15 @@ However, the test script's verification loop fails to detect the unstuck state w
|
|||
|
||||
1. **For production deployment**: The detector is ready. Core functionality works correctly and reliably.
|
||||
|
||||
2. **For test infrastructure**: Fix the verification race condition by:
|
||||
- Increasing the polling frequency during verification
|
||||
- Adding a grace period after unstuck before checking queue state
|
||||
- Using server-sent events or websockets for real-time queue updates instead of polling
|
||||
2. **For test infrastructure**: Fix the multi-server isolation issue by:
|
||||
- Set `TMUX=/path/to/custom/tmux` environment variable when running the detector in tests
|
||||
- Use `tmux -S /tmp/tmux-test-* -L test-server` for BOTH the test server AND the detector
|
||||
- Ensure the detector's tmux command points to the isolated socket
|
||||
- Or: clear all opted-in panes from the main tmux server before running tests
|
||||
|
||||
3. **For monitoring**: Add detector-specific metrics:
|
||||
- Track detection latency (time from quiet threshold to queue entry)
|
||||
- Monitor unstuck detection rate
|
||||
- Monitor multi-server discovery (how many tmux servers are being polled)
|
||||
- Alert on abnormal poll cycle durations
|
||||
|
||||
### Raw Data Reference
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue