Skip to content

fix(reflection): reject unsuccessful embedded terminal results - #1011

Merged
rwmjhb merged 1 commit into
CortexReach:masterfrom
igs-rogenlo:fix/reflection-terminal-results
Nov 7, 2026
Merged

rwmjhb merged 1 commit into
CortexReach:masterfrom
igs-rogenlo:fix/reflection-terminal-results

Conversation

@igs-rogenlo

@igs-rogenlo igs-rogenlo commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An embedded reflection run can resolve normally while reporting a terminal failure in meta.error, meta.aborted, modelFallbackStopReason, or an isError payload. Reflection currently takes the first nonempty payload text, so a host timeout or error message can be returned as a successful reflection.

Reject those unsuccessful terminal results before extracting reflection text, then use the existing tool-free completion or diagnostic fallback. This keeps successful results and older hosts that omit optional metadata working. It does not change runner selection, retries, configuration, permissions, or the fallback implementations.

Validation

  • Focused reflection runner suite: 17/17 passed, including 8 new cases. On the unchanged source, 6 new failure-result cases fail and the other 11 pass.
  • Covers the current host terminal-timeout shape with aborted: false, structured errors, aborted results, timeout-only metadata, mixed partial/error payloads, legacy failures, legacy success without metadata, and normal false flags.
  • TypeScript build passed; only generated dist/index.js differs from the tracked output.
  • Fixtures use synthetic host results. No native Gateway/provider request or full test-suite run is claimed.

Compatibility

The current runEmbeddedAgent/legacy-name support from #995 remains unchanged. No minimum host version or schema change is introduced. This patch only addresses failed terminal-result interpretation; it does not claim full equivalence with other downstream reflection customizations.

Additional pinned-upstream retest — 2026-11-05

The official development branch remains c0e2c7a3a8b5780b6133ddfd9e2f426bf0ea1b6c. Carrying the regression fixture onto that source produces 6 failing regressions / 11 passing controls before this fix, and 17/17 passing tests with the fix. The tests load the real plugin implementation with synthetic host callbacks and the SDK test fixture; they are not Gateway or live-provider acceptance.

The published npm stable 1.0.32 does not contain this reflection-runner implementation. This is a fix for the development/beta reflection path, not a demonstrated defect in that stable release. Current deployment-specific native-adapter checks are separate and are not used to claim that production naturally exercised this PR's legacy path. No additional deployment or upstream merge is claimed.

@rwmjhb rwmjhb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR #1011 Review: fix(reflection): reject unsuccessful embedded terminal results

Verdict: APPROVE | 6 rounds completed | Value: 58% | Size: MEDIUM | Author: igs-rogenlo

Value Assessment

Problem: Embedded reflection runs can resolve with failure metadata and visible error or partial text, which the current code can accept as a successful reflection. This can store host error messages or incomplete output instead of useful reflection content.

Dimension Assessment
Value Score 58%
Value Verdict review
Issue Linked true
Project Aligned true
Duplicate false
AI Slop Score 0/6
User Impact medium
Urgency medium

Open Questions:

  • Does #995 have maintainer acknowledgment? The supplied linked record has no labels, assignment information, or maintainer comments establishing it.
  • Given the stale-base signal, has current main or another open PR already addressed terminal-result rejection?
  • Do supported host contracts confirm the failure metadata shapes used here, particularly the meaning of payload-level isError?

Summary

Embedded reflection runs can resolve with failure metadata and visible error or partial text, which the current code can accept as a successful reflection. This can store host error messages or incomplete output instead of useful reflection content.

Evaluation Signals

Signal Value
Blockers 0
Warnings 0
PR Size MEDIUM
Verdict Floor approve
Risk Level high
Value Model codex
Primary Model codex
Adversarial Model claude

Nice to Have

  • MR2: Thrown terminal-result errors may count toward the embedded runner's failure or circuit-breaker state
  • MR4: The diagnostic drops the failure kind

Recommended Action

Ready to merge.


Reviewed at 2026-10-26T14:13:34Z | 6 rounds | Value: codex | Primary: codex | Adversarial: claude

@rwmjhb
rwmjhb merged commit fadf2bc into CortexReach:master Nov 7, 2026
11 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.

2 participants