fix: add stdin forwarder to VSCodium wrapper for ACP protocol

The wrapper was blocking VSCodium's ACP (Agent Communication Protocol) communication
by not forwarding stdin from VSCodium to the real vibe-acp binary. This caused the
extension to appear 'stuck in initializing state' because VSCodium couldn't send
initialization messages to vibe-acp.

This change adds a stdin forwarder thread that reads from the wrapper's stdin
(VSCodium's output) and writes it to vibe-acp's stdin, allowing proper ACP
communication while still enabling hook injection.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
nvaldez
2026-11-03 16:24:21 +01:00
parent b68eaf7284
commit d9a52e0366
+24 -1
View File
@@ -465,6 +465,7 @@ import sys
import subprocess
import json
import threading
import shutil
from pathlib import Path
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
@@ -476,6 +477,19 @@ HOOKS_CONFIG = HOOKS_DIR / "hooks.toml"
# Global reference to the vibe-acp process
vibe_acp_process = None
def forward_stdin():
# Forward data from our stdin to vibe-acp's stdin.
# This is crucial for VSCodium to communicate with the real vibe-acp.
# Without this, VSCodium hangs during initialization.
global vibe_acp_process
try:
for line in sys.stdin:
if vibe_acp_process and vibe_acp_process.stdin:
vibe_acp_process.stdin.write(line)
vibe_acp_process.stdin.flush()
except Exception as e:
print(f"stdin forwarder error: {{e}}", file=sys.stderr)
class TurnCompletionHandler(FileSystemEventHandler):
def on_created(self, event):
self._check_journal(event)
@@ -562,7 +576,16 @@ def main():
text=True
)
# Wait for vibe-acp to complete
# Start stdin forwarder thread - CRITICAL for ACP protocol
# Without this, VSCodium cannot communicate with vibe-acp
stdin_thread = threading.Thread(
target=forward_stdin,
name="vibe-acp-stdin-forwarder",
daemon=True
)
stdin_thread.start()
# Wait for vibe-acp to complete (or until VSCodium terminates us)
vibe_acp_process.wait()
sys.exit(vibe_acp_process.returncode)
except KeyboardInterrupt: