Skip to content

fix: recover model-backed NPC chat#102

Merged
JOY (JOY) merged 1 commit into
devfrom
codex/npc-chat-model-recovery
May 20, 2026
Merged

fix: recover model-backed NPC chat#102
JOY (JOY) merged 1 commit into
devfrom
codex/npc-chat-model-recovery

Conversation

@JOY
Copy link
Copy Markdown
Contributor

Summary

  • Recover model-backed NPC chat when DOS.AI returns plain speech or explicit say: text instead of strict JSON.
  • Keep server-side validation intact: normalized model speech can only become action=say, then still passes the existing allowed-action validator.
  • Smooth Unity chat mode status/animation behavior so focused NPCs keep dialog visuals, stop autonomous queue status spam, and show failed response feedback when model speech is suppressed.
  • Tighten the UGUI chat panel so player messages stay left-aligned and bubbles size closer to message text.
  • Lower the local example DOS.AI decision timeout to 30 seconds for faster dev feedback.

Root Cause

  • Local dev AI budget had been exhausted, causing dos_ai_rate_limited fallback until the local budget storage was reset.
  • After budget reset, DOS.AI was reachable, but valid natural-language model responses such as plain prose or say: "..." were rejected by the strict JSON parser.
  • Unity dialog focus was racing with autonomous NPC status updates, making chat-mode NPCs show stale queued or dialog states.

Local Code Review Fallback

Verdict: APPROVED.

  • Hard Rule feat(backend): add Nakama OSS local base #2 remains satisfied: LLM output still cannot mutate authoritative game state.
  • Hard Rule feat(controller): add Simple KCC controller base #3 remains satisfied: Unity receives no model API keys; calls still go through Nakama.
  • No ADR references were found in the touched files, so ADR compliance was checked against AGENTS.md project rules and existing code boundaries.
  • Residual note: the current UGUI chat panel is still prototype-grade and should later move to prefab-driven UI styling, but this patch does not make that worse.

Verification

  • npm.cmd run build in backend/nakama
  • npm.cmd test in backend/nakama
  • dotnet build Unity\SecondSpawn.AI.csproj
  • dotnet build Unity\SecondSpawn.UI.csproj
  • git diff --check --cached
  • Staged-file em-dash scan
  • Live local smoke: secondspawn_agent_decide returned source=model, action=say, HTTP 200 after Nakama restart
  • Unity play smoke by JOY: NPC answered in the chat panel after the model-output recovery

Notes

Unrelated dirty files were intentionally left out of this PR: Photon generated code, generated knowledge packs, MCP research notes, and local private config.

@JOY JOY (JOY) merged commit a8af5a6 into dev May 20, 2026
1 check passed
@JOY JOY (JOY) deleted the codex/npc-chat-model-recovery branch May 20, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant