Skip to content

fix(vfox): let plugins call async functions inside pcall - #15741

Merged
jdx merged 1 commit into
mainfrom
fix/vfox-yieldable-pcall
Nov 15, 2026
Merged

jdx merged 1 commit into
mainfrom
fix/vfox-yieldable-pcall

Conversation

@jdx

@jdx jdx commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Installing vfox:version-fox/vfox-python fails with a Lua error. vfox-python 0.6.4, published 2026-11-14, wraps its version-index requests in pcall. Embedded Lua 5.1's pcall cannot be yielded across, and http.get suspends the plugin's coroutine while it waits. Every install then fails:

$ mise i vfox:version-fox/vfox-python@3.12.0
mise ERROR Failed to install vfox:version-fox/vfox-python@3.12.0: runtime error: ...util.lua:1836:
Could not list Python versions. pyenv: attempt to yield across metamethod/C-call boundary;
uv-build: attempt to yield across metamethod/C-call boundary

The same would hit any plugin that puts http.get, http.download_file or another async call inside pcall.

Plugins now get a pcall that runs the protected function in its own coroutine and passes its yields up. Results and errors behave as with the built-in pcall.

xpcall is unchanged. A message handler needs the stack at the point of the error, which a coroutine would discard.

This also unblocks release on the open release PR: e2e-linux-2 fails on test_vfox_python_slow, which only runs with TEST_ALL=1, so main never exercised it.

Testing

  • Unit tests cover the old pcall failing on an async call, and the new one returning results, nesting, catching errors after a yield, and matching the old pcall without yields.
  • TEST_ALL=1 mise run test:e2e test_vfox_python_slow passes on this branch. It failed on the release PR with the error above; I did not re-run it on main locally.
  • cargo clippy -p vfox --all-targets -- -D warnings passes.

AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.

🤖 Generated with Claude Code


Note

Medium Risk
Globally overrides Lua pcall for every vfox plugin, so any subtle semantic drift could affect all plugin scripts; scope is limited and covered by dedicated tests.

Overview
Replaces Lua 5.1's global pcall in the vfox plugin runtime with a yield-aware implementation so plugins can safely wrap async APIs (http.get, cmd, etc.) in protected calls without hitting "attempt to yield across metamethod/C-call boundary".

The new pcall runs the target function in a child coroutine and forwards yields to the caller via a settle loop; it still returns success/failure tuples like the built-in. mod_pcall is registered in lua_mod and invoked during plugin load before the standard modules are installed.

Unit tests document native pcall failing on async calls and cover the replacement for success, nesting, errors after yield, and non-yielding parity with stock pcall.

Reviewed by Cursor Bugbot for commit c1e9961. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features
    • Protected Lua calls can now pause while asynchronous operations complete, then resume with their results. This also works for nested calls. Successful calls continue to return their results, while failures return an error instead of interrupting execution.
    • Protected calls that do not use asynchronous operations continue to behave as before.

The embedded Lua 5.1 pcall cannot be yielded across, so a plugin that wraps
http.get (or another async call) in pcall failed with 'attempt to yield across
metamethod/C-call boundary'. vfox-python 0.6.4 does this when it lists versions,
which broke test_vfox_python_slow and the release PR's e2e job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AI-Assisted: Tool: Claude Code; model: unavailable; version: 2.1.325
Entire-Checkpoint: 01M7E9XRD3PCJ7VK5HCF389MTF
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a coroutine-based Lua pcall wrapper that forwards yields and returns protected-call results. Plugin::load registers the wrapper before standard Lua modules.

Changes: Yield-capable Lua protected calls

Layer / File(s) Summary
Implement and test the protected-call wrapper
crates/vfox/src/lua_mod/mod.rs, crates/vfox/src/lua_mod/pcall.rs
The wrapper runs protected functions in a coroutine and forwards yielded values and caller responses. Tests cover yielding, nested calls, errors after yielding, and non-yielding calls.
Register pcall during plugin loading
crates/vfox/src/plugin.rs
Plugin::load registers the wrapper before registering standard Lua modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant LuaCaller as Lua caller
  participant ProtectedCall as global pcall
  participant Coroutine
  participant AsyncFunction
  LuaCaller->>ProtectedCall: call protected function
  ProtectedCall->>Coroutine: run target function
  Coroutine->>AsyncFunction: invoke target
  AsyncFunction-->>Coroutine: yield values
  Coroutine-->>ProtectedCall: forward yielded values
  ProtectedCall-->>LuaCaller: return yielded values
  LuaCaller->>ProtectedCall: provide resume values
  ProtectedCall->>Coroutine: resume target
  Coroutine-->>ProtectedCall: return final status and values
  ProtectedCall-->>LuaCaller: return protected-call results
