Skip to content

fix(vm): propagate ANON/waif/primitive type into caller variable#19

Open
daiverd wants to merge 1 commit into
masterfrom
fix/anon-caller-type
Open

fix(vm): propagate ANON/waif/primitive type into caller variable#19
daiverd wants to merge 1 commit into
masterfrom
fix/anon-caller-type

Conversation

@daiverd

@daiverd daiverd commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • When a verb call is made from a frame whose this is an anonymous object (or waif/primitive), the caller variable in the called verb was set as plain OBJ wrapping the same ObjID — causing caller == this to always return false (OBJ ≠ ANON even at the same ID).
  • Fix: when the calling frame's this carries a non-None ThisValue (ANON/waif/primitive), propagate that value directly into caller instead of wrapping the bare ObjID as OBJ.
  • Root cause surfaced in production databases (chatmud.db): #103:send guards with caller == this on an anonymous MCP session object. The mismatch raised E_PERM, silently aborting session creation, leaving player.out_of_band_session unset, and ultimately causing E_INVIND in @edit.

Test plan

  • Two new conformance tests added to moo-conformance-tests (anonymous::caller_type_is_anon_inside_anonymous, anonymous::caller_equals_this_inside_anonymous) — both fail on unpatched barn, both pass on Toast and on this branch
  • Full conformance suite: 4213 passed, 16 failed, 131 skipped — identical to master (no regressions)
  • Conformance tests PR: MongooseMoo/moo-conformance-tests (verb-code-by-index branch)

🤖 Generated with Claude Code

When a verb call is made from a frame whose `this` is an anonymous object
(or waif/primitive), the `caller` variable in the called verb must carry
the same value type — not a plain OBJ wrapping the same ObjID.

Without this fix, verbs that test `caller == this` where `this` is ANON
always fail: OBJ(-X) != ANON(-X) because the type tags differ. This broke
the MCP session chain in databases like chatmud.db where #103:send guards
with `caller == this`. The guard raised E_PERM, the session create failed
silently, and `out_of_band_session` was never set, ultimately causing
E_INVIND in `@edit` when the nil session was called as an object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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