#15852: fix: pass agentId when resolving IRC session paths
stale
size: S
## Summary
When recovering from Gemini session corruption in the agent runner, the transcript path was being resolved without the `agentId` parameter. This caused IRC messages routed to non-default agents via bindings to fail with the error "Session file path must be within sessions directory" because the path was resolved to the default agent's directory instead of the correct agent-specific directory.
## Changes
- Added `agentId` resolution using `resolveAgentIdFromSessionKey(sessionKey)` before calling `resolveSessionTranscriptPath` in the Gemini session corruption recovery path in `src/auto-reply/reply/agent-runner-execution.ts`
## Testing
- Ran the existing test suite for the corrupted session recovery: all 4 tests in `agent-runner.heartbeat-typing.runreplyagent-typing-heartbeat.resets-corrupted-gemini-sessions-deletes-transcripts.test.ts` passed
- Ran all 5 heartbeat-typing test files: all 20 tests passed
Fixes openclaw/openclaw#15846
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the repository agent guidelines (`AGENTS.md`) by adding a new “Post-PR Workspace Cleanup” section with recommended git-only commands for discarding local changes, pruning branches, and handling Edit tool failures. It also touches `CLAUDE.md` (which points to `AGENTS.md`), but introduces a missing newline at EOF.
<h3>Confidence Score: 4/5</h3>
- This PR is low-risk and mostly safe to merge once the EOF newline issue is fixed.
- Changes are documentation-only and don’t affect runtime logic, but the `CLAUDE.md` missing trailing newline will create persistent diff noise and may trip formatting checks/policies.
- CLAUDE.md
<sub>Last reviewed commit: 58faf0a</sub>
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#15792: fix: pass agentId to resolveSessionFilePath in additional call sites
by MisterGuy420 · 2026-02-13
83.1%
#9829: Fix MCP transport reconnect and SSE header handling
by mabengda · 2026-02-05
82.7%
#7085: test: skip flaky workspace-paths & safe-bins tests on non-Linux/CI ...
by ThinkIbrokeIt · 2026-02-02
82.4%
#7892: Claude/setup agent firewall ww xsv
by starwreckntx · 2026-02-03
82.4%
#4767: fix(agents): handle read alias required schema
by RomeroYang · 2026-01-30
82.1%
#7252: docs: align config examples and tool docs with current runtime
by nice-and-precise · 2026-02-02
82.0%
#11743: fix: remove redundant file reads from AGENTS.md template
by shogunsea · 2026-02-08
81.9%
#15982: fix: pass agentId to resolveSessionFilePath in reply flow (NX-003)
by automagik-genie · 2026-02-14
81.9%
#10894: Docs: fix legacy branding, add config reference, expand cron troubl...
by biv0711 · 2026-02-07
81.6%
#16685: Fix cli agents/approvals/discord routing edge cases
by craftowen · 2026-02-15
81.4%