Skip to content

M11.6 candidate: chat turn quality gate#42

Merged
roackb2 merged 2 commits intomainfrom
codex/m116-chat-turn-quality-gate
May 3, 2026
Merged

M11.6 candidate: chat turn quality gate#42
roackb2 merged 2 commits intomainfrom
codex/m116-chat-turn-quality-gate

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented May 3, 2026

Summary of candidate implementation

  • keeps visibly called from
  • centralizes host normalization in so the host bridge owns approval normalization and callback fanout shape
  • moves pre-run durable session transitions into
  • moves final durable persistence transitions into
  • removes the thin forwarding layer

Old paths removed

  • deleted
  • removed from
  • removed ordinary-turn-owned preflight running-seed persistence wiring
  • removed ordinary-turn-owned prepared-session persistence step

New owners

  • : normalized event/approval/compaction host bridge behavior
  • : lease conflict handling, preflight compaction fanout, running-state seeding, prepared-session persistence
  • : final compaction fanout, final running-state seeding, final durable session save

Forbidden leftovers checked

  • removed
  • references removed
  • removed
  • remains directly visible in
  • checked with src/core/chat/session-turn-preflight.ts:73: persistPreflightCompactionRunningSeed({
    src/core/chat/session-turn-preflight.ts:84: return persistPreparedChatSessionTurn({
    src/core/chat/session-turn-preflight.ts:105:export function persistPreflightCompactionRunningSeed(args: {
    src/core/chat/session-turn-preflight.ts:128:export function persistPreparedChatSessionTurn(args: {
    src/tests/unit/core/chat-turn-runtime.test.ts:21: const root = mkdtempSync(join(tmpdir(), 'heddle-turn-session-'));
    src/tests/unit/core/chat-turn-runtime.test.ts:203: persistPreflightCompactionRunningSeed({
    src/tests/unit/core/chat-turn-runtime.test.ts:228: const preparedSession = persistPreparedChatSessionTurn({

Behavior tests added/updated

  • updated
  • updated
  • preserved passing persistence/session-submit coverage

Verification run

  • $ /Users/roackb2/Studio/projects/ProjectHeddle/heddle/node_modules/.bin/vitest run src/tests/unit/core/chat-turn-runtime.test.ts src/tests/unit/core/chat-turn-persistence.test.ts src/tests/integration/chat/chat-runtime.test.ts src/tests/integration/chat/session-submit.test.ts

�[1m�[46m RUN �[49m�[22m �[36mv4.1.2 �[39m�[90m/Users/roackb2/Studio/projects/ProjectHeddle/heddle�[39m

�[32m✓�[39m src/tests/integration/chat/session-submit.test.ts �[2m(�[22m�[2m1 test�[22m�[2m)�[22m�[32m 1�[2mms�[22m�[39m
�[32m✓�[39m src/tests/unit/core/chat-turn-persistence.test.ts �[2m(�[22m�[2m2 tests�[22m�[2m)�[22m�[32m 5�[2mms�[22m�[39m
�[32m✓�[39m src/tests/unit/core/chat-turn-runtime.test.ts �[2m(�[22m�[2m8 tests�[22m�[2m)�[22m�[32m 11�[2mms�[22m�[39m
�[32m✓�[39m src/tests/integration/chat/chat-runtime.test.ts �[2m(�[22m�[2m18 tests�[22m�[2m)�[22m�[32m 27�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m4 passed�[39m�[22m�[90m (4)�[39m
�[2m Tests �[22m �[1m�[32m29 passed�[39m�[22m�[90m (29)�[39m
�[2m Start at �[22m 12:52:26
�[2m Duration �[22m 406ms�[2m (transform 417ms, setup 0ms, import 752ms, tests 44ms, environment 0ms)�[22m

  • $ tsc -p tsconfig.build.json --noEmit
  • $ eslint . src/core/chat/ordinary-turn.ts src/core/chat/session-turn-preflight.ts src/core/chat/turn-context.ts src/core/chat/turn-host.ts src/core/chat/turn-persistence.ts src/core/chat/README.md src/tests/unit/core/chat-turn-runtime.test.ts src/tests/unit/core/chat-turn-persistence.test.ts src/tests/integration/chat/chat-runtime.test.ts src/tests/integration/chat/session-submit.test.ts

/Users/roackb2/Studio/projects/ProjectHeddle/heddle/src/core/chat/README.md
0:0 warning File ignored because no matching configuration was supplied

✖ 1 problem (0 errors, 1 warning)

Known risks

  • now both prepares and persists state; reviewer should confirm the contract is still the clearest one
  • still combines session loading, runtime resolution, and tool assembly, which may merit further review
  • legacy is still supported alongside host compaction ports for compatibility

Remaining review questions

  • should remain directly exported/tested or be collapsed further into behavior-level tests?
  • is still materially justified under the thin-wrapper rule?
  • is the current preflight return shape the right long-term contract?

This is a candidate implementation for review, not a milestone-complete claim.

Copy link
Copy Markdown

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

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: 84be5bf6e2

ℹ️ 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 src/core/chat/turn-host.ts Outdated
Comment on lines +41 to +43
const requestToolApproval = host?.approvals?.requestToolApproval;
const approveToolCall: RunAgentLoopOptions['approveToolCall'] | undefined = requestToolApproval ?
((call: ToolCall, tool: ToolDefinition) => requestToolApproval({ call, tool }) ?? Promise.resolve({ approved: false, reason: 'Missing approval port.' }))
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 approval handler receiver when normalizing host

The new approval bridge calls a detached requestToolApproval function, which drops the original receiver object. If a host provides approvals.requestToolApproval as a class/object method that reads this (for policy state, config, metrics, etc.), this call path can throw or silently misbehave and reject/skip approvals. The previous implementation invoked host.approvals.requestToolApproval(...) as a member call, so this is a regression in the approval flow for host integrations that rely on method binding.

Useful? React with 👍 / 👎.

@roackb2 roackb2 merged commit 34877d1 into main May 3, 2026
4 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