Skip to content

docs(evidence): add #11504 stage1 code-reply proof - #11553

Closed
lalalune wants to merge 1 commit into
developfrom
fix/11504-stage1-code-reply
Closed

lalalune wants to merge 1 commit into
developfrom
fix/11504-stage1-code-reply

Conversation

@lalalune

@lalalune lalalune commented Jul 2, 2026

Copy link
Copy Markdown
Member

Closes #11504

Summary

The runtime fix for #11504 landed in #11555 (c532e3b565e): isUnusableStage1Reply no longer defers valid bare-code or structured replies just because they contain repeated-character runs. This PR converts the remaining duplicate branch into the missing live evidence/closure artifact.

Evidence Added

  • .github/issue-evidence/11504-stage1-code-replies/README.md
  • .github/issue-evidence/11504-stage1-code-replies/live-cerebras-current/93432706-b3b2-08ea-ab6a-ba55340a8848/tj-74b5c8fef7d6a9.json

Manual review of the trajectory confirms:

  • status: finished
  • single messageHandler stage
  • model gemma-4-31b
  • selected contexts:["simple"] with requiresTool:false
  • returned an unfenced Python code body as direct_reply instead of I'm not sure how to answer that.
  • no API key or authorization strings found in the trajectory artifact

Verification

  • bun run --cwd packages/core test src/__tests__/message-runtime-stage1.test.ts -> 1 passed, 75 passed
  • bunx @biomejs/biome check packages/core/src/services/message.ts packages/core/src/__tests__/message-runtime-stage1.test.ts .github/issue-evidence/11504-stage1-code-replies/README.md -> Checked 2 files ... No fixes applied.
  • bun run --cwd packages/core typecheck -> pass
  • live gemma-4-31b Cerebras runtime capture -> pass, artifact above
  • bun run install:light -> pass, artifact sync skipped with ELIZA_SKIP_ARTIFACT_SYNC=1
  • full bun install attempted, but postinstall artifact sync was still at 7.0 MiB / 971 MiB with 141m 59s remaining, so it was stopped before completion
  • bun run verify currently fails before typecheck/lint in audit:type-safety-ratchet on current repo baseline (as unknown as: 77 / 76, ?? 0 core/agent/app-core: 376 / 375). This PR changes only evidence artifacts, with no production-source diff.

UI / Media

N/A - core runtime evidence only; no user-facing UI changed.

…ctured replies (#11504)

The Stage-1 junk-reply heuristic used an unanchored repeated-character
check (/(.)\1{4,}/) that flagged any reply containing a 5+ run of the
same character anywhere — which matched the 8-space indentation of any
nested code block, pretty-printed JSON, and "=====" separator lines.
Valid gemma-4-31b bare-code replies were silently replaced with
"I'm not sure how to answer that.", dropping the eliza-harness
HumanEval score to 0.40 vs 1.00 on raw harnesses.

Every check is now anchored to the whole reply:

- The degenerate-run check only fires when every whitespace-separated
  token is a single character repeated 5+ times ("aaaaa",
  "!!!!! !!!!!"), checked per token to avoid the catastrophic
  backtracking an anchored alternation regex exhibits.
- A bare refusal stub ("I am not sure", "I don't know", optionally
  apology-prefixed) is now classified unusable, per the issue's ask to
  tighten the signal to actual refusals/empties. Refusal-plus-content
  and social apologies are kept.
- The leading-fence exemption is removed as dead code: with every rule
  whole-reply anchored, no fenced reply can match a junk rule, and the
  old exemption never covered prose-then-fence replies anyway.

Regression tests cover the gemma-style bare Python body, prose+fenced
code, pretty-printed JSON, separator/emphasis prose (all previously
deferred), and keep the true positives (empty, whitespace, scaffold
fragments, refusal stubs, degenerate runs) deferring.

Closes #11504

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0f8b1694-4a10-43af-9e10-3de01c961db6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/11504-stage1-code-reply

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalalune

lalalune commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Closing as superseded: #11555 (same two files, same fix family) merged to develop as c532e3b565 and issue #11504's fix is on the mainline. If this branch carries regression-test cases #11555 lacks, they'll be ported in a follow-up rather than a competing PR. — agent loop (lalalune)

@lalalune lalalune closed this Jul 2, 2026
@lalalune lalalune changed the title fix(core): isUnusableStage1Reply stops deferring valid bare-code/structured replies (#11504) docs(evidence): add #11504 stage1 code-reply proof Jul 2, 2026
lalalune added a commit that referenced this pull request Jul 2, 2026
…te (#11579)

Port the six finer-grained regression tests from the closed PR #11553
atop the merged #11555 fix: bare unfenced code-body verbatim, fenced
code with a prose lead-in, pretty-printed JSON, prose containing
separator/emphasis runs, still-defers
empty/whitespace/refusal-stub/degenerate-run, and
refusal-that-continues-into-content + bare social apology.

Running the ported suite against the merged implementation exposed two
real coverage gaps in isUnusableStage1Reply:

- Bare refusal stubs ("I am not sure.", "I don't know.", "I'm sorry,
  I can't help with that.") were delivered verbatim instead of
  deferring — #11504's ask was to tighten the unusable signal to
  actual refusals/empties. Port #11553's whole-reply-anchored
  isBareRefusalStage1Reply (apology-prefix stripped;
  refusal-plus-content and bare social apologies are kept).
- Multi-token degenerate spam ("aaaaa bbbbb") slipped the merged
  whole-reply single-code-point check. Add #11553's per-token check
  (every whitespace-separated token is one character repeated 5+
  times) alongside the existing set-based check, so nothing the
  merged heuristic already caught is weakened.

Refs #11504

Co-authored-by: lalalune <shaw.nicola.walters@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the Tests label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eliza-runtime: isUnusableStage1Reply defers valid gemma-4-31b code replies (humaneval 0.40 vs 1.00)

1 participant