Skip to content

Latest commit

 

History

History
53 lines (44 loc) · 2.24 KB

File metadata and controls

53 lines (44 loc) · 2.24 KB

PTY Validation Cleanup Complete

2026-04-08 06:39:35 UTC

PTY Validation Cleanup - withakay-opencode-autopilot--gxgso-mnpnaq1nvmz

Changes Made

1. Strengthened Plugin Activation Verification (pty-runner.ts:419-478)

  • Problem: Weak regex patterns matched echoed prompt text, causing false positives
  • Solution:
    • Separated markers into "weak" (could be echoed) and "strong" (plugin-specific)
    • Require EITHER 2+ weak markers OR 1 strong marker
    • Strong markers: /autopilot.*(?:activated|initialized|configured)/i, /[Tool:.*mcp_/i
    • Weak markers: /autonomousStrength/i, /\bstrength.*(?:aggressive|balanced|conservative)/i

2. Explicit PTY Timeout Cleanup (pty-runner.ts:166-246)

  • Problem: Timed-out PTY sessions left processes running
  • Solution:
    • Track spawned process handle in runAutopilotSession
    • On timeout, call process.kill() explicitly
    • Await process.exited with 2-second fallback timeout
    • Log cleanup steps for debugging

3. Stricter Test Pass Criteria (autonomous-behavior.test.ts)

  • Problem: Tests could pass on generic output or timeout without concrete side effects
  • Solution:
    • File creation test requires BOTH plugin activation AND file existence
    • Infrastructure tests skip (not pass) when plugin not activated
    • Clear skip messages explain why test cannot validate
    • No generic passes on timeout-only execution

4. Updated Documentation (README.md)

  • Added "Plugin Activation (Strict)" to critical requirements
  • Documented multi-marker validation strategy
  • Added timeout cleanup to implementation details
  • Updated code examples to show stricter patterns

Files Modified

  • __tests__/e2e/helpers/pty-runner.ts (4 edits)
  • __tests__/e2e/autonomous-behavior.test.ts (3 edits)
  • __tests__/e2e/README.md (3 edits)

Verification

  • ✅ All tests compile and skip correctly
  • ✅ TypeScript type checking passes (bun run typecheck)
  • ✅ No new type errors introduced
  • ✅ Bun LSP errors are pre-existing (Bun runtime types)

Key Principles Applied

  1. No false positives: Require specific evidence, not generic patterns
  2. Explicit cleanup: Always terminate and await timed-out processes
  3. Clear outcomes: Pass with proof, skip with reason, never pass generically