Commit graph

68 commits

Author SHA1 Message Date
jedarden
53d5e1ea4e docs(bf-5gz3): verify Rust toolchain installation 2026-07-02 17:02:29 -04:00
jedarden
ec7bf4d1ae docs(bf-4q2): verify plan.md is already up to date with v0.2.0
Verified all acceptance criteria:
- Status table: v0.2.0 complete, E2E tests tracked as bf-46x
- Module Layout: all src/ and tests/ files documented
- Watchdog component: section 10 exists with timeout types table
- CLI flags: --first-output-timeout, --stream-json-timeout, --stop-hook-timeout documented
- Emitter section: stream-json replay implementation noted, live tailing tracked as bf-5vm
- Phase 1 --version text: already version-agnostic

No plan.md updates required — all facts already correct.
2026-07-02 15:54:07 -04:00
jedarden
3f79378e87 docs(bf-1ae5): document local claude-print binary build 2026-07-02 15:48:26 -04:00
jedarden
03c967dd86 docs(bf-1irl): document test environment verification
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 15:07:29 -04:00
jedarden
1d0799531c chore(bf-3k2): remove repo cruft
- Remove notes/bf-1ae5.md (per-bead scratch file, not in Module Layout)
- Add .gitignore to exclude:
  - target/ (Rust build artifacts)
  - .beads/beads.db.backup.* (database backups)
  - .needle-predispatch-sha (NEEDLE worker artifact)

Root now contains only files specified in plan Module Layout:
AGENTS.md, build.rs, CI YAMLs, docs/, scripts/, src/, tests/,
Cargo.toml/lock, claude-print.yaml, install.sh, README.md
2026-07-02 14:59:36 -04:00
jedarden
076056b239 docs(bf-1ae5): document local build of claude-print binary
- Successfully built claude-print 0.2.0 using cargo build --release
- Binary created at /home/coding/target/release/claude-print (1014K, stripped)
- Build completed with only minor unused import warnings
- Verified binary runs correctly and reports correct version

Bead-Id: bf-1ae5
2026-07-02 14:55:34 -04:00
jedarden
1544ef9e99 docs(bf-1irl): update test environment verification report
- Confirmed cargo 1.95.0 and rustc 1.95.0 installed
- Verified all Rust components (clippy, rustfmt, llvm-tools, etc.)
- All Cargo.toml dependencies compile successfully
- Test compilation succeeded with 13 test targets
- No missing system dependencies

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 14:36:14 -04:00
jedarden
b5a0f33f76 test(bf-1irl): verify test environment and dependencies
- Confirmed cargo 1.95.0 and rustc 1.95.0 installed
- Verified all build dependencies (build-essential, libssl-dev, pkg-config)
- Confirmed 84 packages resolvable across 2 workspace members
- Ran 90 library tests successfully

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 14:29:38 -04:00
jedarden
afb06df308 test(bf-27hl): verify cargo test suite passes all tests
- Created notes/bf-27hl.md documenting test results
- All 235 tests passed with 0 failures
- 1 test intentionally ignored (slow timeout test)
- Non-blocking compiler warnings present but do not affect functionality

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 14:03:08 -04:00
jedarden
0b37771d6a notes(bf-1v8): verification that all requirements are complete 2026-07-02 13:57:00 -04:00
jedarden
7aec53faca docs(bf-60pc): verify test environment and dependencies 2026-07-02 13:18:57 -04:00
jedarden
098283c197 docs(bf-68nl): verify stream-json reader join on all exit paths
Add verification note confirming that the stream-json reader thread is
properly joined on all exit paths (success, timeout, interrupted, child
exit, early error).

All exit paths in session.rs correctly:
- Send drain signal and join (success, early error)
- Drop handle and join (timeout, interrupted, child exit)

