[Bug]: Integers outside the Long range from the LLM become Double and lose precision
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
Research direction
The conversion lives in JsonElement.toPrimitive() in the agent module's domain/JsonExtensions.kt, which tries toLongOrNull() then toDoubleOrNull(). Start there and reproduce with a number above Long.MAX_VALUE sent for a String parameter. Done when the literal digits reach the app function unchanged and existing number conversions still pass their tests.
Written by the indexing model from the issue text.
Description
Steps to Reproduce
- Have the model send an integer above
Long.MAX_VALUE(e.g. an ID such as12345678901234567890)
for aStringor string-array parameter.
Expected
The value reaches the app function exactly as the digits the model sent ("12345678901234567890").
Observed
"1.2345678901234567E19".
Root cause
JsonElement.toPrimitive() (agent/.../domain/JsonExtensions.kt) tries toLongOrNull() and then
toDoubleOrNull(), so big integers become Double. The raw JSON content is then lost before
type-aware conversion.
Suggested fix
Keep the raw JSON content for numbers that don't fit Long, for example as a String or BigDecimal. Or
convert with the parameter's metadata, so string parameters receive the literal digits.
Found during review of the #62 fix.
- Dominant language
- Kotlin
- Stars
- 222
- Forks
- 54
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/appfunctions
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
android/appfunctions#84 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
android/appfunctions#82 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
android/appfunctions#81 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 90/100
android/appfunctions#66 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
android/appfunctions#62 · 2 comments ·
Maintainers usually reply within 1 day
All issues in android/appfunctions
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
MetrolistGroup/Metrolist#5426 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
🐛 Type:Bug 📥 State:Awaiting Assignment 🚨 Priority: P0 - Critical
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
micronizationlab/glafira-ai-hub#785 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sorsama/deepseek-harness-mobile#154 ·
Maintainers usually reply within 1 day
-
0. Needs triage enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day