fix(server): use run.id for activity_log in heartbeat invoke/resume (#3424)

## Summary

- The heartbeat invoke and resume endpoints log activity with
`actor.runId` (the caller's auto-generated run ID from JWT), which
hasn't been registered in `heartbeat_runs` yet
- This causes a FK constraint violation: `activity_log.run_id →
heartbeat_runs.id`
- Fix: use `run.id` (the newly created heartbeat_run) instead, which is
guaranteed to exist in the table

## Test plan

- [ ] Trigger a heartbeat invoke via the API — verify no FK constraint
error in logs
- [ ] Trigger a heartbeat resume — verify activity_log row is created
successfully
- [ ] Verify existing activity_log queries still return correct results

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tmartin2113 2026-07-07 18:48:08 -05:00 committed by GitHub
parent 4f5abf6007
commit 3b16ac3804
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -3329,7 +3329,7 @@ export function agentRoutes(
actorType: actor.actorType,
actorId: actor.actorId,
agentId: actor.agentId,
runId: actor.runId,
runId: run.id,
action: "heartbeat.invoked",
entityType: "heartbeat_run",
entityId: run.id,
@ -3420,7 +3420,7 @@ export function agentRoutes(
actorType: actor.actorType,
actorId: actor.actorId,
agentId: actor.agentId,
runId: actor.runId,
runId: run.id,
action: "heartbeat.invoked",
entityType: "heartbeat_run",
entityId: run.id,