Repository navigation
fix(agentsapi): load OpenClaw persona and workspace context - #158328
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 1:22 AM ET / 05:22 UTC (Revision 9). ClawSweeper reviewWhat this changesNew Agents API sessions receive bounded OpenClaw workspace and persona instructions, while each turn receives current runtime context; the branch also documents and tests when those instructions refresh. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still omits workspace persona from new Agents API sessions, and the branch uses the merged shared preparation owner to address that gap. The supplied live Slack and SDK evidence covers session creation, continuation, and reset. Priority: P2 Review scores
Verification
How this fits togetherThe Agents API plugin connects Gateway agent runs to an OpenAI-hosted session. It prepares local workspace guidance and Gateway tools for that session, then returns the hosted response through the originating channel. flowchart LR
A[Gateway workspace files] --> B[Shared context preparation]
B --> C[Agents API harness]
D[Current turn facts] --> C
C --> E[Hosted session]
E --> F[Channel reply]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +146, Tests +470, Docs +32. Total +648 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the shared-owner integration through the normal exact-head gates, retain reset as the documented instruction-refresh operation, and design cross-user hosted-session rotation separately if multi-user support is added. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows the new-session request omits workspace persona; the submitted regression and live trace exercise that entry point, though this read-only review did not run current main. Is this the best way to solve the issue? Yes. The branch consumes the existing shared workspace preparation and keeps hosted instruction delivery in the Agents API plugin, avoiding a second bootstrap policy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c6da2a90127f. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
db731f1 to
169c053
Compare
db970fb to
a44490d
Compare
Workspace instruction injection: PASSVerified the behavior changed by this PR through a local native arm64 Docker Gateway, ordinary Slack turns, and direct inspection of the resulting Agents API sessions using the official SDK. Runtime source: Files actually received by the Agents APIThe complete text of each file below, ignoring surrounding whitespace, was found in the remote session's stored
Each file also contained an independently generated fact. The Slack request asked for those facts by label without supplying their values. The completed response returned all four correctly. Lifecycle and prompt checks
Relevant automated verificationThe instruction suite passes all 12 cases through the attempt entry point and official SDK request serialization. It covers full workspace preparation, stable continuation/reset behavior, selected-profile forwarding, memory routing, temporal/delivery/watched-session input, missing or blank instructions, bootstrap budgets, lightweight cron, and retryable preparation failures. The full-file regression was also verified to fail against the prior AGENTS-only implementation. pnpm test extensions/agentsapi/agentsapi-attempt.instructions.test.ts --maxWorkers=1Measured cost: 25.41 seconds wall, 22.43 seconds Vitest duration. Per-file CI seconds are not available. The later comprehensive local run passed 154 tests across 11 related files, including this suite and the shared workspace/bootstrap owners. Selected formatting, type, lint, SDK boundary and import checks also passed. Current head CI has no failed or pending checks; skipped checks are not counted as test passes. Boundaries
Personal fixture text, session identifiers and private channel receipts are omitted from this public proof. Attachment-transfer and Docker diagnostic evidence are outside this PR's change and are not claimed here. |
f1858c4 to
40e5c6a
Compare
|
Merged via squash.
|
* commit '66b812f26e725cd709e08860d2cb46ba496cd308': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (#158689) fix(gateway): reset staged headers on authority errors (#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (#158612) fix(ui): keep automation starter prompts out of startup (#158482) fix(cli): distinguish configuration read failures from invalid input (#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (#158662) fix(daemon): keep native service checks within their timeout (#154565) fix(test): restore gateway steering fixture contracts (#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (#158633) perf(gateway): release event payloads from live text guards (#158643) perf(sessions): reduce stalls when saving large chat messages (#158402) fix(qa): reject history-bearing utility requests without session affinity (#158496) test: allow intentional progress snapshot coercion ...
* fix(test): verify followup completion ordering Exercise the real presentation settlement helper with asynchronous cleanup, preserve continuation and admission semantics, and unconditionally release and join the held work. Remote proof covers the strengthened ordering contract and both missing-await faults. * fix(test): verify followup completion ordering * chore: retain followup test branch ancestry The current-main reconstruction preserves the original reviewed scope and supersedes its stale base. Keep the remotely qualified candidate tree unchanged while retaining the original PR ancestry for a non-force branch update. * commit 'ff35145de21cf6296bec05e86bee37b5ed53bcb8': fix(test): verify followup completion ordering * test(auto-reply): signal queued presentation entry * chore: refresh followup test on boundary fix * commit '66b812f26e725cd709e08860d2cb46ba496cd308': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (#158689) fix(gateway): reset staged headers on authority errors (#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (#158612) fix(ui): keep automation starter prompts out of startup (#158482) fix(cli): distinguish configuration read failures from invalid input (#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (#158662) fix(daemon): keep native service checks within their timeout (#154565) fix(test): restore gateway steering fixture contracts (#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (#158633) perf(gateway): release event payloads from live text guards (#158643) perf(sessions): reduce stalls when saving large chat messages (#158402) fix(qa): reject history-bearing utility requests without session affinity (#158496) test: allow intentional progress snapshot coercion ... Co-authored-by: Vincent Koc <[email protected]>
…#158328) * test(agentsapi): cover Gateway instruction snapshots * fix(agentsapi): load Gateway agent instructions for new sessions * style(agentsapi): format instruction snapshot regression * fix(agentsapi): declare the canonical attempt result * test(agentsapi): use canonical fixture cloning * refactor(agentsapi): use shared workspace preparation * style(agentsapi): format shared preparation fixture * docs(agentsapi): state the unimplemented context carrier gap * style(agentsapi): format rebased instruction fixture * fix(agentsapi): include OpenClaw persona and prompt context * fix(agentsapi): preserve admitted tools in workspace context * docs(agentsapi): document single-user MVP scope --------- Co-authored-by: Sarah Fortune <[email protected]>
* fix(test): verify followup completion ordering Exercise the real presentation settlement helper with asynchronous cleanup, preserve continuation and admission semantics, and unconditionally release and join the held work. Remote proof covers the strengthened ordering contract and both missing-await faults. * fix(test): verify followup completion ordering * chore: retain followup test branch ancestry The current-main reconstruction preserves the original reviewed scope and supersedes its stale base. Keep the remotely qualified candidate tree unchanged while retaining the original PR ancestry for a non-force branch update. * commit 'ff35145de21cf6296bec05e86bee37b5ed53bcb8': fix(test): verify followup completion ordering * test(auto-reply): signal queued presentation entry * chore: refresh followup test on boundary fix * commit '622be54be3ffe0fce27d6a4b147c76d4b19c528c': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (openclaw#158689) fix(gateway): reset staged headers on authority errors (openclaw#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (openclaw#158612) fix(ui): keep automation starter prompts out of startup (openclaw#158482) fix(cli): distinguish configuration read failures from invalid input (openclaw#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (openclaw#158662) fix(daemon): keep native service checks within their timeout (openclaw#154565) fix(test): restore gateway steering fixture contracts (openclaw#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (openclaw#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (openclaw#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (openclaw#158633) perf(gateway): release event payloads from live text guards (openclaw#158643) perf(sessions): reduce stalls when saving large chat messages (openclaw#158402) fix(qa): reject history-bearing utility requests without session affinity (openclaw#158496) test: allow intentional progress snapshot coercion ... Co-authored-by: Vincent Koc <[email protected]>
Why This Change Was Made
An Agents API session should follow the configured OpenClaw agent's identity, personality, user preferences, and operating rules even though its commands run in a separate hosted workspace. Loading only root
AGENTS.mdomitted the personal context that the Codex harness already receives.What Problem This Solves
New Agents API sessions omitted the OpenClaw agent's persona and user context because they received only the Gateway's root operating rules.
User Impact
New sessions receive the same eligible workspace files prepared for Codex, together with applicable shared prompt guidance. Existing sessions need
/newor/resetto adopt this context or later file edits.Changes
AGENTS.md,SOUL.md,IDENTITY.md, sharedUSER.md, the session-selected personal USER overlay, and eligible supporting bootstrap files. The shared owner retains budgets, bootstrap hooks, missing-file handling, and session privacy rules./newor/resetfor updated files or changed personal-user selection. Preparation failures remain retryable before remote creation/binding.Codex source and shared preparation behavior are unchanged. Existing attachment upload and hosted output transfer are already implemented and preserved; this change does not copy Gateway bootstrap files into the hosted VM.
MVP gaps
before_prompt_buildand context-engine prompt assembly, and native fork preparation remain unimplemented.Evidence
Workspace injection verified through a local native arm64 Docker Gateway, ordinary Slack turns, and SDK retrieval of the resulting Agents API instructions. Complete contents of the Gateway's AGENTS, SOUL, IDENTITY and USER files appear in the native instructions; responses use independent facts from those files. Continuation retains the initial snapshot, and reset adopts edited files. Per-turn runtime context and real memory-tool use also passed.
The 12-case instruction suite passes, including a regression shown to fail against the prior AGENTS-only implementation. A comprehensive local run passed 154 tests across 11 related files. Selected formatter, type, lint, SDK boundary and import checks passed. Instruction suite cost: 25.41 seconds wall, 22.43 seconds Vitest duration; per-file CI seconds are unavailable.
Tested runtime:
b6a87ff583d021e9801120698ed84a1574db8ec2. The laterf1858c4d52ed9087aaeb6882ab9a65ec5870436cadds only the package README limitation. The PR is now rebased onto public main at4ed4df0e9b3f617c51a03c5e81d37534e0c32865, with head40e5c6a07fee6f6f4b7ba84025d01f2f54286bc5. All 12 commit patches are identical after rebase, and the production Agents API and shared workspace preparation files are unchanged. The incorporated main-only change in this package improves an attachment-test byte assertion. Live proof is from the tested runtime above. Normal PR CI passed on the rebased head: 26 jobs passed, 23 skipped, no failures; both required merge-gate surfaces passed. Merged into publicmainas099220cc937ad0b3ee24fee60cfd45e24e091e41.Verified workspace-injection proof
CI recovery context
The first rebased run retained the obsolete stack merge base during GitHub retargeting and failed preflight on unrelated locale files. After the merge projection refreshed, an extra full-release dispatch surfaced one existing-main failure in
test/scripts/lint-suppressions.test.ts:AssertionError: expected [ …(78) ] to deeply equal [ …(77) ], for theno-implicit-coercionsuppression insrc/gateway/server-chat-progress-snapshot.ts. Both files are byte-identical to the PR main base; this PR changes neither the suppression nor its allowlist. Original failed job. The extra full-release run was stopped, and normal PR CI was reattached after the base transition. This does not claim a fix or passing reproduction of that unrelated baseline failure.