Skip to content

Update NEW branch#298

Merged
jkool702 merged 3 commits into
NEWfrom
main
May 26, 2026
Merged

Update NEW branch#298
jkool702 merged 3 commits into
NEWfrom
main

Conversation

@jkool702

@jkool702 jkool702 commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Refine batch size protocol documentation and correct forkrun architecture and flag handling.

Bug Fixes:

  • Fix architecture normalization for x86_64_vN variants in forkrun scripts.
  • Correct the supported architecture case label from ppcle64 to ppc64le in forkrun scripts.
  • Fix the documented environment variable name for passing extra functions into frun.

Enhancements:

  • Clarify the signed batch size protocol semantics, hysteresis behavior, and tail handling in the invariants documentation.

Documentation:

  • Update invariants documentation to better explain speculative vs steady-state batch size modes and tail behavior.
  • Correct the FLAGS documentation to reference the FORKRUN_EXTRA_FUNCS environment variable.

jkool702 and others added 3 commits May 22, 2026 13:19
HOTFIX: update documentation and fix edge case error in arch determination
@sourcery-ai

sourcery-ai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refines the documentation for the signed batch size and tail-handling protocols, fixes architecture normalization and supported-arch matching in frun scripts, and corrects an environment variable name in the flags documentation.

File-Level Changes

Change Details Files
Clarify signed batch size protocol semantics, hysteresis behavior, and worker/ scanner responsibilities including tail handling.
  • Reframes negative batch sizes as catch-up/speculative mode and positive as steady-state/fast-path mode with explicit geometric growth threshold.
  • Specifies scanner rules for when to publish negative versus positive values to introduce hysteresis and avoid PID jitter exposure to workers.
  • Updates worker rules to distinguish fast-path single-slot claims from slow-path speculative multi-slot claims and clarifies CAS-based finalization semantics.
  • Tightens forbidden transitions and correctness guarantees, emphasizing that workers never change magnitudes or initiate positive-to-negative transitions.
  • Refines tail rules so the scanner forces positive batch size at EOF and workers short-circuit speculative logic at or beyond tail_idx.
DOCS/INVARIANTS.md
Adjust architecture string normalization and supported architectures list in frun’s architecture detection logic.
  • Reverse the underscore/hyphen conversion so x86_64 variant names are normalized by replacing '-v' with '_v'.
  • Update the supported non-x86 architectures list to replace the deprecated/incorrect entries with the correct 'ppc64le' and drop 'armv7' from the case pattern.
frun.bash
ring_loadables/frun.nob64.bash
Fix environment variable name in flags documentation for passing extra helper functions into frun.
  • Corrects the example to use FORKRUN_EXTRA_FUNCS instead of the incorrect FORKRUN_REQ_FUNCS in the usage description.
DOCS/FLAGS.md
ring_loadables/frun.nob64.bash.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue, and left some high level feedback:

  • The change from ARCH="${ARCH0//_v/-v}" to ARCH="${ARCH0//-v/_v}" in _forkrun_get_arch flips the normalization direction for x86_64[-_]v[2-4]; double-check this matches the actual ARCH0 formats produced elsewhere so we don’t end up emitting mixed -v/_v variants.
  • Dropping armv7 from the case branch and correcting ppcle64ppc64le changes how armv7 is handled (it now falls through to the default); if that’s intentional, consider adding a brief comment or a separate branch so it’s clear we no longer treat armv7 like the other listed arches.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The change from `ARCH="${ARCH0//_v/-v}"` to `ARCH="${ARCH0//-v/_v}"` in `_forkrun_get_arch` flips the normalization direction for `x86_64[-_]v[2-4]`; double-check this matches the actual `ARCH0` formats produced elsewhere so we don’t end up emitting mixed `-v`/`_v` variants.
- Dropping `armv7` from the `case` branch and correcting `ppcle64``ppc64le` changes how `armv7` is handled (it now falls through to the default); if that’s intentional, consider adding a brief comment or a separate branch so it’s clear we no longer treat `armv7` like the other listed arches.

## Individual Comments

### Comment 1
<location path="frun.bash" line_range="1207" />
<code_context>
             ARCH='x86_64_v2'
         fi
         ;;
-    aarch64|armv7|riscv64|s390x|ppcle64)
+    aarch64|riscv64|s390x|ppc64le)
         ARCH="$ARCH0"
         ;;
</code_context>
<issue_to_address>
**question (bug_risk):** Dropping `armv7` from the handled architectures changes behavior on 32-bit ARM; confirm this is intentional and reflected elsewhere.

`armv7` previously mapped to `ARCH="$ARCH0"` but will now hit the default case in `_forkrun_get_arch`, which may change behavior or cause errors on 32‑bit ARM. If `armv7` is now unsupported, please make that explicit in user-facing errors or selection logic. If it should still be supported, consider keeping it in this case pattern or adding a dedicated branch.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread frun.bash
@sonarqubecloud

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request corrects documentation regarding forkrun flags and updates the signed batch size protocol invariants to include hysteresis and fast-path routing. It also fixes architecture string replacements and supported architectures in the bash scripts. The reviewer points out that maintaining identical duplicate scripts across multiple files (frun.bash, frun.nob64.bash, and frun.nob64.bash.txt) increases maintenance overhead and suggests using symlinks or a build step to keep them synchronized.

case "$ARCH0" in
x86_64[-_]v[2-4])
ARCH="${ARCH0//_v/-v}"
ARCH="${ARCH0//-v/_v}"

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.

medium

The changes in this file are identical to those in frun.bash and ring_loadables/frun.nob64.bash.txt. Maintaining multiple duplicate copies of the same script increases maintenance overhead and the risk of files drifting out of sync. It would be highly beneficial to use symlinks, source a shared script, or use a build/generation step to keep these files synchronized automatically.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ring_loadables/frun.nob64.bash.txt is a copy of frun.bash with the base64 embeddings removed. it is generated using ring_loadables/remove_frun_base64.bash. its purpose is to allow for easier AI review of frun.bash without wasting 100's of thousands of tokens on meaningless embedded base64 strings

@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: ee72a7fea3

ℹ️ 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 DOCS/INVARIANTS.md
* May update batch size at any time.
* Must **always** publish negative values (`-abs(N)`).
* Must never publish a positive batch size.
* Must publish a **negative** value (`-N`) ONLY if the new target is at least double the absolute value of the current batch size (`N >= 2 * current`).

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 Match 2x hysteresis boundary to runtime behavior

Update the invariant to use a strict > 2x threshold instead of >= 2x. The runtime publisher in ring_loadables/forkrun_ring.c (PUBLISH_BATCH_SIZE) emits a negative size only when new_L > abs(current)*2, so an exact 2x increase stays on the positive fast path. Documenting >= here will cause incorrect operator expectations and invalid invariant checks around boundary-sized ramps.

Useful? React with 👍 / 👎.

Comment thread DOCS/INVARIANTS.md
* If CAS fails (scanner changed policy), re-evaluate under new policy.
* Observe the published batch size.
* If positive (`> 0`): Bypass all speculative arithmetic and claim exactly 1 ring slot.
* If negative (`< 0`): Enter the speculative slow path to calculate how many older slots satisfy the new magnitude.

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 Remove unsupported speculative-claim statement

This line states that negative batch sizes make workers compute multi-slot speculative claims, but the current worker claim path in ring_loadables/forkrun_ring.c initializes claim_count = 1 and does not derive multi-claim count from sbatch < 0. Keeping this statement in the invariants will mislead debugging/tuning and future changes that rely on documented worker behavior.

Useful? React with 👍 / 👎.

@jkool702 jkool702 merged commit 45e52db into NEW May 26, 2026
6 of 7 checks passed
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