Tests pass (90 passed).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 13:18:57 -04:00
jedarden
0293c5a655 docs(bf-68nl): verify stream-json reader join on all exit paths
Verified that all exit paths properly join the stream-json reader thread:
- Timeout: drop drain_tx, immediate exit + join
- Success: send drain signal + join
- Error before transcript: send drain signal + join
- Child exit: drop drain_tx, immediate exit + join
- Interrupted: drop drain_tx, immediate exit + join

All 131 tests pass. Implementation was already complete in commit e0cf57a.
2026-07-02 11:43:30 -04:00
jedarden
b3d97e7a12 docs(bf-549b): verify stream-json reader spawn at PROMPT_INJECTED
Confirm that emitter::spawn_stream_json_reader is correctly wired
at the PROMPT_INJECTED transition in the event loop callback.

The implementation at src/session.rs:358-376:
- Detects phase change to PromptInjected
- Only spawns when output_format is StreamJson
- Captures start_offset from transcript file metadata
- Calls spawn_stream_json_reader with correct arguments
- Stores StreamJsonHandle for later joining

All acceptance criteria met. Code compiles successfully.
2026-07-02 11:31:52 -04:00
jedarden
8b807a7888 docs(bf-5uv2): verify StreamJsonHandle storage and spawned flag setting
- Confirmed stream_json_handle = Some(...) assignment at src/session.rs:370-373
- Verified stream_json_spawned_clone.store(true, SeqCst) at src/session.rs:374
- Checked Ordering::SeqCst is used for atomic store
- Ensured stream_json_handle is Option<emitter::StreamJsonHandle>
- Verified spawned flag visibility via Arc<AtomicBool> with SeqCst ordering

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 11:10:38 -04:00
jedarden
f33b1f7d83 docs(bf-5uv2): verify StreamJsonHandle storage and spawned flag setting
- Confirmed stream_json_handle = Some(...) assignment exists (src/session.rs:370-373)
- Verified stream_json_spawned_clone.store(true, SeqCst) call is present (src/session.rs:374)
- Checked that Ordering::SeqCst is used for the atomic store
- Ensured stream_json_handle is the correct type (Option<emitter::StreamJsonHandle>)
- Verified spawned flag will be visible to other parts of the code due to SeqCst ordering

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 11:00:07 -04:00
jedarden
bde54b78f8 docs(bf-5k9t): verify spawn_stream_json_reader implementation
- Confirmed output_format check with matches!(output_format, crate::cli::OutputFormat::StreamJson)
- Verified spawn_stream_json_reader call with transcript_path.clone() and start_offset parameters
- Confirmed placement inside PROMPT_INJECTED detection block
- Code compiles successfully (cargo check passed)
- All acceptance criteria met
2026-07-02 10:48:15 -04:00
jedarden
d7e0a1ec73 docs(bf-5t5n): verify transcript_path and start_offset availability
Confirm variables exist and contain correct values at PROMPT_INJECTED:
- transcript_path points to <temp_dir>/transcript.jsonl (session.rs:303)
- start_offset uses std::fs::metadata correctly (session.rs:366-368)
- unwrap_or(0) handles missing file case (defaults to 0)
- Both variables in scope at spawn_stream_json_reader call (session.rs:370-373)
2026-07-02 10:31:25 -04:00
jedarden
729547b470 docs(bf-47pw): verify PROMPT_INJECTED transition detection
- Verified phase change detection logic at session.rs:359-360
- Confirmed last_phase update at session.rs:377
- Verified is_prompt_injected() method in startup.rs
- Confirmed detection fires only once when transitioning TO PromptInjected

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 10:26:22 -04:00
jedarden
cd2206f554 docs(bf-549b): verify stream-json reader spawn at PROMPT_INJECTED
Verify that the stream-json reader spawn call is correctly wired
at the PROMPT_INJECTED transition in the event loop callback.

Code is already implemented in src/session.rs:359-377 with:
- Phase transition detection
- Output format check (StreamJson only)
- Transcript path and start_offset capture
- Handle storage for cleanup on all exit paths
- Compiles without errors
2026-07-02 10:00:51 -04:00
jedarden
50f3fdd982 docs(bf-3wya): verify transcript byte offset capture implementation
- Verified implementation at lines 363-375 in src/session.rs
- Acceptance criteria met: captures transcript file size at PromptInjected phase
- Fixed warning: removed unnecessary mut from stream_json_spawned
- Added notes/bf-3wya.md documenting the implementation
2026-07-02 09:45:58 -04:00
jedarden
c90ed57dfd docs(bf-3p8h): verify spawn_stream_json_reader signature and retry logic 2026-07-02 09:37:41 -04:00
jedarden
4d5f020b1f docs(bf-30e): verify stream-json reader thread spawn implementation
All acceptance criteria verified:
- Reader thread spawned at PROMPT_INJECTED transition
- Byte offset captured from transcript file length
- Retry logic (50ms intervals, 5s timeout) implemented in emitter.rs
- Reader thread drains to mpsc channel

All 90 library tests and 13 emitter tests pass.
2026-07-02 09:37:41 -04:00
jedarden
bf40e6bc6f docs(bf-3eq): document regression test completion
Create summary document noting that watchdog regression tests
are fully implemented and passing. The tests verify that a
child that produces no output and never fires Stop is correctly
terminated by the watchdog with proper cleanup.

Co-Authored-By: Claude <noreply@anthropic.com>
Bead-Id: bf-3eq
2026-06-25 18:58:56 -04:00
jedarden
88faf1443d docs(bf-2w7): document cleanup implementation completeness
Verify and document that all exit paths are covered:
- Orphan cleanup on startup via cleanup_orphans()
- RAII CleanupGuard ensures cleanup on drop
- Global cleanup_temp_dir() before process::exit()
- Atexit handler registration for external signals
- Signal handling for SIGINT/SIGTERM
- HookInstaller cleanup with idempotent flag
- Panic safety with catch_unwind

All 90 library tests + 28 integration tests pass.
Exit path matrix shows all scenarios covered with defense in depth.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 16:02:02 -04:00
jedarden
10530ec429 docs(bf-2w7): verify cleanup implementation is complete and robust
Verified that temp dir and FIFO cleanup happens on all exit paths:
- Normal exit: CleanupGuard Drop
- Error exit: CleanupGuard Drop
- Watchdog timeout: CleanupGuard Drop after event loop exits
- Signal interruption: CleanupGuard Drop after event loop exits
- Panic: catch_unwind + CleanupGuard Drop
- process::exit(): explicit cleanup_temp_dir() call
- External signals: atexit handler

Orphan cleanup on startup implemented in cleanup_orphans():
- Sweeps claude-print-* dirs older than 10 minutes
- Removes FIFO first, then entire directory
- Called early in main() before any session runs

All cleanup-related tests pass (90 tests total).
Implementation is idempotent with retry logic for transient errors.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 13:59:52 -04:00
jedarden
7f19ac116a docs(bf-2f5): confirm watchdog implementation is complete and verified
All requirements verified:
- No-output timeout (PTY 90s, stream-json 90s) ✓
- Max-turn timeout (overall 3600s, stop hook 120s) ✓
- SIGTERM → SIGKILL with descendants ✓
- Clear diagnostics to stderr ✓
- Temp resource teardown ✓
- Exit non-zero (124) ✓

Implementation was completed in commits:
- 7d40c93: add comprehensive watchdog timeout mechanism
- 07013f8: add self-pipe signaling
- ea162c0: correct timeout exit code from 3 to 124
- 11e9b72: document watchdog timeout implementation
- d116dae: verify watchdog timeout implementation is complete

Co-Authored-By: Claude <noreply@anthropic.com>
Bead-Id: bf-2f5
2026-06-25 11:17:34 -04:00
jedarden
3c43436729 docs(bf-2w7): verify cleanup implementation is complete
Verified that all cleanup mechanisms are properly implemented:
- Orphan cleanup on startup (10-minute threshold)
- CleanupGuard for automatic RAII cleanup
- Global cleanup before process::exit()
- Idempotent cleanup with retry logic