Loading
Merge Risk: Minimal · up to c1e99

The change lets plugins call async functions such as http.get inside pcall, which fixes the vfox-python version-index failures. The one remaining difference from native pcall is a narrow edge case during synchronous metadata loading. It is unlikely to matter in practice and does not block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (vfox plugins calling async functions inside pcall) and the affected component (vfox). The raw summary confirms the change adds a coroutine-based pcall to the Lua module regist…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the fix (vfox plugins calling async functions inside pcall) and the affected component (vfox). The raw summary confirms the change adds a coroutine-based pcall to the Lua module registry, loads it in Plugin::load, and includes tests for async, nested, and error cases. The title matches the main change, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: jdx/mise
  • Branch: fix/vfox-yieldable-pcall
  • File: .coderabbit.yaml
  • Commit: c1e9961
  • Layers: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16c96b61-9487-45a3-b178-defa857bbc2e
Commits

Reviewing files that changed from the base of the PR and between f23da76 and c1e9961.

Files selected for processing: 3

  • crates/vfox/src/lua_mod/mod.rs
  • crates/vfox/src/lua_mod/pcall.rs
  • crates/vfox/src/plugin.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Replaces vfox plugins’ Lua pcall with a version that lets protected calls pause for async work.

  • Protected plugin calls can pause for async work and return their results.

No actionable issues found. Tests were not run during this review.

AI-assisted — Tool: Greptile; model: llmproxy/gpt-6.1-sol; version: unavailable.

Reviews (2) · Last reviewed commit: "fix(vfox): let plugins call async functi..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ████████▁▁▁▁▁ 36,387,218 → 36,246,560 -0.39% 21.83 → 21.83ms +0.01%
hook-env ████████▁▁▁▁▁ 38,369,760 → 38,195,970 -0.45% 22.68 → 22.80ms +0.51%
ls ████████▁▁▁▁▁ 41,105,926 → 40,935,950 -0.41% 23.79 → 23.69ms -0.45%
registry ████████▁▂▂▂▁ 43,545,759 → 43,365,260 -0.41% 19.23 → 19.22ms -0.04%
startup ▆█▅▅▄▅▅▅▄▅▅▆▁ 12,810,739 → 12,736,247 -0.58% 13.18 → 13.11ms -0.55%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

c1e9961fba2d vs f23da76115f4 · measured on the runner, not pushed to the history.

@jdx
jdx merged commit a687115 into main Nov 15, 2026
59 of 61 checks passed
@jdx
jdx deleted the fix/vfox-yieldable-pcall branch November 15, 2026 04:21
jdx pushed a commit that referenced this pull request Nov 16, 2026
### 🚀 Features

