Repository navigation
refactor(sdk): retire superseded worker prompt/bootstrap SDK exports - #164768
Conversation
Use the configured prompt builder and session factory directly. Preserve prompt trimming and embedded provider-resource disposal ownership; retain the documented session-extension SDK. Validated 371 tests across 21 whole files on Hetzner cbx_5d2b3a4147aa. Independent Codex review is clean at P0-P2. Production delta: -55 lines. Committed with --no-verify because this sparse worktree has no dependencies; pnpm exec oxfmt --check passed for every changed file on the lease.
Preserve the trimming regression without referencing an unbound session method. Lease oxfmt --check passed before committing with --no-verify in the sparse worktree.
The lease mock-export owner pruned exactly four obsolete factories. Lease formatting passed for the changed source files; this sparse checkout commit uses --no-verify because dependencies are installed only in the validation and tooling checkouts.
|
🦞👀 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 October 4, 2026, 1:26 AM ET / 05:26 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch removes internal prompt and session forwarding functions and migrates their callers and tests to the existing configured prompt builder and session factory. Merge readiness✅ Ready for maintainer review This remains useful cleanup: current main retains the redundant forwarding paths. The introduced changes preserve prompt handling and resource ownership, and no blocking defect was found. Priority: P3 Review scores
Verification
How this fits togetherEmbedded agent runs prepare tools and configuration into system prompts, then construct sessions that send those prompts to providers. Temporary embedded sessions leave durable provider-resource cleanup to their outer lifecycle owner. flowchart TD
A[Run configuration and tools] --> B[Configured prompt builder]
B --> C[Trimmed session prompt]
D[Prepared model and resources] --> E[Session factory]
C --> E
E --> F[Provider execution]
E --> G[Outer lifecycle cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -55, Tests -22, Other -4. Total -81 across 20 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep prompt configuration and session construction with their existing owners while retaining the documented extension-safe SDK. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and source inspection confirms the redundant paths remain on current main. Is this the best way to solve the issue? Yes: moving the existing projections and lifecycle inputs directly to their owners removes forwarding layers without changing the documented plugin surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 39b4bdbb6427. 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 (1 earlier review cycle)
|
|
您好,您的邮件已经收到,尽快给您回复,谢谢。 ——冯润泽
|
|
Merged via squash.
|
…penclaw#164768) * refactor(sdk): retire superseded worker prompt/bootstrap SDK exports Use the configured prompt builder and session factory directly. Preserve prompt trimming and embedded provider-resource disposal ownership; retain the documented session-extension SDK. Validated 371 tests across 21 whole files on Hetzner cbx_5d2b3a4147aa. Independent Codex review is clean at P0-P2. Production delta: -55 lines. Committed with --no-verify because this sparse worktree has no dependencies; pnpm exec oxfmt --check passed for every changed file on the lease. * test(agents): assert installed prompt bytes directly Preserve the trimming regression without referencing an unbound session method. Lease oxfmt --check passed before committing with --no-verify in the sparse worktree. * test(agents): prune retired prompt mock baselines The lease mock-export owner pruned exactly four obsolete factories. Lease formatting passed for the changed source files; this sparse checkout commit uses --no-verify because dependencies are installed only in the validation and tooling checkouts.
What Problem This Solves
Embedded agent sessions currently use separate internal forwarding functions for session creation and configured prompt construction. These redundant entry points complicate sharing prompt preparation with node-hosted sessions.
User Impact
No user-visible behavior change. Session construction defaults, embedded provider-resource ownership, prompt trimming, tool policy, bootstrap content, and the documented session-extension SDK remain unchanged.
Why This Change Was Made
The configured prompt builder now accepts the actual tool projection directly. Embedded prompt callers use that owner, and session callers use the existing session factory with explicit disposal ownership. The obsolete forwarding functions and their internal parameter adapter are removed.
The virtual session-extension SDK and loader are retained because docs/plugins/sdk-overview/host-hooks.md documents their contract. This PR does not retire public exports, alter resource loading, or include the node prompt-parity behavior change.
Evidence
cbx_5d2b3a4147aa(Node 24.16.0, pnpm 12.5.1); serial command wall time 345.58 s, peak RSS 5.55 GiB. The final assertion repair passed its whole file again: 21 tests, 33.28 s including worker preparation.pnpm exec oxfmt --checkandgit diff --checkpassed. Sparse-worktree commits use--no-verifyonly after lease formatting proof.pnpm buildpassed in 637.20 s (peak RSS 8.78 GiB); only the existing advisory UI size warnings remained.4fa690195797; the subsequent rebase incorporates no changes to these agent/session owners or fixtures. Exact-head CI run 37178064171 andopenclaw/ci-gatepassed. Its 17 selected Node jobs used 2,475 job-seconds including setup. ClawSweeper completed its exact-head review with no findings (review).Deletion and mechanical migration ledger
Deleted src/agents/embedded-agent-runner/system-prompt.ts, retiring buildEmbeddedSystemPrompt and applySystemPromptToSession. Removed createAgentSessionForEmbeddedRunner, createAgentSessionImpl, and CreateAgentSessionInternalOptions from src/agents/sessions/sdk.ts. Kept construction in createAgentSession; embedded callers explicitly preserve cleanupProviderSessionResourcesOnDispose: false.
Owner changes:
Mechanical production callers/fixtures:
The four obsolete factory entries are pruned from
config/test-mock-exports-baseline.txt. The remaining ten paths migrate existing tests or shared test helpers to the same owners. The deleted wrapper-only setter test is covered at the session-preparation boundary, including its trimming contract.