All exit paths covered:
- Normal exit (success/error)
- Timeout exit
- Signal interruption (SIGINT/SIGTERM)
- Watchdog timeout
- Panic
- Early returns

All tests passing. No orphaned temp directories found.

Bead-Id: bf-2w7
2026-06-25 11:17:34 -04:00
jedarden
5826607cf7 docs(bf-2f5): verify watchdog timeout implementation is complete
All requirements from bead bf-2f5 have been verified:
- No-output timeout (PTY 90s, stream-json 90s) ✓
- Max-turn timeout (overall 3600s, stop hook 120s) ✓
- SIGTERM → SIGKILL with descendants ✓
- Clear diagnostics to stderr ✓
- Temp resource teardown ✓
- Exit non-zero (124) ✓

Implementation was completed in commits:
- 7d40c93: add comprehensive watchdog timeout mechanism
- 07013f8: add self-pipe signaling
- ea162c0: correct timeout exit code from 3 to 124

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 10:46:51 -04:00
jedarden
4a4d5862f4 docs(bf-2w7): document cleanup implementation verification
- Verify comprehensive cleanup on all exit paths
- Document all cleanup mechanisms and their locations
- Confirm all 90 tests pass including cleanup-specific tests
- Exit path matrix shows all paths covered

Co-Authored-By: Claude <noreply@anthropic.com>
Bead-Id: bf-2w7
2026-06-25 10:01:26 -04:00
jedarden
11e9b72967 docs(bf-2f5): document watchdog timeout implementation
Add comprehensive documentation for the watchdog timeout mechanism
that prevents indefinite hangs in claude-print.

The implementation includes:
- PTY first-output timeout (90s default)
- Stream-json first-output timeout (90s default)
- Overall timeout (3600s default)
- Stop hook timeout (120s default)

Each timeout type triggers SIGTERM→SIGKILL child cleanup,
writes clear diagnostics to stderr, and exits with code 124.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 09:35:19 -04:00
jedarden
6676dc483b feat(bf-2w7): add comprehensive cleanup on all exit paths
- Add cleanup_performed flag to HookInstaller for idempotent cleanup
- Add Drop implementation to HookInstaller for automatic cleanup
- Enhance cleanup() to explicitly remove both FIFO and temp directory
- Ensure temp dirs are cleaned up on normal exit, error, timeout, signals, and panic
- cleanup_orphans() already called at startup to sweep stale temp dirs

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 07:42:17 -04:00
jedarden
18dea17a4f docs(bf-2w7): verify cleanup implementation is complete
- Confirm all cleanup mechanisms are in place and working
- All 90 tests pass
- Orphan sweeping on startup, Drop guard for normal paths, global cleanup for process::exit()
- All exit paths covered: normal, error, watchdog timeout, signal interruption

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 07:16:15 -04:00
jedarden
93ced10afd fix(bf-2u1): prevent global settings inheritance to avoid startup hang
Root cause: Child claude hangs at startup when global settings containing
hooks (SessionStart, SessionEnd, etc.) are inherited despite creating a
temp settings.json with only a Stop hook.

When --settings=<temp_path> is passed without --setting-sources=, Claude Code
merges temp settings with global settings. Global hooks fire and may hang,
causing the child to never produce output and the first-output timeout to fire.

Fix: Always pass --setting-sources= to child claude (src/session.rs:127-129)
to prevent global settings inheritance. This ensures ONLY the temp settings.json
is loaded, preventing any global hooks from causing hangs.

Evidence: Documented in notes/bf-2u1-findings.md and notes/bf-2u1-investigation.md

