Skip to content

Qualify invokelatest in the variables request handler - #141

Merged
davidanthoff merged 1 commit into
mainfrom
agents/fix-invokelatest-qualification
Oct 4, 2026
Merged

davidanthoff merged 1 commit into
mainfrom
agents/fix-invokelatest-qualification

Conversation

@davidanthoff

Copy link
Copy Markdown
Member

This PR was opened by Claude (Claude Code) on David's behalf.

Problem

Base.run(::DebugSession) registers the variables handler as

msg_dispatcher[variables_request_type] = params -> invokelatest(variables_request, debug_session, params)

Base only exports invokelatest from Julia 1.9 on, and this package supports Julia 1.0+. On 1.0–1.8, every variables request therefore threw UndefVarError: invokelatest not defined in the dispatcher before variables_request ran. The client got an error response and the variables pane never filled in. CI stayed green because the existing variables tests call variables_request directly and never go through this line. (PR #139 hit the same problem in a test and fixed it there.)

Change

  • src/packagedef.jl: call Base.invokelatest, like every other use in the package. I grepped src/ and test/ and this was the only unqualified invokelatest.
  • test/test_debugsession.jl: new test item, "a variables request sent to the session is answered". It uses the existing DapClient snippet (with_debug_session(requests_after=...)) to send a real variables request over the wire after the debuggee has finished. It checks that the request gets a successful, empty response and that nothing reaches the session's error handler. This needed no new harness code.

The test only covers the request after the debuggee has finished, with a stale reference, not while paused on a real frame. That is enough to exercise the dispatcher line, and the existing harness has no hook for sending requests while the debuggee is paused.

Verification (run locally on Windows)

  • Julia 1.8.5 without the fix: the new test fails, and the error handler receives UndefVarError(:invokelatest).
  • With the fix: the full suite passes on Julia 1.0.5, 1.6.7, 1.8.5 and 1.13.1.

🤖 Generated with Claude Code

Base only exports `invokelatest` from Julia 1.9 on, so on 1.0-1.8 every
`variables` request threw `UndefVarError: invokelatest not defined` in the
dispatcher before the handler ran. Call it as `Base.invokelatest`, like
every other use in the package, and add a test that sends a `variables`
request through the session's dispatcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidanthoff
davidanthoff merged commit e444bd5 into main Oct 4, 2026
161 checks passed
@davidanthoff
davidanthoff deleted the agents/fix-invokelatest-qualification branch October 4, 2026 16:44
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