Skip to content

Add host-owned prompt composition - #399

Merged
roackb2 merged 2 commits into
mainfrom
codex/host-owned-prompt-composition
Sep 14, 2026
Merged

roackb2 merged 2 commits into
mainfrom
codex/host-owned-prompt-composition

Conversation

@roackb2

@roackb2 roackb2 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary\n\n- add public AgentPromptComposition with explicit heddle-owned and host-owned modes\n- preserve the existing Heddle coding and heartbeat prompts when the option is omitted\n- pass an exact non-blank host system prompt and unchanged durable heartbeat task in host-owned mode\n- keep prompt ownership local and exclude it from the remote heartbeat execution request\n- document the Runtime and heartbeat ownership boundaries\n\n## Behavior\n\nHost-owned mode omits Heddle's coding persona, activated Agent Skill catalog, heartbeat goal/checklist/run-context wrapper, shell examples, memory catalog/instructions, and required HEARTBEAT_DECISION instruction.\n\nTool authority, approvals, model/tool lifecycle, events, checkpointing, traces, memory receipts, and HeartbeatDecisionPolicy remain unchanged. A successful heartbeat response without a decision line still resolves to pause.\n\n## Verification\n\n- yarn lint\n- yarn typecheck\n- yarn runtime:build\n- yarn vitest run src/tests/integration/core/agent-loop.test.ts (35 tests)\n- yarn vitest run src/tests/integration/core/heartbeat-execution-context.test.ts (13 tests)\n- full unit suite: 150 files, 978 tests\n- integration suite excluding the machine-global Agent Skill fixture: 48 files, 445 tests\n- packed @heddleagent/runtime@9.0.0 candidate: isolated install, runtime import, and TypeScript consumer passed with 0 vulnerabilities\n\nThe complete local integration command still has one unrelated failure because /Users/roackb2/.agents/skills/orchestration/SKILL.md exceeds Heddle's 1024-character description limit. Clean CI remains authoritative for that fixture.\n\nNo merge, tag, release, npm publication, deployment, or product behavior is claimed.\n\nCloses #398

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T02:02:04.784200Z 9552821 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 9552821deb

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

goal: options.goal,
toolNames,
systemContext: options.systemContext,
promptComposition: options.promptComposition,

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 Suppress Heddle reminders in host-owned runs

When host-owned mode uses the default tools and the model calls any non-memory tool, AgentMemoryCheckpointTracker marks a checkpoint as required and AgentToolTurnService.pushHostRequirementReminders injects a Heddle-authored role: 'system' memory instruction before the next model turn. Because prompt ownership is passed only into buildInitialMessages here and is not retained in AgentRunContext, later prompt injection cannot honor host-owned mode, violating the complete/exact host-charter contract and the documented omission of memory instructions. Carry prompt ownership into the run context and gate Heddle-authored reminders.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in def73fa. Prompt composition is now retained in the run context, and Heddle-authored memory reminders are suppressed in host-owned mode. A two-turn regression asserts that the host charter remains the only system message after a non-memory tool call.

content: buildSystemPrompt(
args.toolNames,
args.systemContext,
args.promptComposition,

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 Strip restored system messages in host-owned mode

When a host-owned run receives history or resumes a checkpoint containing a role: 'system' entry—for example, a memory-checkpoint reminder retained in a previous transcript—the new host prompt is prepended here while AgentHistorySanitizer preserves the older system message. The first model call therefore receives both the host charter and a prior Heddle-authored instruction, so switching an existing heartbeat task to host-owned mode does not provide the promised exact, complete system prompt. Filter restored system messages when composition is host-owned.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in def73fa. One centralized prompt-composition policy now removes every older system message and reasserts the current host prompt once for both restored history and model-context recovery. Dedicated regressions cover both paths.

@roackb2
roackb2 merged commit b051480 into main Sep 14, 2026
6 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