Repository navigation
#3863: port tickets get a token budget (tiktoken when it loads, else bytes/4) - #3919
Merged
Merged
Conversation
…bytes/4) An over-budget ticket trims facts.screen_bindings' field inventories to references to the generated screen classes that carry them, records what was trimmed and its sizes before/after, and says when it is still over budget; a ticket within budget is byte-identical. port_runner prints the prompt's tokens and logs a backend error instead of scoring it as a port attempt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code_bytes) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
…ickets open sources via on_disk (#3815) The ground-truth CI job has no tiktoken, so patching tiktoken.get_encoding failed at import. The tests now put a fake (offline) or no tiktoken in sys.modules. Port tickets open program and copybook sources through unicode_paths.on_disk, so an NFD-named file on Linux is found. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…odeQL unused-global) Co-Authored-By: Claude Opus 5.5 <[email protected]>
| import sys | ||
| import types | ||
| import math | ||
| from unittest.mock import patch |
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3863. The COACTVWC porting ticket was about 268 KB of prompt, and the Gemini porting agent returned nothing. 49 KB of the ticket JSON was
facts.screen_bindings, full BMS field inventories that the generated*Screenclasses already carry.Change
count_tokens(text) -> (bytes, tokens, how)uses tiktoken'so200k_basewhen it loads.trim_ticket(ticket, budget)and--ticket-budget(default 64,000 tokens; 0 turns it off):screen_bindingsfact's field inventory replaced by a reference to the generated screen class, with its field count. The class name follows the screen forge's naming, unless a name clash renamed it.trimmed(bytes and tokens before and after) and its sectionsizes.over_budget. The porting rules are never trimmed.port_runner:decode_bytes.This addresses item 1 of the proposal. Item 2, referencing facts the generated code already carries across more sections, is follow-up work.
Tests
tests/cobol_mainframe/test_port_ticket_budget.py:get_encodingraises;pr_gates.py: 7/7 pass.🤖 Generated with Claude Code