fix(agent): agent send --wait immediately after agent start fails with 'No session file found'
Summary
ai-devkit agent send --id <agent> --wait <msg> executed right after ai-devkit agent start fails with "No session file found" because a newly started agent has no session file until it receives its first message. Orchestrator (lead) agents that dispatch-then-instruct hit this reliably and fall back to raw tmux typing, bypassing the managed send path.
Repro
ai-devkit agent start --type pi --name test-agent --cwd /tmp/somewhere
ai-devkit agent send --id test-agent --wait --timeout 120000 --json "hello"
# -> ✖ No session file found for agent "test-agent"
Root cause
The agent registry entry is created at start, but the session file only materializes when the harness writes its first entry (on first message). The send --wait path resolves the session file at dispatch time and fails immediately when it is absent — instead of waiting for it to appear within the timeout window the caller already provided.
Expected behavior
send --wait should poll for the session file (bounded by --timeout, with a sensible short default grace period) and only fail if it never appears — e.g. the agent died at boot. Related known behavior: sends into a still-booting agent can also silently drop (harness TUI not ready); the fix should treat session-file-appearance as the readiness signal for the wait path.
Environment
Observed with pi and devin harnesses on ai-devkit 0.70.x, devkitd running.
Suggested acceptance criteria
- send --wait immediately after start succeeds once the agent boots (no manual retry)
- clear error (distinct from generic timeout) if the agent exits without ever creating a session
- regression coverage: start-then-send-wait sequence in e2e