Skip to content

Report typed non-complete native guest states instead of invalid_output - #268

Merged
HemSoft merged 3 commits into
mainfrom
fix/issue-255-typed-guest-states
Oct 24, 2026
Merged

HemSoft merged 3 commits into
mainfrom
fix/issue-255-typed-guest-states

Conversation

@HemSoft

@HemSoft HemSoft commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #255.

Problem

For a non-complete state the guest left nativeVMFinished.Report nil. As a json.RawMessage that encodes as "Report":null; the host decoded the 4 bytes null, its exact re-encoding check still matched, and valid() refused every non-complete record because it requires an empty report. Every typed guest failure (auth_failed, provider_unavailable, incomplete_expired, …) therefore reached the host as invalid_output, with the VM boot error attached. A complete record with a null report also passed valid().

Change

  • Report is tagged json:",omitempty": the guest omits an absent report, and the host's exact re-encoding treats omission as canonical, so the wire format stays strict.
  • An explicit null is a carried value: valid() refuses it in every state, including complete (stricter than before).
  • The host's classification of a decoded record moves into nativeVMFinished.failure(q) with unchanged behaviour; a valid typed record becomes PhaseError{State}.
  • NATIVE-VM.md documents the envelope rule; HOSTILE-FIXTURES.md and EXHAUSTION-FIXTURES.md explain that earlier phase-invalid_output classes were the host's and record the classes measured after the fix.

Evidence

  • TestNativeVMHostReceivesTypedGuestFailureAsEncodedByTheGuest runs the guest's real finish() over a pipe, then the host's readVMRecord and failure(), for both providers and every typed state; TestNativeVMFinishedRefusesReportsOutsideCompleteOverTheWire checks the accepted and refused envelopes. Both fail on the old code (every state refused; a null-report complete accepted).
  • Measured at a3c8dbd on mini (guest image, runner, source stub and reviewer.test built from that commit; one VM at a time behind a ≥2.5 GB available-memory gate): exhaustion 12/12, with claude-turn-flood now recording phase-incomplete_expired instead of the host's phase-invalid_output; hostile 19 pass + the contained codex-metadata client failure (refused cases still phase-invalid_output, now the guest's own classification); every E2E case passes including close-provider-recover (101 checks).
  • go vet ./..., the Python suites and go test -race ./... (reviewer package 247.125 s) pass.

Both the guest (nativevmguest / native image) and every host binary that reads finished records change; a mismatched pair fails closed.

🤖 Generated with Claude Code

HemSoft and others added 3 commits October 23, 2026 20:53
The guest left Report nil on every non-complete finished record. As a
json.RawMessage, nil encodes as the literal null, which decodes back to
four bytes, so the host's valid() refused every typed guest failure
(auth_failed, provider_unavailable, cancelled, ...) and classified the
phase as invalid_output. The same decoding let a complete record carry a
null report past valid().

Report is now omitted when absent. The host's exact re-encoding keeps
that canonical: an explicit null is a carried value, which valid()
refuses for every state. The host's classification of a decoded record
is extracted as nativeVMFinished.failure. The guest and host binaries
must both be rebuilt; a mixed pair fails closed.

Tests encode records through the guest's own finish producer and the
host's readVMRecord/failure path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record that the measured phase-invalid_output classes were the host's
refusal of the guest's null report, which classes each refused case is
expected to record after the fix, and that they still need a rebuilt
guest image and runner to be measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HemSoft

HemSoft commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T02:00:33.086740Z ac825e7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: ac825e7bdb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@HemSoft
HemSoft merged commit 3995f1d into main Oct 24, 2026
@HemSoft
HemSoft deleted the fix/issue-255-typed-guest-states branch October 24, 2026 02:02
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.

Report typed non-complete native guest states instead of invalid_output

1 participant