Skip to content

[refactor] Centralize Agenta platform instructions - #6365

Open
mmabrouk wants to merge 3 commits into
release/v0.114.4from
docs/agent-platform-instructions
Open

[refactor] Centralize Agenta platform instructions#6365
mmabrouk wants to merge 3 commits into
release/v0.114.4from
docs/agent-platform-instructions

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Aug 29, 2026

Copy link
Copy Markdown
Member

Context

Agenta's SDK kept gateway guidance separate from author instructions, but its prompt text lived beside bundled skills and each adapter carried a delivery-choice wrapper. The SDK now gives every supported agent a short shared Agenta base from one module.

Changes

platform_instructions.py composes the base and existing gateway guidance. The SDK sends one platformInstructions string instead of {text, carrier}. The runner chooses its existing Pi append-system or Claude/Codex instruction-file path. Author instruction fields remain unchanged on the wire.

This removes the SDK carrier helper and wrapper types. Generated guidance keeps the existing warm-session behavior. No instruction digests, database migrations, restart rules, Pi patches, or Codex developer-instruction changes.

Deploy the runner before the SDK. The runner accepts the old gatewayGuidance input during rollout and prefers the new field when both appear.

Tests

  • Independent correctness and maintainability reviews: no blocking findings.
  • Runner: 2,617 unit tests passed; TypeScript checks passed.
  • SDK agents: 1,194 passed, 4 skipped; focused adapter/wire checks: 110 passed. The subsequent locked SDK CI suite also passed.
  • Ruff and Prettier checks completed. Documentation production build passed.
  • CI passed SDK, API, services, web, runner unit, runner integration, and runner acceptance suites on current head ecb28ea14b. Format/lint, Helm, security, and documentation checks also passed. The two web image builds remain in progress.
  • Pi live QA passed fresh instructions, unchanged continuation, edited instructions, and a fresh control. Logs confirmed warm reuse. Claude/Codex/gateway live QA remains unverified because test credentials were unavailable; copying provider keys into a QA vault requires explicit approval. No provider keys were copied. QA containers were removed and workflows archived.
  • The full Pi/Claude/Codex × local/Daytona live matrix is not complete. Dedicated preview QA connections are available on their own deployments, but using them for this change requires an approved preview deployment. Local subscription QA does not cover Daytona.

How to review

Start with platform_instructions.py, then the SDK adapters/wire model, then the small runner change in run-plan.ts. The design docs describe the reduced scope and rollout order.

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 4, 2026 8:09pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 30fb82c9-4fd9-42eb-a79d-763eae62c1a6

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 293e603b-0678-4343-ab79-cfaab759ae4a

📥 Commits

Reviewing files that changed from the base of the PR and between cff860e and ecb28ea.

📒 Files selected for processing (2)
  • docs/design/agent-platform-instructions/plan.md
  • docs/design/agent-platform-instructions/status.md

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added shared platform instructions for supported coding-agent harnesses.
    • Platform guidance combines Agenta instructions with connected-integration guidance while remaining separate from author prompts.
    • Instructions use each harness’s appropriate prompt surface without disrupting reusable warm sessions.
    • Legacy guidance remains supported during the transition, with platform instructions taking precedence.
  • Documentation

    • Added design, context, research, implementation plan, status, and protocol documentation for the unified instruction flow.

Walkthrough

The SDK now composes shared Agenta platform instructions as a scalar platformInstructions field. The runner delivers this text through existing Pi, Claude, and Codex paths, preserves legacy fallback behavior, and excludes the text from warm-session identity.

Changes

Agent platform instruction rollout

