Skip to content

messagix/bloks: implement timer cancel function#301

Open
Fizzadar wants to merge 1 commit into
mainfrom
nick/messenger-lite-timeout-cancel
Open

messagix/bloks: implement timer cancel function#301
Fizzadar wants to merge 1 commit into
mainfrom
nick/messenger-lite-timeout-cancel

Conversation

@Fizzadar

Copy link
Copy Markdown
Member

Based on bloks debug payload, we see the timer get cancelled and immediately restarted, without this change we error at the cancel. Bloks debug payload:

TakeLast(
  If( is_timer_running AND approval_id != "XXX",   ← this page's approval id
      { timer.Cancel(GetArg 0, "approve_from_another_device_polling_timer")
        is_timer_running := false },                             ← kill a STALE timer
      null ),
  If( is_timer_running,
      null,                                                      ← already running: no-op
      { is_timer_running := true
        timer.Start(GetArg 0, 2000, true,                        ← restart: poll every 2000ms
          λ: If(is_loading, null,
                invoke "com.bloks.www.two_step_verification.afad_state.async" ...),
          "approve_from_another_device_polling_timer") } )
)

@Fizzadar
Fizzadar requested a review from radon-at-beeper July 14, 2026 10:06
Comment thread pkg/messagix/bloks/selenium.go Outdated
if err != nil {
if ctxErr := ctx.Err(); ctxErr != nil {
if errors.Is(ctxErr, context.DeadlineExceeded) {
return nil, ErrLoginAFADTimeout

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems wrong. If there is a context error then that means the user is gone already, but you're trying to return an error that is intended to display to the user.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed, in testing against the debug payloads I also spotted that every cancel function also displayed screen com.bloks.www.approve_from_another_device.xmds.challenged_device_denied so I've added support for that in here too.

@Fizzadar
Fizzadar force-pushed the nick/messenger-lite-timeout-cancel branch from 8de459a to 2eb2809 Compare July 16, 2026 10:59
Based on bloks debug payload, we see the timer get cancelled and immediately
restarted, without this change we error at the cancel. Bloks debug payload:

```
TakeLast(
  If( is_timer_running AND approval_id != "XXX",   ← this page's approval id
      { timer.Cancel(GetArg 0, "approve_from_another_device_polling_timer")
        is_timer_running := false },                             ← kill a STALE timer
      null ),
  If( is_timer_running,
      null,                                                      ← already running: no-op
      { is_timer_running := true
        timer.Start(GetArg 0, 2000, true,                        ← restart: poll every 2000ms
          λ: If(is_loading, null,
                invoke "com.bloks.www.two_step_verification.afad_state.async" ...),
          "approve_from_another_device_polling_timer") } )
)
```
@Fizzadar
Fizzadar force-pushed the nick/messenger-lite-timeout-cancel branch from 2eb2809 to 7bbbebd Compare July 16, 2026 11:13
@Fizzadar
Fizzadar requested a review from radon-at-beeper July 16, 2026 11:14
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.

2 participants