Skip to content

rust mode: module-served classify-memories records 0 tokens and no model in subagent_invocations (module omits usage, host drops the model it does get) #520

Description

@iceteaSA

Refs are against master 62bf58c0c. The same loss happens on v0.42.6 on a live host.

Observed

On a host where one project holds MODULE authority, every module-served classify-memories run lands in subagent_invocations as completed with input 0, output 0, and no model. The runner module's own run index records real spend for the same run: 14,039 in and 6,125 out on antigravity-gemini-3.8-flash (2026-09-24 06:00:47Z). Host-side cost and usage reporting therefore never sees module-served classify spend. This is the same symptom as the Pi historian lane in #435, on a different lane.

Both halves drop it

Module: the dreamer.run_task response (crates/mc-module/src/lib.rs:11519-11533) carries diagnostics.model, attempts and child_session_id, but no usage. The producer's usage never enters the response.

Host: runClassifyChunk takes the module route and records only a status (packages/plugin/src/features/magic-context/dreamer/classify.ts:349-352):

if (moduleRoute) {
    const run = await runClassifyThroughModule(args, chunk, anchors, signal);
    recordInvocation(args, startedAt, { status: "completed" });
    return run;

recordInvocation fills tokens and provider/model only from a completion (:682-686), and none is passed here. So even the model the module does return (diagnostics.model) is discarded.

Suggested shape

Have the module include the producer's usage in the dreamer.run_task response, then have the host map diagnostics.model and that usage into recordInvocation on the module route. The historian's module lane likely has the same gap, but I only verified classify.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions