Skip to content

Add explicit cost-aware expansion and global scaling - #2

Open
KataDavidXD wants to merge 2 commits into
mainfrom
codex/ragspace-cost-aware-v2
Open

KataDavidXD wants to merge 2 commits into
mainfrom
codex/ragspace-cost-aware-v2

Conversation

@KataDavidXD

Copy link
Copy Markdown
Owner

Summary

  • expose independent cost-aware selection and expansion switches, constant or inverse-square-root beta schedules, and one frozen global cost scale
  • cost-tilt the historical uniform expansion proposal while preserving beta-zero, equal-cost, and opt-out RNG behavior
  • persist candidate-level expansion and selection audits without changing raw reward, Q backup, visits, or best-state ranking
  • label rollout as intentionally cost-blind pending a separate ablation
  • bump the package to 0.2.0 and document the compatibility contract

This PR also includes the existing observable-transition and search-signal prerequisite commit that was not yet on main.

Validation

  • 73 standard-library unit tests passed
  • Ruff passed on every changed Python file
  • README mirror and repository-hygiene tests passed

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 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-08-30T04:48:28.234438Z 110919d PR opened
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 110919dc2d

ℹ️ 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 uct_engine/search.py
Comment on lines +403 to +405
transition = transition_model.transition(current, action, context)
if not isinstance(transition, TransitionResult):
raise TypeError("transition_model must return TransitionResult")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve completed effects when a later transition fails

When an environment-backed rollout has multiple actions and a later transition() raises, this helper unwinds before returning the effects already collected for earlier successful transitions. The caller's recovery block only surrounds the subsequent evaluator call, so costs and materialized keys from the expansion and completed rollout steps are neither merged into the context nor checkpointed, corrupting recovery accounting for partially executed trajectories.

Useful? React with 👍 / 👎.

Comment thread uct_engine/search.py
Comment on lines 740 to 742
reward = float(result.reward)
evaluation_cost = float(result.total_cost)
terminal_evaluation_cost = float(result.total_cost)
if not math.isfinite(reward):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain transition effects when evaluator output is invalid

When transitions have already realized effects but the evaluator returns a malformed reward or cost (for example NaN, a negative cost, or a value that cannot be converted to float), these conversions and validations raise outside the evaluator recovery block. Consequently the known transition cost and reuse keys are discarded and no recovery checkpoint is emitted, unlike when evaluate() raises directly; result conversion and validation should use the same failure-accounting path.

Useful? React with 👍 / 👎.

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.

1 participant