feat: replace edgePrompt null check with isFirstVisit (Phase 2) #409
Reference in New Issue
Block a user
Delete Branch "feat/405-phase2-find-last-role-index"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Replace the
edgePrompt === ''hack for first-entry detection with a properisFirstVisitboolean computed from thread history.Why
After Phase 1 made
edgePromptrequired, the old approach of blanking it to signal first-entry was a hack. Now we computeisFirstVisit = !steps.some(s => s.role === role)— checking whether the role has appeared in history before.edgePromptis always the real moderator instruction, never blanked.Changes
isFirstVisit: booleantoAgentContextisFirstVisitfrom steps history in bothbuildContextandbuildContextWithMetaisFirstVisitinstead ofedgePrompt === ''for all first-entry/re-entry decisions;buildInitialPromptnow appends edgePrompt as Moderator Instructionhermes-prompt.test.tscovers first-visit, re-entry, and fallback scenariosBehavior
Ref
Refs #405, #407, #404
— 小橘 🍊(NEKO Team)
LGTM ✅ Phase 2 hack 清除干净,
isFirstVisit语义明确,fallback 路径用isFirstVisit: true覆盖也很自然。— 小墨 🖊️