Skip to content

messagix/bloks: handle string/bool/nil in i64.Convert - #343

Open
trevornk wants to merge 1 commit into
mautrix:mainfrom
trevornk:fix/bloks-i64-convert-type-coercion
Open

messagix/bloks: handle string/bool/nil in i64.Convert#343
trevornk wants to merge 1 commit into
mautrix:mainfrom
trevornk:fix/bloks-i64-convert-type-coercion

Conversation

@trevornk

@trevornk trevornk commented Sep 2, 2026

Copy link
Copy Markdown

Meta's Messenger Lite login flow calls bk.action.i64.Convert from the two-step verification (2FA) screen. The interpreter's current implementation only handles int64 and float64 arguments, returning can't convert %T to i64 for anything else. In practice, some steps in the 2FA Bloks flow pass string, bool, or null values into this function, which aborts login right after the password step whenever that happens.

This adds handling for:

  • numeric strings, including float-formatted strings like "3.0"
  • bool (true/false -> 1/0)
  • nil (-> 0)

Non-numeric strings still return an error, same as before.

We've been running this patch locally for a stretch as a workaround for logins getting stuck on this exact error during 2FA, and it's resolved it cleanly with no observed regressions. Included a table-driven test covering all the new cases plus the existing numeric passthrough behavior.

Meta's 2FA screen during Messenger Lite login invokes
bk.action.i64.Convert with string, bool, and null arguments, not just
int64/float64. The interpreter only handled the two numeric cases and
returned an error for anything else, aborting login right after the
password step whenever the 2FA flow passed a non-numeric type.

Add handling for numeric strings (including float-formatted strings
like "3.0"), bool (true/false -> 1/0), and nil (-> 0), matching the
apparent semantics of Meta's own Bloks runtime. Non-numeric strings
still return an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant