Skip to content

Fix ambient serde bug: handle string or u32 for Claude tool parameters#173

Open
zanni098 wants to merge 2 commits into
1jehuang:masterfrom
zanni098:fix-ambient-serde-bug
Open

Fix ambient serde bug: handle string or u32 for Claude tool parameters#173
zanni098 wants to merge 2 commits into
1jehuang:masterfrom
zanni098:fix-ambient-serde-bug

Conversation

@zanni098
Copy link
Copy Markdown

@zanni098 zanni098 commented May 8, 2026

Fixes #106

Claude's tool calling sends parameters as strings (e.g., {"compactions": "0"})
but the struct fields use u32, causing deserialization to fail with:
"invalid type: string "0", expected u32"

This fix adds custom deserializers to accept both string and u32 types:

  • deserialize_string_or_u32: for required u32 fields
  • deserialize_string_or_option_u32: for Option fields

Applied to:

  • EndCycleInput: memories_modified, compactions
  • NextScheduleInput: wake_in_minutes
  • ScheduleInput: wake_in_minutes
  • ScheduleToolInput: wake_in_minutes

Impact: Every ambient cycle was failing with this error, preventing ambient mode from working at all.


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

zanni098 added 2 commits May 8, 2026 16:06
This guide provides Windows-specific setup instructions and troubleshooting for jcode users on Windows 10/11.

- Installation details (PowerShell installer, manual install)
- Windows-specific configuration paths
- CLI login flags (addressing issue 1jehuang#82)
- Terminal compatibility recommendations
- Known Windows issues (1jehuang#82, 1jehuang#118, 1jehuang#140) with workarounds
- Troubleshooting section for common problems
- How to get help and file issues
Claude's tool calling sends parameters as strings (e.g., {"compactions": "0"})
but the struct fields use u32, causing deserialization to fail with:
"invalid type: string \"0\", expected u32"

This fix adds custom deserializers to accept both string and u32 types:
- deserialize_string_or_u32: for required u32 fields
- deserialize_string_or_option_u32: for Option<u32> fields

Applied to:
- EndCycleInput: memories_modified, compactions
- NextScheduleInput: wake_in_minutes
- ScheduleInput: wake_in_minutes
- ScheduleToolInput: wake_in_minutes

Fixes 1jehuang#106
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

Ambient: end_ambient_cycle fails with 'invalid type: string, expected u32' - serde type coercion bug

1 participant