Skip to content

fix: support --session name lookups in --status and track detached session lifecycle (#101)#102

Merged
konard merged 13 commits intomainfrom
issue-101-f6ea3a87b1de
Apr 8, 2026
Merged

fix: support --session name lookups in --status and track detached session lifecycle (#101)#102
konard merged 13 commits intomainfrom
issue-101-f6ea3a87b1de

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Apr 8, 2026

Summary

Fixes #101 — Two bugs prevent reliable session tracking when using --isolated screen --detached --session <custom-name>:

  • --status <session-name> now worksExecutionStore.get() tries UUID match first, then falls back to session name lookup (stored in options.sessionName)
  • Detached mode no longer reports immediate completion — Status is determined at query time by checking if the actual screen/tmux/docker session is still alive
  • Rust run_with_isolation() now tracks executions — Previously, isolation-mode executions were invisible to --status in the Rust implementation

Root Causes Found

# Bug Root Cause File
1 --status my-session fails get() only searched by UUID field execution-store.js:477, execution_store.rs:522
2 Detached shows executed immediately complete(exitCode) called right after wrapper exits cli.js:607
3 Rust isolation not tracked run_with_isolation() never created ExecutionRecord main.rs:422-644

Changes

File Change
js/src/lib/execution-store.js get() supports session name fallback
js/src/lib/status-formatter.js Added isDetachedSessionAlive(), enrichDetachedStatus()
js/src/bin/cli.js Detached mode keeps status as "executing"
js/src/lib/args-parser.js Updated --status help text
rust/src/lib/execution_store.rs get() supports session name fallback
rust/src/lib/status_formatter.rs Added is_detached_session_alive(), enrich_detached_status()
rust/src/bin/main.rs Added execution tracking to run_with_isolation(), detached keeps "executing"
rust/src/lib/args_parser.rs Updated --status help text
js/test/session-name-status.test.js 15 new tests
rust/tests/session_name_status_test.rs 12 new tests
docs/case-studies/issue-101/ Root cause analysis and case study

Test plan

  • 15 new JS tests pass (bun test test/session-name-status.test.js)
  • 12 new Rust tests pass (cargo test --test session_name_status_test)
  • All existing JS tests pass (7 status-query tests, full suite)
  • Full Rust test suite passes (all test files, 0 failures)
  • Rust builds without errors (cargo build)
  • Manual verification: $ --isolated screen --detached --session test-session -- sleep 60 then $ --status test-session shows "executing"
  • Manual verification: After session ends, $ --status test-session shows "executed"

🤖 Generated with Claude Code

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #101
@konard konard self-assigned this Apr 8, 2026
konard and others added 5 commits April 8, 2026 07:59
…session lifecycle

- ExecutionStore.get() now tries UUID match first, then falls back to
  session name lookup (stored in options.sessionName)
- queryStatus() enriches detached execution status by checking if the
  actual screen/tmux/docker session is still running
- Detached mode no longer marks execution as "executed" immediately;
  keeps status as "executing" so --status accurately reflects reality
- Updated --status help text to indicate it accepts UUID or session name

Fixes #101

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…essions, add isolation tracking

- ExecutionStore::get() now tries UUID match first, then falls back to
  session name lookup (stored in options.sessionName)
- query_status() enriches detached execution status by checking if the
  actual screen/tmux/docker session is still running via is_detached_session_alive()
- Added execution record tracking to run_with_isolation() which was
  previously missing entirely - isolation executions were invisible to --status
- Detached mode keeps record as "executing" so --status accurately reflects
  that the session is still running
- Updated --status help text to indicate it accepts UUID or session name

Fixes #101

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…atus enrichment

Tests for both JS (15 tests) and Rust (12 tests) covering:
- ExecutionStore.get() lookup by UUID and session name
- UUID match takes priority over session name
- queryStatus() works with session names
- isDetachedSessionAlive() for various backends
- enrichDetachedStatus() correctly updates record status
- CLI integration tests for --status with session names

Fixes #101

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Includes:
- Detailed root cause analysis for all 4 bugs found
- Timeline of events showing how the bugs manifest
- Fix implementation details for both JS and Rust
- Testing summary

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Bug: --session name not usable with --status, and --detached reports immediate completion fix: support --session name lookups in --status and track detached session lifecycle (#101) Apr 8, 2026
@konard konard marked this pull request as ready for review April 8, 2026 08:07
konard and others added 3 commits April 8, 2026 08:09
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compacted code in cli.js, main.rs, and execution_store.rs to meet the
repository's 1000-line file size limit while preserving all functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard added a commit to link-assistant/hive-mind that referenced this pull request Apr 8, 2026
…fallback (#1545)

Per reviewer feedback, remove the extractInternalUuid() parsing of $ CLI
output and all internalUuid tracking through the codebase. Instead, rely
solely on the screen -ls fallback for screen-backend session monitoring.

The proper fix for $ --status session name lookups will come from
upstream (link-foundation/start#102).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard and others added 2 commits April 8, 2026 08:26
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The SSH session liveness check uses libc::kill which is not available
on Windows. Wraps the call in #[cfg(unix)] block, matching the pattern
already used in execution_store.rs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 8, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $16.561574
  • Calculated by Anthropic: $16.561574 USD
  • Difference: $-0.000000 (-0.00%)

📊 Context and tokens usage:

  1. Context window: 167.1K / 1M input tokens (17%), 13.1K / 128K output tokens (10%)
  2. Context window: 57.1K / 1M input tokens (6%), 2.6K / 128K output tokens (2%)

Claude Opus 4.6:

  • Context window: 167.1K / 1M input tokens (17%), 62.5K / 128K output tokens (49%)

Total: 213.3K + 26.4M cached input tokens, 62.5K output tokens, $16.110482 cost

Claude Haiku 4.5:

Total: 153.9K + 1.8M cached input tokens, 15.3K output tokens (24% of 64K output limit), $0.451093 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (5711KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 8, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit ed604e7 into main Apr 8, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: --session name not usable with --status, and --detached reports immediate completion

1 participant