Layer / File(s) Summary
Design and protocol contract
docs/design/agent-platform-instructions/*, docs/design/agent-workflows/documentation/protocol.md
Documents instruction ownership, harness delivery, rollout compatibility, lifecycle behavior, implementation status, and verification scope.
SDK composition and wire model
sdks/python/agenta/sdk/agents/platform_instructions.py, sdks/python/agenta/sdk/agents/adapters/*, sdks/python/agenta/sdk/agents/dtos.py, sdks/python/agenta/sdk/agents/wire_models.py, sdks/python/agenta/sdk/agents/utils/wire.py
Adds shared platform text, removes the carrier-based gateway guidance DTO, and serializes platformInstructions.
Runner delivery and compatibility
services/runner/src/protocol.ts, services/runner/src/engines/sandbox_agent/run-plan.ts, services/runner/src/engines/sandbox_agent/session-identity.ts, services/runner/src/lifecycle/desired-state.ts
Routes platform instructions to harness-specific instruction paths, prefers the new field over legacy guidance, and keeps the text outside warm-session identity and lifecycle facets.
Contract and behavior validation
sdks/python/oss/tests/pytest/unit/agents/*, services/runner/tests/unit/*
Updates fixtures and tests for composition, wire contracts, harness delivery, legacy compatibility, precedence, and fingerprint stability.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🔵 Low · up to ecb28

This change centralizes platform instructions while retaining existing harness delivery and warm-session behavior. Normal requests are covered, but malformed instruction payloads may fail unexpectedly and the protocol documentation may misdirect implementers, so these bounded issues should be addressed or accepted before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 68.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 18 files. (2 skipped: 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: centralizing Agenta platform instructions.
Description check ✅ Passed The description directly explains the platformInstructions change, runner behavior, rollout compatibility, scope, and validation results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/agent-platform-instructions

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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: Please review three decisions before implementation: (1) SDK-owned platformInstructions stays separate from author fields, (2) changed prompt inputs rebuild every harness and an effective direct-instruction digest guards native continuity, and (3) Codex keeps late runner facts in a fenced AGENTS.md overlay because daemon config freezes before Daytona mounts. Implementation starts with executable Pi precedence and Codex developer-instruction spikes.

@mmabrouk mmabrouk added deisgn documentation Improvements or additions to documentation labels Aug 29, 2026
@mmabrouk
mmabrouk changed the base branch from main to release/v0.114.4 August 31, 2026 16:03
@mmabrouk
mmabrouk marked this pull request as ready for review September 3, 2026 11:06
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📘 Docs preview

Status ✅ Ready
Preview https://pr-6365-agenta-docs-preview.mahmoud-637.workers.dev/docs
Inspect Actions run
Commit ecb28ea14b3664f64da010948b8bf621db0fa0b9

This comment updates in place on every push.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 25602467-50b0-450b-8728-f413bb140202

📥 Commits

Reviewing files that changed from the base of the PR and between 5d3b7cc and 60d527f.

📒 Files selected for processing (5)
  • docs/design/agent-platform-instructions/README.md
  • docs/design/agent-platform-instructions/context.md
  • docs/design/agent-platform-instructions/plan.md
  • docs/design/agent-platform-instructions/research.md
  • docs/design/agent-platform-instructions/status.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment on lines +33 to +34
- Exposure: an opaque transport field in the exported `run_request` schema and
`/inspect`, but not an author-configurable or persisted agent field.

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 4924


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- plan excerpt ---'
sed -n '1,210p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- implementation-slice excerpt ---'
sed -n '245,285p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- inspect/platformInstructions references ---'
rg -n -S -C 3 '/inspect|platformInstructions|run_request|developer_instructions|AGENTS\.md' --glob '!**/node_modules/**' --glob '!**/dist/**' .

Repository: Agenta-AI/agenta

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- cited contract sections ---'
sed -n '1,95p' docs/design/agent-platform-instructions/plan.md
sed -n '160,195p' docs/design/agent-platform-instructions/plan.md
sed -n '255,280p' docs/design/agent-platform-instructions/plan.md
sed -n '315,340p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- current non-archive references ---'
rg -n -S -C 2 'platformInstructions|/inspect|run_request|developer_instructions' \
  --glob '!**/archive/**' \
  --glob '!**/node_modules/**' \
  --glob '!**/dist/**' \
  --glob '!docs/design/agent-platform-instructions/plan.md' \
  .
printf '%s\n' '--- likely inspect/schema files ---'
git ls-files | rg -i '(^|/)(inspect|schema|schemas|dto|mapper)([^/]*\.(py|ts|tsx|js|json))?$|agent.*(schema|inspect)|workflow.*schema'

Repository: Agenta-AI/agenta

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- plan lines 1-95 ---'
nl -ba docs/design/agent-platform-instructions/plan.md | sed -n '1,95p'
printf '%s\n' '--- plan lines 160-195 ---'
nl -ba docs/design/agent-platform-instructions/plan.md | sed -n '160,195p'
printf '%s\n' '--- plan lines 255-280 ---'
nl -ba docs/design/agent-platform-instructions/plan.md | sed -n '255,280p'
printf '%s\n' '--- plan lines 315-340 ---'
nl -ba docs/design/agent-platform-instructions/plan.md | sed -n '315,340p'
printf '%s\n' '--- agent inspect implementation ---'
nl -ba services/oss/src/agent/schemas.py | sed -n '1,220p'
nl -ba services/oss/src/agent/app.py | sed -n '120,180p'
printf '%s\n' '--- focused references ---'
rg -n -S 'platformInstructions|platform_instructions|AGENT_SCHEMAS|inspect' \
  services/oss/src/agent sdks/python/oss/tests/pytest/unit/agents \
  services/agent 2>/dev/null || true

Repository: Agenta-AI/agenta

Length of output: 2728


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- plan lines 1-95 ---'
cat -n docs/design/agent-platform-instructions/plan.md | sed -n '1,95p'
printf '%s\n' '--- plan lines 160-195 ---'
cat -n docs/design/agent-platform-instructions/plan.md | sed -n '160,195p'
printf '%s\n' '--- plan lines 255-280 ---'
cat -n docs/design/agent-platform-instructions/plan.md | sed -n '255,280p'
printf '%s\n' '--- plan lines 315-340 ---'
cat -n docs/design/agent-platform-instructions/plan.md | sed -n '315,340p'
printf '%s\n' '--- current /inspect schema ---'
cat -n services/oss/src/agent/schemas.py | sed -n '1,130p'
printf '%s\n' '--- current route wiring ---'
cat -n services/oss/src/agent/app.py | sed -n '135,180p'

Repository: Agenta-AI/agenta

Length of output: 17599


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- inspect route and response definitions ---'
rg -n -S -C 4 'def .*inspect|inspect\(|/inspect|WorkflowRevisionData|schemas.*meta|CATALOG_TYPES' \
  api/oss/src services/oss/src sdks/python/oss/src \
  --glob '*.py' \
  --glob '!**/archive/**' \
  | head -n 500
printf '%s\n' '--- run_request definitions and consumers ---'
rg -n -S -C 3 'run_request|WireRunRequest|platformInstructions|platform_instructions' \
  sdks/python api/oss services/oss services/runner \
  --glob '*.py' \
  --glob '*.ts' \
  --glob '*.tsx' \
  --glob '*.json' \
  --glob '!**/archive/**' \
  | head -n 700
printf '%s\n' '--- agent platform conventions ---'

Repository: Agenta-AI/agenta

Length of output: 50372


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 32157


Add /inspect coverage to the compatibility slice.

The contract requires platformInstructions in /inspect, but slice 2 lists only wire contracts and goldens. The current /inspect schema has no platformInstructions. Add the /inspect DTO, mapper, and tests, or remove /inspect from the contract.

Comment on lines +68 to +82
Compute it after runtime guidance settles. Digest only normalized, harness-effective
direct instruction inputs:

- `platformInstructions`.
- `agentsMd`.
- Runner runtime instructions.
- `systemPrompt` and `appendSystemPrompt` for Pi-based harnesses only.
- Operator prompt-file bytes that the pinned Pi precedence test proves affect local
Pi's final prompt.

Continuity lookup is already scoped by harness, so do not hash the harness name again.
Normalize absent, empty, and whitespace-only values exactly as run-plan composition
does, then hash a canonical labeled JSON object with one key per effective channel.
Do not hash joined text with an ad hoc delimiter: arbitrary instruction bytes must not
make distinct channel tuples collide. Exclude ignored non-Pi prompt fields, messages,

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Hash final effective channels, not only contributors.

instructionDigest is described as an effective digest, but the listed inputs are pre-composition contributors. A change to separators, omission rules, ordering, or harness merging can change the effective prompt while leaving every listed value unchanged. session/load can then reuse a native conversation with stale instructions.

Hash the final per-harness instruction channels, including the exact Codex developer_instructions and overlay content. Add a regression case that changes only composition semantics.

Comment on lines +174 to +176
Before freezing the daemon environment, merge SDK platform text into
`CODEX_CONFIG.developer_instructions`. Preserve unrelated configuration such as
`cli_auth_credentials_store`; never set `sandbox_mode` through this route.

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- target excerpt ---'
sed -n '60,90p;160,190p;250,285p;315,338p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- related identifiers ---'
rg -n -C 3 'instructionDigest|developer_instructions|CODEX_CONFIG|Codex|/inspect|overlay|exactly[ -]once' docs/design/agent-platform-instructions

Repository: Agenta-AI/agenta

Length of output: 35898


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 4924


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- plan contract context ---'
sed -n '1,60p;120,145p;193,240p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- repository-wide Codex configuration references ---'
rg -n -C 2 'CODEX_CONFIG|developer_instructions|instructionDigest|instruction_digest' .

Repository: Agenta-AI/agenta

Length of output: 50374


Define Codex instruction merge semantics. If CODEX_CONFIG.developer_instructions already has a value, specify the merge order and exactly-once rule. Replacement can discard operator instructions. Include the effective merged value in instructionDigest so native continuity cannot reuse a session with different instructions. Add these cases to the pinned Codex spike.

Comment on lines +178 to +187
After Daytona mount outcomes are known, render runner runtime guidance in the existing
fenced `AGENTS.md` overlay. Keep that overlay reproducible so API strip-on-persist
remains safe. Do not duplicate the SDK base in the file.

The first implementation spike must prove, with pinned packages:

1. `developer_instructions` reaches a new Codex thread.
2. Author `AGENTS.md` remains independently loaded.
3. `session/load` is attempted only for a matching effective `instructionDigest`.
4. A changed digest creates a new native thread with the new developer instructions.

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- plan.md relevant sections ---'
sed -n '1,210p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- plan.md implementation and acceptance sections ---'
sed -n '250,345p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- candidate Codex and AGENTS-related files ---'
fd -i -t f 'codex|agent|instruction|session|inspect' . | head -200
printf '%s\n' '--- references to overlay, AGENTS.md, and session reload ---'
rg -n -i 'AGENTS\.md|overlay|session/load|developer_instructions|strip-on-persist|Codex' --glob '!docs/design/agent-platform-instructions/plan.md' . | head -300

Repository: Agenta-AI/agenta

Length of output: 50374


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 30582


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- plan.md continuation ---'
sed -n '205,345p' docs/design/agent-platform-instructions/plan.md
printf '%s\n' '--- Codex overlay/config implementations ---'
rg -n -C 5 'developer_instructions|CODEX_CONFIG|fenced|strip.*persist|strip.*AGENTS|AGENTS\.md|session/load' \
  services/runner/src services/runner/tests docs/design/codex-harness docs/blog/entries/codex-harness.mdx \
  --glob '!**/dist/**' --glob '!**/node_modules/**' | head -500
printf '%s\n' '--- relevant runner test files ---'
fd -t f . services/runner/tests | rg -i 'codex|workspace|instruction|session|continuity|inspect|prompt'

Repository: Agenta-AI/agenta

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- overlay symbol bindings ---'
rg -n 'appendPlatformGuidance|instructionsFileFor|harnessFiles|developer_instructions|CODEX_CONFIG' \
  services/runner/src services/runner/tests --glob '!**/dist/**' --glob '!**/node_modules/**'
printf '%s\n' '--- matching test files ---'
rg -l -i 'appendPlatformGuidance|developer_instructions|CODEX_CONFIG|AGENTS\.md|session/load|strip.*persist' \
  services/runner/tests --glob '*.ts' --glob '*.tsx' | sort
printf '%s\n' '--- workspace manager ---'
sed -n '1,260p' services/runner/src/environment/workspace-manager.ts
printf '%s\n' '--- environment overlay call sites ---'
rg -n -C 12 'appendPlatformGuidance|harnessFiles|instructionsFile' services/runner/src/environment services/runner/src/engines/sandbox_agent

Repository: Agenta-AI/agenta

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- overlay implementation and unit tests ---'
sed -n '90,180p' services/runner/src/engines/sandbox_agent/system-prompt-appendix.ts
sed -n '130,215p' services/runner/tests/unit/system-prompt-appendix.test.ts
printf '%s\n' '--- environment acquisition around Codex overlay ---'
sed -n '790,845p' services/runner/src/engines/sandbox_agent/environment.ts
printf '%s\n' '--- Codex/workspace tests around instruction delivery ---'
sed -n '1,180p' services/runner/tests/unit/platform-guidance.test.ts
sed -n '840,930p' services/runner/tests/unit/sandbox-agent-orchestration.test.ts
printf '%s\n' '--- continuity test coverage ---'
rg -n -C 6 'load|create|digest|repeated|resume|continu' services/runner/tests/unit/continuation.test.ts services/runner/tests/unit/session-continuity.test.ts

Repository: Agenta-AI/agenta

Length of output: 31333


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- existing strip-on-persist references ---'
rg -n -C 8 'strip_platform_guidance|platform guidance|platform-guidance|AGENTS\.md.*strip|strip.*AGENTS' \
  api services sdks --glob '*.py' --glob '*.ts' --glob '*.tsx' --glob '*.md' \
  --glob '!**/dist/**' --glob '!**/node_modules/**' | head -300
printf '%s\n' '--- orchestration tests containing overlay assertions ---'
rg -n -C 20 'renders the platform guidance|writes the guidance|appendPlatformGuidance|AGENTS\.md|session/load|loadedFromContinuity' \
  services/runner/tests/unit/sandbox-agent-orchestration.test.ts \
  services/runner/tests/unit/system-prompt-appendix.test.ts \
  services/runner/tests/unit/session-continuity.test.ts
printf '%s\n' '--- plan acceptance tail ---'
sed -n '335,390p' docs/design/agent-platform-instructions/plan.md

Repository: Agenta-AI/agenta

Length of output: 50372


Add a pinned Codex lifecycle test for exactly-once overlay delivery.

appendPlatformGuidance can add a second fenced block when AGENTS.md is delivered twice. Test a new thread, matching session/load, and strip-on-persist. Assert that one overlay remains and persistence returns only the author text.

@mmabrouk
mmabrouk force-pushed the docs/agent-platform-instructions branch from 60d527f to d491a08 Compare September 4, 2026 19:57
@mmabrouk mmabrouk changed the title [docs] Define agent platform instruction layers [refactor] Centralize Agenta platform instructions Sep 4, 2026
@mmabrouk

mmabrouk commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: Updated the design to the approved smaller scope and rebased its docs onto the current release/v0.114.4, which already contains the gateway-guidance separation. The plan is now 81 lines rather than 358. It adds one SDK prompt module and a scalar transport field, keeps current delivery and warm-session behavior, and removes the digest/database/restart/native-channel project. The previous digest and Codex developer-merge review concerns no longer apply because those mechanisms are out of scope. Implementation and focused QA are underway with separate SDK and runner implementers.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: b6914eac-f822-4415-bb76-14627f9cc9e2

📥 Commits

Reviewing files that changed from the base of the PR and between 60d527f and d491a08.

📒 Files selected for processing (5)
  • docs/design/agent-platform-instructions/README.md
  • docs/design/agent-platform-instructions/context.md
  • docs/design/agent-platform-instructions/plan.md
  • docs/design/agent-platform-instructions/research.md
  • docs/design/agent-platform-instructions/status.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/design/agent-platform-instructions/README.md
  • docs/design/agent-platform-instructions/status.md
  • docs/design/agent-platform-instructions/context.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread docs/design/agent-platform-instructions/plan.md
Comment thread docs/design/agent-platform-instructions/plan.md
Comment thread docs/design/agent-platform-instructions/research.md
@mmabrouk

mmabrouk commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: Implementation is pushed. The SDK now has one platform instruction module and emits a scalar field; the runner uses its existing delivery and warm-session behavior. Two independent reviewers found no blocking issues. Local runner tests/type checks, SDK agent tests, formatting, and docs build passed; live QA and CI are in progress. The earlier review concerns about instruction digests, Codex developer merging, and a redesigned overlay do not apply to this reduced implementation because those mechanisms were removed from scope.

@coderabbitai review

@mmabrouk

mmabrouk commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: The cleanup is implemented and independently reviewed. Production code is 53 lines smaller. Local runner tests/typecheck, SDK agent tests, formatting, docs build, and locked CI SDK/API/services/runner unit/integration/acceptance checks passed. Live Pi QA also passed fresh instructions, unchanged continuation, an author edit, and a fresh control; logs confirmed warm reuse. Claude/Codex/gateway live QA remains unverified because available test credentials were rejected and automatic approval review blocked copying provider keys into the test vault without explicit permission. No provider keys were copied. Temporary QA containers were removed and workflows archived. The final docs record the results and clarify the existing delivery order requested in review.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/design/agent-workflows/documentation/protocol.md (1)

103-103: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the /run protocol reference to services/runner/src/protocol.ts. The current services/agent/src/protocol.ts path does not exist. This sends developers to a nonexistent file when they follow the living protocol documentation.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 68e6c740-e08c-4bd8-b39c-010e944cb87a

📥 Commits

Reviewing files that changed from the base of the PR and between d491a08 and cff860e.

📒 Files selected for processing (21)
  • docs/design/agent-platform-instructions/status.md
  • docs/design/agent-workflows/documentation/protocol.md
  • sdks/python/agenta/sdk/agents/adapters/agenta_builtins.py
  • sdks/python/agenta/sdk/agents/adapters/harnesses.py
  • sdks/python/agenta/sdk/agents/dtos.py
  • sdks/python/agenta/sdk/agents/platform/gateway.py
  • sdks/python/agenta/sdk/agents/platform_instructions.py
  • sdks/python/agenta/sdk/agents/utils/wire.py
  • sdks/python/agenta/sdk/agents/wire_models.py
  • sdks/python/oss/tests/pytest/unit/agents/golden/run_request.gateway_connection.json
  • sdks/python/oss/tests/pytest/unit/agents/platform/test_gateway_connection_resolve.py
  • sdks/python/oss/tests/pytest/unit/agents/test_harness_adapters.py
  • sdks/python/oss/tests/pytest/unit/agents/test_wire_contract.py
  • services/runner/src/engines/sandbox_agent/run-plan.ts
  • services/runner/src/engines/sandbox_agent/session-identity.ts
  • services/runner/src/lifecycle/desired-state.ts
  • services/runner/src/protocol.ts
  • services/runner/tests/unit/lifecycle-desired-state.test.ts
  • services/runner/tests/unit/sandbox-agent-run-plan.test.ts
  • services/runner/tests/unit/session-pool.test.ts
  • services/runner/tests/unit/wire-contract.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/design/agent-platform-instructions/status.md

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment on lines +697 to +699
request.platformInstructions !== undefined
? request.platformInstructions.trim() || undefined
: request.gatewayGuidance?.text?.trim() || undefined;

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate platformInstructions before calling trim().

An authorized /run request can contain platformInstructions: null because JSON parsing only casts the value to AgentRunRequest. buildRunPlan then evaluates null !== undefined and calls null.trim(), which throws before it returns BuildRunPlanResult. Return a plan error for non-string values before trimming.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
request.platformInstructions !== undefined
? request.platformInstructions.trim() || undefined
: request.gatewayGuidance?.text?.trim() || undefined;
if (
request.platformInstructions !== undefined &&
typeof request.platformInstructions !== "string"
) {
return { ok: false, error: "platformInstructions must be a string" };
}
const platformInstructions =
request.platformInstructions !== undefined
? request.platformInstructions.trim() || undefined
: request.gatewayGuidance?.text?.trim() || undefined;

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6365.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6365-9ebf9fc
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-09-04T20:19:16.670Z

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@mmabrouk: I will review the changes in #6365.


🧠 Learnings used
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 6365
File: docs/design/agent-platform-instructions/plan.md:39-41
Timestamp: 2026-09-04T20:16:53.528Z
Learning: In `services/runner/src/engines/sandbox_agent/run-plan.ts`, `buildRunPlan` is the only consumer of SDK-owned `platformInstructions`. It splices the text before authored `appendSystemPrompt` for Pi and before authored `agentsMd` for Claude and Codex. In `services/runner/src/engines/sandbox_agent/environment.ts`, the runner separately appends fenced runner-owned `platformGuidanceAppendix` to the rendered instruction-file text without reading `platformInstructions`; therefore the SDK text is not duplicated. The resulting instruction-file order is SDK text, author text, then environment guidance.
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deisgn documentation Improvements or additions to documentation needs-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant