Skip to content

fix: improve NPC dialog retry and UI readability#100

Merged
JOY (JOY) merged 1 commit into
devfrom
codex/npc-dialog-polish
May 20, 2026
Merged

fix: improve NPC dialog retry and UI readability#100
JOY (JOY) merged 1 commit into
devfrom
codex/npc-dialog-polish

Conversation

@JOY
Copy link
Copy Markdown
Contributor

Summary

  • Add bounded retry for direct player-to-NPC chat when DOS.AI returns transient timeout or 5xx fallback reasons.
  • Keep deterministic fallback speech suppressed in Unity dialogue so only model-authored NPC lines appear as spoken dialogue.
  • Improve prototype speech bubble and UGUI chat readability on high-resolution displays.
  • Lower the default Nakama DOS.AI decision timeout from 120 seconds to 30 seconds, with env override still supported.
  • Update ROADMAP, CHANGELOG, and Nakama README.

Local code review

Verdict: APPROVED WITH SUGGESTIONS.

Notes:

  • No authority regression found. LLM output still cannot mutate authoritative game state.
  • No client key exposure found. Unity still calls Nakama, not api.dos.ai directly.
  • Suggestion for a later PR: add an explicit NPC response lifecycle event so the chat panel can show model-response completion or failure instead of only the initial society queue status.

Verification

  • npm.cmd install in backend/nakama
  • 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
  • dotnet build Unity\SecondSpawn.Networking.csproj via worktree compiler setup
  • npx.cmd markdownlint-cli2 ROADMAP.md CHANGELOG.md backend/nakama/README.md
  • git diff --check
  • em dash scan on changed files

Review fallback

Codex Cloud and Gemini reviews are best-effort per repo policy. If cloud review quota or connector limits prevent them from running, this PR is ready for merge after green CI plus the local review fallback above.

@JOY JOY (JOY) merged commit 3cabfac into dev May 20, 2026
2 checks passed
@JOY JOY (JOY) deleted the codex/npc-dialog-polish branch May 20, 2026 15:49
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8787e421d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

yield return _gateway.Decide(request, value => decision = value, error => decisionError = error);
}
finally
while (HasFreshPendingPlayerChat() && _pendingPlayerChatAttemptCount < PlayerChatMaxModelAttempts)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit retry loop to player-originated chat stimuli

The new retry loop runs for every pending speech stimulus, but this coroutine is also used for NPC-to-NPC speech (NotifyNearbyNpcSpeech sets fromNpc=true before starting PlayerChatResponseLoop). Because the retry path here does not check _pendingMessageFromNpc, transient DOS.AI failures now cause up to three model calls per NPC-heard line, which can amplify load and consume model budget during outages even though the feature is scoped to direct player chat. Restrict retries to player-originated messages before entering the retry attempts.

Useful? React with 👍 / 👎.

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