Skip to content

test(perf): distinguish Codex tool context and token accounting - #2416

Merged
N0zoM1z0 merged 4 commits into
mainfrom
feat/model-context-receipts-20261012
Oct 13, 2026
Merged

N0zoM1z0 merged 4 commits into
mainfrom
feat/model-context-receipts-20261012

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Raw MCP reply bytes and public MCP call counts do not describe actual client discovery, projection and model rounds. Add optional --capture-tool-context to retain owned client tool items and per-response usage. Add separate optional --guide-enabled-tools to supply exact selected function names for narrowly scoped discovery experiments. Existing trials stay ephemeral and their default instructions remain unchanged; REA public APIs/providers/defaults do not change.

Capture filters owned rollouts to tool calls/replies and numeric usage, preserving original IDs/caller values/digests. It excludes account/session metadata, world state, messages, encrypted reasoning, internal passthrough, auth/config and ambient environment. Missing/malformed/symlink records are unavailable/partial, explicit null context-window values remain unknown, and capture failure cannot bypass profile/credential cleanup. Validate guidance prerequisites before acquiring a profile and close the public-event reader explicitly.

Real findings are qualified rather than converted from bytes to tokens:

  • A committed control/candidate capture pair uses the unchanged ShareX question and two original MCP operations. Both pass selected facts, but candidate input remains higher (56,655 versus 52,656). The control prints about 2 KB after client projection, the candidate about 23 KB; both discover broad truncated metadata. The requested direct label does not establish absence of an executor.
  • Four same-runtime guidance trials use unguided/guided/guided/unguided order, requested gpt-5.6-terra high, identical artifact/question/two selected tools/providers/capture mode. Both guided metadata outputs are 12,336 bytes without truncation versus 41,709 truncated bytes. All trials preserve source bytes, remove profiles and make two successful dependent MCP calls.
  • Guided input/uncached input is lower in both observations and time is shorter. The first unguided answer omits classification.container and is not equivalent completed work. The second comparison has two selected-factually acceptable answers after explicitly verifying two accurate extra returned-row counts: input 103,301 → 58,336 (~43.5%), uncached 30,597 → 20,192 (~34.0%), time 60.336 → 50.685 seconds (~16.0%). This is a small one-application signal; no general default recommendation.
  • The grader validates only known additional native counts against source arrays and integer types. Unknown extra claims, wrong counts, conflicting scopes, boolean/string counts and omitted original coverage still fail. Original failed receipts are retained. All full selected gates still fail unknown final physical resource counters, separately from factual checks.

Validation:

  • Six focused Python tests pass through the existing CI Python gate: filtering/caller-data preservation, partial/missing records, foreign symlinks, capture-failure cleanup, guidance prerequisites before acquisition and strict additional-count semantics. Simulated CLI tests establish cleanup behavior only.
  • Complete Python gate, full supported single-thread typecheck, dependency check and unchanged lint pass locally under the resource safeguards. Normal pre-commit and command-scoped checked pre-push run without changing repository hooks. Remote exact-head CI and final manual review remain before merge.
  • Real Codex capture cohorts are recorded with immutable source/runtime hashes, usage, retries/failed representations and cleanup. A fresh actual NewPipe/JADX SDK workflow and two real Codex Android trials pass selected facts. Guided total input is lower (99,913 → 89,220), but uncached input is higher (19,273 → 26,756) and time is longer (66.797 → 76.936 seconds). This counterexample prevents a general guidance/default recommendation.

Starts from merged main 82cfcee19f18b0eeae9a330ba04e0411cdf85225 in a new isolated worktree; guidance cohort checkpoint e20bd0e2a905f06bc8c56fe04b0e61f3da88636a, current review head 42f02c6f8d6c50265396a2ea99857329c3518d37. Curated findings: experiments/analysis-efficiency/model-context.md. Raw data/profiles/runtimes stay private. One CPU, unchanged 3 GiB early-stop/4 GiB hard memory, no swap and bounded tasks apply; no guard abort is observed, final counters remain unknown.

Continues #2016. Keep draft until available live checks, exact-head CI and manual review complete. No release publication/deployment or plugin SDK.

Historical CI attribution: the old head's Linux shard 4 and Windows lane reproduced the same three Ghidra ELF64 fixture failures on independent main c462; original logs remain in the requested /tmp handoff. Another PR independently repaired those fixtures in main 37b7550ecc916acc8619fa72e5c05af45702733f. This PR is rebased onto that main without changing any of its seven own files (byte-identical comparison verified). Its six Python tests and full checked pre-push pass again. New exact-head CI is running; no historical failure is relabeled as a pass. Measured old runtime/source commits remain pinned and are not relabeled after rebase.

@N0zoM1z0
N0zoM1z0 marked this pull request as ready for review October 13, 2026 00:33
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

N0zoM1z0 and others added 4 commits October 13, 2026 00:47
Keep default trials ephemeral and exclude account, authentication and ambient state. Capture failure still removes the temporary profile.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Record the committed capture pair and preserve its negative token result. Validate guidance prerequisites before profile acquisition.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Validate only known additional source row counts, keep incomplete answers and unknown final resource counters explicit, and preserve null context-window observations.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Both answers match actual JADX facts; guided total input is lower while uncached input and wall time increase. Keep guidance optional.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@N0zoM1z0
N0zoM1z0 force-pushed the feat/model-context-receipts-20261012 branch from 3719ecd to 42f02c6 Compare October 13, 2026 00:51
@N0zoM1z0
N0zoM1z0 merged commit ee87111 into main Oct 13, 2026
39 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/model-context-receipts-20261012 branch October 13, 2026 01:01
@morluto morluto added area: tests Test suite and verification area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants