Repository navigation
Conversation
…ds, not Python literals Root cause for the silent state-sync failures during reprovision-all: JSON.stringify(...) interpolated directly into the python heredoc produced lowercase `true` / `false` / `null` — valid JSON but **not valid Python** literals (Python wants `True` / `False` / `None`). The first embedded boolean (e.g. `agents_defaults.memorySearch.enabled: true`) raised NameError, python exited 1, and every state-sync since 2a4bc13 failed silently. Result: the gateway PVC `/state/moltbot.json` never got the new `defaults.model.primary = nemotron`, never got the openrouter provider catalog, and community agents kept routing to the stale gpt-5.4-mini default — burning Codex. Fix: double-encode through JSON.stringify so each embedded value becomes a valid Python string literal, and parse it at runtime via `json.loads`. This works for any JSON-shaped payload (booleans, null, nested objects, unicode) without manual escaping. Also: include captured stderr in the execInPod error message. Kubelet's "command terminated with non-zero exit code" alone is useless; the python NameError was sitting in stderr the whole time and was hidden by the wrapper. With this change, the next instance of the same class of bug will be visible from the first failed call. After this PR + Deploy Dev + reprovision-all, the gateway PVC will reflect the in-code defaults (nemotron primary, OR provider with nemotron-only catalog) on every account sync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Squash-merged locally to preserve Sam Xu attribution. Closing. |
samxu01
added a commit
that referenced
this pull request
May 3, 2026
…SON booleans (#284) JSON.stringify(...) interpolated into the python heredoc produced lowercase true/false/null — valid JSON but invalid Python. The first embedded boolean (agents_defaults.memorySearch.enabled: true) raised NameError, python exited 1, every state-sync silently failed since 2a4bc13. Result: gateway PVC ignored config updates including the nemotron default that should have stopped the Codex burn. Two changes: 1. Double-encode each embedded value through JSON.stringify so it becomes a valid Python string literal, parse at runtime via json.loads. 2. Include captured stderr in execInPod error messages — the python stderr was the smoking gun all along but was being thrown away. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
samxu01
added a commit
that referenced
this pull request
May 4, 2026
… clarified (#289) Update Agent Runtime quick-rule for community/dev model routing to match the post-burn-fix state (PRs #282, #284, #285): - Drop trinity reference (model dead at OpenRouter) - Add aria to dev-agent list - Note hard guardrail in applyOpenClawModelDefaults blocking codex from community fallback chain - Document GEMINI_API_KEY's wrong-project status (946211286881) so future debugging doesn't waste time - Document new retry policy: num_retries=1 + retry_after=1 lets codex-auth-rotator swap auth.json before retry reads it Pure docs change, no test deltas. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Every `syncAccountToStateMoltbot` call from the JS provisioner has been silently failing since `2a4bc1314d` (2026-05-02). Result: the gateway PVC `/state/moltbot.json` ignored every config update — including the new `defaults.model.primary = nemotron` that should have stopped the Codex burn at the source.
The bug:
```ts
`agents_defaults = ${JSON.stringify(agentsDefaults)}`, // emits Python source
```
produces lowercase `true` / `false` / `null` — valid JSON, not valid Python (Python wants `True`/`False`/`None`). The first embedded boolean (`memorySearch.enabled: true`) raised `NameError: name 'true' is not defined`, python exited 1, the kubelet returned "command terminated with non-zero exit code", and `execInPod` rejected without surfacing the python stderr that explained why.
Why it took so long to find
`execInPod` only included the kubelet's generic message in the rejected error. Python's NameError sat in the captured stderr buffer but was thrown away. So the user saw 250+ "Failed to sync account" log lines with no clue what python actually did. Hour-long debugging chased every wrong direction (websocket flake, race conditions, set-eu) before noticing the lowercase booleans.
Fix
Test plan
🤖 Generated with Claude Code