fix: add turn check debug logs + one-time prompt injection #6

Merged
zhi merged 1 commits from fix/turn-check-debug-and-onetime-inject into feat/turn-based-speaking 2026-02-28 19:27:59 +00:00
Collaborator

Changes

Problem 1: Moderator not working

  • Add debug logs for ctx.agentId, resolved accountId, turnOrder length
  • Fallback to ctx.accountId if resolveAccountId fails
  • Add resolveDiscordUserId debug logs for handoff troubleshooting

Problem 2: Prompt injected on every user message

  • Use prependContext (not systemPrompt which overrides base system prompt)
  • Add sessionInjected Set to track which sessions have already injected
  • Only inject once per session (one-time injection)
  • Skip subsequent injections with debug log

Discussion with Orion

  • Confirmed that systemPrompt hook directly overrides base system prompt (no append capability)
  • The one-time prependContext approach is a good compromise until core supports appending to system prompt
## Changes ### Problem 1: Moderator not working - Add debug logs for `ctx.agentId`, resolved accountId, turnOrder length - Fallback to `ctx.accountId` if `resolveAccountId` fails - Add `resolveDiscordUserId` debug logs for handoff troubleshooting ### Problem 2: Prompt injected on every user message - Use `prependContext` (not `systemPrompt` which overrides base system prompt) - Add `sessionInjected` Set to track which sessions have already injected - Only inject once per session (one-time injection) - Skip subsequent injections with debug log ## Discussion with Orion - Confirmed that `systemPrompt` hook directly overrides base system prompt (no append capability) - The one-time `prependContext` approach is a good compromise until core supports appending to system prompt
zhi added 1 commit 2026-02-28 19:27:54 +00:00
1. Turn check improvements:
   - Add debug logs for ctx.agentId, resolved accountId, turnOrder length
   - Fallback to ctx.accountId if resolveAccountId fails
   - Add resolveDiscordUserId debug logs for handoff troubleshooting

2. One-time prompt injection:
   - Add sessionInjected Set to track injected sessions
   - Use prependContext (not systemPrompt) but only inject once per session
   - Skip subsequent injections with debug log
zhi merged commit 7fdc7952b7 into feat/turn-based-speaking 2026-02-28 19:27:59 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nav/Dirigent#6