Skip to content

fix: initialize native Hermes chat instructions before delivery (AXI-112) - #58

Merged
Codename-11 merged 2 commits into
mainfrom
codex/axi-112-chat-stream-tdz
Jul 16, 2026
Merged

Codename-11 merged 2 commits into
mainfrom
codex/axi-112-chat-stream-tdz

Conversation

@Codename-11

Copy link
Copy Markdown
Owner

Fix

The authenticated v0.26.0 production smoke exposed a native Sessions-only temporal-dead-zone failure: the durable ConnectorDelivery transaction serialized systemPrompt before that block-scoped value was initialized later in the route.

This prepares the base/canvas-aware instructions before the atomic user-message/outbox transaction, then reuses them for provider history. /v1/runs remains unchanged.

Validation

  • 32 focused native chat/Hermes tests passed
  • typecheck passed
  • lint passed (pre-existing warnings only)
  • production live reproduction captured HTTP 500 and the exact bundled initialization error; re-smoke will gate patch release

Implements AXI-112.

@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: 20d50242d9

ℹ️ 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/app/api/chat/stream/route.ts Outdated
if (!canvasSummary) return `${baseSystemPrompt}\n\n${storyboardHint}`;
return `${baseSystemPrompt}\n\n${canvasSummary}\n\n${storyboardHint}`;
};
const systemPrompt = await buildSystemPrompt();

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 Skip prompt building for dispatch-only turns

When this request is for a dispatch-backed agent, the route returns at the useDispatch branch without ever using systemPrompt, but this new unconditional await buildSystemPrompt() still runs first. If the operator is chatting from a canvas, that calls loadCanvasContextSummary() (which reads the canvas nodes/shapes) before the user message is queued, so local/daemon dispatch chats now pay unnecessary canvas-summary work and can fail before dispatching even though the prompt is unused. Please gate this initialization to Hermes/server-streaming paths or move it after the dispatch early return.

Useful? React with 👍 / 👎.

@Codename-11

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 5f100f274f

ℹ️ 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".

@Codename-11
Codename-11 merged commit 33aa647 into main Jul 16, 2026
3 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