Skip to content

feat: Fairly trim skill descriptions within context budget#18925

Merged
xl-openai merged 4 commits into
mainfrom
xl/skills
Apr 22, 2026
Merged

feat: Fairly trim skill descriptions within context budget#18925
xl-openai merged 4 commits into
mainfrom
xl/skills

Conversation

@xl-openai

Copy link
Copy Markdown
Collaborator

Preserve skill name/path entries whenever possible and trim descriptions first, using round-robin character allocation so short descriptions do not waste budget.

@xl-openai xl-openai requested a review from sayan-oai April 22, 2026 01:40
@xl-openai xl-openai requested a review from a team as a code owner April 22, 2026 01:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a86ce85764

ℹ️ 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".

Comment thread codex-rs/core-skills/src/render.rs
Comment thread codex-rs/core-skills/src/render.rs
@xl-openai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6dbdba21e2

ℹ️ 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".

Comment thread codex-rs/core-skills/src/render.rs Outdated
Comment on lines +114 to +115
} else if report.truncated_description_chars
> SKILL_DESCRIPTION_TRUNCATION_WARNING_THRESHOLD_CHARS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate truncation warning on per-skill loss

The warning threshold checks total truncated chars (truncated_description_chars > 10) while the message reports an average. With many skills, tiny 1-char trims per skill still trigger a warning, creating noisy false alarms and overstating severity. Compare the threshold to average_truncated_description_chars() instead.

Useful? React with 👍 / 👎.

Comment on lines 182 to +183
THREAD_SKILLS_TRUNCATED_METRIC,
if truncated { 1 } else { 0 },
if omitted_count > 0 { 1 } else { 0 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count description-only trims in truncation metric

A truncation warning can now be emitted when only descriptions are shortened, but THREAD_SKILLS_TRUNCATED_METRIC is recorded as 0 unless skills are omitted. This makes telemetry contradict user-visible behavior and can hide real truncation events from existing monitoring built on the truncated metric.

Useful? React with 👍 / 👎.

Comment thread codex-rs/core-skills/src/render.rs Outdated
Comment on lines +429 to +430
let next_cost = line_cost(budget, &line.render_with_description_chars(next_chars))
.saturating_sub(line.minimum_cost(budget));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid per-character full re-rendering in allocation loop

render_lines_with_description_budget recomputes render_with_description_chars and minimum_cost for every character step of every skill. With long descriptions or many skills, this turns budgeting into a very expensive hot path during thread start and can noticeably increase latency.

Useful? React with 👍 / 👎.

@xl-openai xl-openai merged commit b77791c into main Apr 22, 2026
25 checks passed
@xl-openai xl-openai deleted the xl/skills branch April 22, 2026 19:33
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants