Bug type
Behavior bug (incorrect output/state without crash)
Summary
chat.inject returns:
failed to write transcript: transcript file not found
when the resolved transcriptPath exists in session metadata but the transcript file itself does not exist on disk (ENOENT). Manually creating (touching) the transcript
file makes the error go away immediately.
This breaks transcript persistence and makes chat.history / sessions_history return empty.
Steps to reproduce
- Configure OpenClaw with ACP backend
acpx and run an ACP oneshot/run session (nonInteractive).
2. Observe the session entry has a transcriptPath like:
~/.openclaw/agents/<agentId>/sessions/<sessionId>.jsonl
but the file does not exist (ENOENT).
3. Call gateway RPC chat.inject with params:
{ "sessionKey": "<sessionKey>", "message": "hello" }
4. Observe error:
failed to write transcript: transcript file not found
5. Workaround: touch the transcript file at transcriptPath, then retry chat.inject; it succeeds and messages are persisted.
Expected behavior
If transcriptPath is resolved but the file is missing, chat.inject should create the transcript file (mkdirp + create/touch) and then append the injected message, instead of failing.
Actual behavior
Source inspection (OpenClaw 2026.3.2) shows chat.inject calls the transcript append helper with createIfMissing: false, so a missing transcript file becomes a hard error.
OpenClaw version
2026.3.2
Operating system
macOS arm64
Install method
brew (openclaw-cli) + LaunchAgent gateway
Logs, screenshots, and evidence
File: `src/gateway/server-methods/chat.ts`
- `appendAssistantTranscriptMessag e(...)` returns `"transcript file not found"` if `createIfMissing` is false and the transcript file does not exist.
- RPC method `"chat.inject"` calls `appendAssistantTranscriptMessag e` with:
`createIfMissing: false`
### Proposed fix
In `chat.inject`, pass `createIfMissing: true` (or ensure transcript file is created at session creation / first write). Missing transcript file should not hard-fail
injection.
Impact and severity
- Affected: ACP oneshot/run sessions where transcript is not pre-created
- Severity: High (breaks persistence/observability; history APIs unusable)
- Frequency: 100% when transcript file is missing
- Consequence: chat history remains empty; tooling depending on transcript breaks
Additional information
No response
Bug type
Behavior bug (incorrect output/state without crash)
Summary
chat.injectreturns:failed to write transcript: transcript file not foundwhen the resolved
transcriptPathexists in session metadata but the transcript file itself does not exist on disk (ENOENT). Manually creating (touching) the transcriptfile makes the error go away immediately.
This breaks transcript persistence and makes
chat.history/sessions_historyreturn empty.Steps to reproduce
acpxand run an ACP oneshot/run session (nonInteractive).2. Observe the session entry has a
transcriptPathlike:~/.openclaw/agents/<agentId>/sessions/<sessionId>.jsonlbut the file does not exist (ENOENT).
3. Call gateway RPC
chat.injectwith params:{ "sessionKey": "<sessionKey>", "message": "hello" }4. Observe error:
failed to write transcript: transcript file not found5. Workaround:
touchthe transcript file attranscriptPath, then retrychat.inject; it succeeds and messages are persisted.Expected behavior
If
transcriptPathis resolved but the file is missing,chat.injectshould create the transcript file (mkdirp + create/touch) and then append the injected message, instead of failing.Actual behavior
Source inspection (OpenClaw 2026.3.2) shows
chat.injectcalls the transcript append helper withcreateIfMissing: false, so a missing transcript file becomes a hard error.OpenClaw version
2026.3.2
Operating system
macOS arm64
Install method
brew (openclaw-cli) + LaunchAgent gateway
Logs, screenshots, and evidence
Impact and severity
Additional information
No response