Related beads:
- bf-2w7: temp dir and FIFO cleanup
- bf-3ag: session implementation
2026-06-25 06:00:56 -04:00
jedarden
7ddbf68e54 fix(bf-2w7): ensure temp dir and FIFO cleanup on all exit paths
- Add cleanup_orphans() to HookInstaller: sweeps stale claude-print-* dirs on startup
- Add cleanup() method to HookInstaller: explicitly removes FIFO and temp dir artifacts
- Add CleanupGuard struct in session.rs: ensures cleanup via Drop on all exit paths
- Call cleanup_orphans() in HookInstaller::new() on each invocation

This prevents orphaned temp directories from accumulating after crashes,
timeouts, or signal interruptions.

Co-Authored-By: Claude <noreply@anthropic.com>
Bead-Id: bf-2w7
2026-06-25 00:25:17 -04:00
jedarden
ef79f73ce3 docs(bf-4aw): verify main.rs execution path implementation
- Prompt resolution: --input-file, positional, stdin (exit 4 on errors)
- Session dispatch: session::run() with claude_args
- Result matching: Interrupted(130), Timeout(3), NoResponse(2), other(2)
- Stream-JSON output: replay transcript line-by-line
- AS-5: binary not found check with human-readable error (exit 2)

All 81 tests pass. No dead_code warnings for output format arms.
2026-06-14 01:01:38 -04:00
jedarden
bbe18cbfb1 docs(bf-3ag): verify session implementation complete - all tests pass 2026-06-13 14:52:20 -04:00
jedarden
4db1b7fb15 docs(bf-3ag): document completed Session struct and version resolution implementation 2026-06-13 14:20:58 -04:00
jedarden
b852efc9d8 docs(bf-2pw): verify emitter implementation is complete
All 13 emitter tests pass. Implementation completed in commit bfb50da.
Verified output formatting for text, json, and stream-json formats.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-11 09:33:17 -04:00
jedarden
96524de012 docs(bf-gqf): verify PTY spawn and signal forwarding implementation is complete 2026-06-11 09:16:00 -04:00
jedarden
ee59f07c99 docs(bf-1en): verify transcript.rs implementation is complete
All tests pass:
- cargo test --lib transcript: 3 passed
- cargo test --test transcript: 18 passed

Implementation was already complete in commit c6241e3.
No code changes needed - verification only.
2026-06-11 09:13:42 -04:00
jedarden
ef1ae96925 docs(bf-1en): verify transcript.rs implementation is complete
- Verified src/transcript.rs was implemented in commit c6241e3
- All 18 integration tests pass
- Module provides full JSONL parsing with:
  - Token counting (input, output, cache)
  - Streaming deduplication
  - Retry loop with fallback
  - Session tracking
- Implementation complete and verified
2026-06-11 08:44:11 -04:00
jedarden
af5c24718d docs(bf-2pw): record emitter verification - already complete in bfb50da 2026-06-11 08:36:33 -04:00
jedarden
b8d7037de7 docs(notes): record bf-1vd as already-complete (plan.md updated in 4b2161c)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:43:06 -04:00
jedarden
16bf418396 bf-4eb: Remove overly-conservative dependency blocking bf-4r6
bf-4r6 (Write AGENTS.md) was blocked on bf-40i (Wire main()), but
documentation writing does not require main() to be functional.
Removing this dependency makes bf-4r6 ready for a worker to claim.

bf-52c's dependency on bf-40i remains correct — binary E2E tests
genuinely require a working binary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 20:43:00 -04:00
jedarden
4d9a970176 Add bf-4km sixth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:31:08 -04:00
jedarden
d0fe872ff4 Add bf-4km fifth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:29:16 -04:00
jedarden
5da2055ae8 Add bf-4km fourth verification: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:27:14 -04:00
jedarden
60649e2d8b Add bf-4km re-verification notes (third): claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:20:54 -04:00
jedarden
d0e9220720 Add bf-4km re-verification notes: claude-print-ci WorkflowTemplate confirmed Synced in ArgoCD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:18:46 -04:00