- **(aqua)** run .jar packages through java -jar by @jdx in
[#15688](#15688)
- **(task)** include cache, lock and skip_if in tasks ls --json by @jdx
in [#15675](#15675)
- **(task)** add deny_unix and allow_unix sandbox restrictions by @jdx
in [#15672](#15672)
- **(task)** render templates in lock names by @jdx in
[#15710](#15710)
- **(task)** let a lock hold several slots with `task.lock_pools` and
`count` by @jdx in [#15720](#15720)

### 🐛 Bug Fixes

- **(bootstrap)** pull the global config before loading it on --update
by @jdx in [#15731](#15731)
- **(bootstrap)** skip brew-cask entries with unsupported artifacts on
linux by @jdx in [#15732](#15732)
- **(brew)** support Array#second in tap metadata shims by @jdx in
[#15708](#15708)
- **(brew)** build source formulas that use with_env by @jdx in
[#15737](#15737)
- **(brew)** install cask binaries from URLs without a filename by @jdx
in [#15738](#15738)
- **(brew)** link cask binaries that name nested app bundles by @jdx in
[#15739](#15739)
- **(brew)** accept installer script casks from taps by @jdx in
[#15743](#15743)
- **(dotfiles)** warn about keys no dotfile entry or bootstrap hook
reads by @jdx in [#15735](#15735)
- **(dotfiles)** refuse whole-file keys on block and line edits by @jdx
in [#15733](#15733)
- **(env)** run compinit when zsh _comps is not an associative array by
@jdx in [#15692](#15692)
- **(erlang)** use /etc/os-release when ImageOS is the generic Linux by
@jdx in [#15691](#15691)
- **(install)** keep an installed version newer than the
minimum_release_age cutoff by @jdx in
[#15673](#15673)
- **(install)** summarize tracked-config load failures during deferred
prune by @jdx in [#15698](#15698)
- **(lock)** keep the locked version when --bump resolves an older one
by @jdx in [#15687](#15687)
- **(lock)** keep the locked version when minimum_release_age hides
every match under --bump by @jdx in
[#15689](#15689)
- **(lock)** name the tool and provenance in the downgrade error by @jdx
in [#15755](#15755)
- **(npm)** turn off aube's release age gate when mise has it off by
@jdx in [#15697](#15697)
- **(search)** show the registry url instead of a guessed github link by
@jdx in [#15709](#15709)
- **(self-update)** download the Windows release archive only once by
@jdx in [#15686](#15686)
- **(task)** do not cache a pass when a source changed during the run by
@jdx in [#15719](#15719)
- **(task)** scan the cache once when clearing several tasks by @jdx in
[#15718](#15718)
- **(version)** don't call the official apt package a third-party build
by @jdx in [#15690](#15690)
- **(vfox)** let plugins call async functions inside pcall by @jdx in
[#15741](#15741)
- **(zig)** record minisign provenance at lock time by @jdx in
[#15730](#15730)

### 📚 Documentation

- **(config)** note explicit global and system config files load no env
variants by @jdx in [#15716](#15716)

### ⚡ Performance

- **(config)** trim eager work in hook-env by @jdx in
[#15734](#15734)

### 📦 Registry

- add jadx by @jdx in [#15685](#15685)
- add jscpd by @jdx in [#15696](#15696)

### Chore

- **(ci)** migrate lock workflows to GitHub App client IDs by @jdx in
[#15714](#15714)

## 📦 Aqua Registry Updates

### New Packages (10)

- [`LambdaBytes/sping`](https://github.com/LambdaBytes/sping)
-
[`creativeprojects/resticprofile`](https://github.com/creativeprojects/resticprofile)
- [`elastic/crd-ref-docs`](https://github.com/elastic/crd-ref-docs)
- [`emprcl/spor`](https://github.com/emprcl/spor)
- [`github/gh-actions-lock`](https://github.com/github/gh-actions-lock)
-
[`google.com/cloud-sdk`](https://github.com/google-cloud-sdk-unofficial/google-cloud-sdk)
- [`iBotPeaches/Apktool`](https://github.com/iBotPeaches/Apktool)
- [`mongodb/kingfisher`](https://github.com/mongodb/kingfisher)
- [`timmo001/kestrel`](https://github.com/timmo001/kestrel)
- [`yhay81/sqrail`](https://github.com/yhay81/sqrail)

### Updated Packages (3)

- [`herdrdev/herdr-core`](https://github.com/herdrdev/herdr-core)
- [`kyverno/kyverno`](https://github.com/kyverno/kyverno)
- [`walles/moor`](https://github.com/walles/moor)
gabrielcosi pushed a commit to gabrielcosi/home-ops that referenced this pull request Nov 16, 2026
… (#1782)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/jdx/mise](https://github.com/jdx/mise) | patch | `2026.11.8` → `2026.11.9` |

---

### Release Notes

<details>
<summary>jdx/mise (ghcr.io/jdx/mise)</summary>

### [`v2026.11.9`](https://github.com/jdx/mise/blob/HEAD/CHANGELOG.md#2026119---2026-11-16)

[Compare Source](jdx/mise@v2026.11.8...v2026.11.9)

##### 🚀 Features

- **(aqua)** run .jar packages through java -jar by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15688](jdx/mise#15688)
- **(task)** include cache, lock and skip_if in tasks ls --json by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15675](jdx/mise#15675)
- **(task)** add deny_unix and allow_unix sandbox restrictions by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15672](jdx/mise#15672)
- **(task)** render templates in lock names by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15710](jdx/mise#15710)
- **(task)** let a lock hold several slots with `task.lock_pools` and `count` by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15720](jdx/mise#15720)
- **(task)** select dependencies by tag with { tag = ... } by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15753](jdx/mise#15753)

##### 🐛 Bug Fixes

- **(bootstrap)** pull the global config before loading it on --update by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15731](jdx/mise#15731)
- **(bootstrap)** skip brew-cask entries with unsupported artifacts on linux by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15732](jdx/mise#15732)
- **(brew)** support Array#second in tap metadata shims by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15708](jdx/mise#15708)
- **(brew)** build source formulas that use with_env by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15737](jdx/mise#15737)
- **(brew)** install cask binaries from URLs without a filename by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15738](jdx/mise#15738)
- **(brew)** link cask binaries that name nested app bundles by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15739](jdx/mise#15739)
- **(brew)** accept installer script casks from taps by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15743](jdx/mise#15743)
- **(dotfiles)** warn about keys no dotfile entry or bootstrap hook reads by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15735](jdx/mise#15735)
- **(dotfiles)** refuse whole-file keys on block and line edits by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15733](jdx/mise#15733)
- **(env)** run compinit when zsh \_comps is not an associative array by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15692](jdx/mise#15692)
- **(erlang)** use /etc/os-release when ImageOS is the generic Linux by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15691](jdx/mise#15691)
- **(install)** keep an installed version newer than the minimum_release_age cutoff by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15673](jdx/mise#15673)
- **(install)** summarize tracked-config load failures during deferred prune by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15698](jdx/mise#15698)
- **(lock)** keep the locked version when --bump resolves an older one by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15687](jdx/mise#15687)
- **(lock)** keep the locked version when minimum_release_age hides every match under --bump by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15689](jdx/mise#15689)
- **(lock)** name the tool and provenance in the downgrade error by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15755](jdx/mise#15755)
- **(npm)** turn off aube's release age gate when mise has it off by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15697](jdx/mise#15697)
- **(search)** show the registry url instead of a guessed github link by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15709](jdx/mise#15709)
- **(self-update)** download the Windows release archive only once by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15686](jdx/mise#15686)
- **(shim)** keep shims pointing at mise after a shim-triggered install by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15758](jdx/mise#15758)
- **(task)** do not cache a pass when a source changed during the run by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15719](jdx/mise#15719)
- **(task)** scan the cache once when clearing several tasks by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15718](jdx/mise#15718)
- **(version)** don't call the official apt package a third-party build by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15690](jdx/mise#15690)
- **(vfox)** let plugins call async functions inside pcall by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15741](jdx/mise#15741)
- **(zig)** record minisign provenance at lock time by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15730](jdx/mise#15730)

##### 📚 Documentation

- **(config)** note explicit global and system config files load no env variants by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15716](jdx/mise#15716)

##### ⚡ Performance

- **(config)** trim eager work in hook-env by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15734](jdx/mise#15734)

##### 📦 Registry

- add jadx by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15685](jdx/mise#15685)
- add jscpd by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15696](jdx/mise#15696)

##### Chore

- **(ci)** migrate lock workflows to GitHub App client IDs by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;15714](jdx/mise#15714)

##### 📦 Aqua Registry Updates

##### New Packages (20)

- [`LambdaBytes/sping`](https://github.com/LambdaBytes/sping)
- [`Mattbusel/Every-Other-Token`](https://github.com/Mattbusel/Every-Other-Token)
- [`Mattbusel/corescout`](https://github.com/Mattbusel/corescout)
- [`Mattbusel/llm-bench`](https://github.com/Mattbusel/llm-bench)
- [`Mattbusel/llm-cost-dashboard`](https://github.com/Mattbusel/llm-cost-dashboard)
- [`Mattbusel/polymarket-agent`](https://github.com/Mattbusel/polymarket-agent)
- [`Mattbusel/prompt-observatory`](https://github.com/Mattbusel/prompt-observatory)
- [`Mattbusel/reckoner`](https://github.com/Mattbusel/reckoner)
- [`Mattbusel/tft-synapse`](https://github.com/Mattbusel/tft-synapse)
- [`Mattbusel/tokenviz`](https://github.com/Mattbusel/tokenviz)
- [`Mattbusel/tokio-prompt-orchestrator`](https://github.com/Mattbusel/tokio-prompt-orchestrator)
- [`creativeprojects/resticprofile`](https://github.com/creativeprojects/resticprofile)
- [`elastic/crd-ref-docs`](https://github.com/elastic/crd-ref-docs)
- [`emprcl/spor`](https://github.com/emprcl/spor)
- [`github/gh-actions-lock`](https://github.com/github/gh-actions-lock)
- [`google.com/cloud-sdk`](https://github.com/google-cloud-sdk-unofficial/google-cloud-sdk)
- [`iBotPeaches/Apktool`](https://github.com/iBotPeaches/Apktool)
- [`mongodb/kingfisher`](https://github.com/mongodb/kingfisher)
- [`timmo001/kestrel`](https://github.com/timmo001/kestrel)
- [`yhay81/sqrail`](https://github.com/yhay81/sqrail)

##### Updated Packages (3)

- [`herdrdev/herdr-core`](https://github.com/herdrdev/herdr-core)
- [`kyverno/kyverno`](https://github.com/kyverno/kyverno)
- [`walles/moor`](https://github.com/walles/moor)

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Berlin)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMzkuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjIzOS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.xcd.dev/gabrielcosi/home-ops/pulls/1782
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.

1 participant