Skip to content

fix(agents): keep isolated completion config and credentials together - #139607

Merged
steipete merged 1 commit into
mainfrom
codex/130706-extract-isolated-integrated-20260905
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/130706-extract-isolated-integrated-20260905

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Related: #130706.

What Problem This Solves

After a configuration replacement, an isolated completion could acquire the new runtime generation but continue using the previous configuration and directories. A compiled reproduction sent the previous credential to the new provider endpoint. Utility completions, generated labels, and plugin callers share this owner.

An explicit request configuration could also inherit transport and headers from another configuration's prepared inline models. Mutable request objects could change a selected model, profile, or sampling parameters during preparation, or replace the validator and cancellation signal that belonged to the original call.

Why This Change Was Made

Capture call-owned choices and original validation/cancellation references before the first await. Carry one context from the acquired runtime snapshot through CLI dispatch, harness selection, model materialization, and authorization. Explicit models, profiles, runtime selections, and workspace overrides remain selected; implicit runtime policy and directories come from the admitted configuration. The CLI path no longer falls back to unrelated ambient configuration.

The model resolver reuses configured inline facts only with the configuration that prepared them. A projected configuration uses the existing inline builder while retaining catalog, registry, and generation facts. This preserves per-model API precedence, Google URL normalization, and borrowed generations while removing retired configured headers from projected requests.

This focused owner repair was found while extracting #130706. Production LOC is net +2 after consolidating the existing paths; the remaining growth captures nested sampling values while preserving live validators, signals, and owner-managed configuration. Tests/support are +174 and docs +4. No configuration, dependency, storage, protocol, or public SDK surface is added.

User Impact

New isolated completions use a coherent current endpoint, credential, runtime policy, and agent directory. Explicit choices remain fixed through asynchronous preparation. Borrowed completions remain on their retained generation; route projections receive their own transport and headers.

Evidence

Verified commit: 8a5bda6278bf01e54241ecfe5e065b5c98eea4c6, tree 7711008c73c4eb174bfa2a7e1cf2294438f5e1b3. The touched files remain unchanged on the newer main baseline, and the candidate merges cleanly.

  • Before the repair, compiled runtime requests reproduced the old-credential/new-endpoint mismatch, stale runtime/directories, projected transport/header leakage, and changes to model/profile/sampling or authority after invocation. Corresponding regression tests were demonstrated failing before the repair.
  • The integrated candidate passes 274 focused tests across isolated completion, prepared runtime ownership, model/generation resolution, inline model normalization, native authorization, and model materialization. The native suite retains retired-model, API-sibling, profile-fallback, cancellation, and authority-closure coverage.
  • Fresh independent review is scoped-clean through P2 on the integrated candidate.
  • Full build passes, including all 53 native control-plane loads/doctor closures, 90 plugins, SDK declarations/exports, CLI import checks, and UI budgets.
  • All 21 completed-build runtime controls pass: 14 owner/transport/header/runtime/directory cases and 7 model/profile/runtime/validator/cancellation/sampling-mutation cases. New requests use the current endpoint and credential together; retained requests stay on their original generation; revoked or aborted requests send no HTTP; sampling remains 21 tokens and temperature 0.1 despite later request mutation.
  • The staged source tree and all 8,531 runtime files were identical before and after replay. Every probe process exited and its synthetic fixture directory was removed; proof receipts were retained.
  • The complete changed gate passes: formatting/ratchets, core and test typechecks, unused-export scans, changed-file lint, and repository guards. No source edits were needed after integration.

The HTTP/harness reproductions use isolated synthetic credentials and local fixture endpoints through the actual built runtime. They are not authenticated external-provider or Codex-account tests. Explicit CLI binding replacement was also observed failing closed before dispatch; a synthetic third-party backend reached the unsupported isolated-capability boundary, so that control does not claim healthy CLI execution.

Capture call-owned model/profile/sampling choices and validator/cancellation
references before asynchronous admission. Carry the acquired configuration and
directories through runtime selection, CLI dispatch, model materialization,
and authorization. Derive implicit runtime policy after admission while
preserving explicit model, profile, runtime, and workspace requests. Remove
the CLI path's ambient configuration fallback.

Reuse prepared inline transport/header facts only with their captured config.
Request projections retain canonical inline normalization while catalog,
registry, and borrowed generation facts stay with their existing owner.

Refs #130706. Production LOC: net +2; context consolidation absorbs the
request-ownership capture except for the nested sampling-value copy.
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete steipete self-assigned this Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 01:49
@steipete
steipete requested a review from a team as a code owner September 6, 2026 01:49
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 9:55 PM ET / September 6, 2026, 01:55 UTC.

ClawSweeper review

What this changes

Keeps isolated completion configuration, directories, credentials, and transport settings consistent while preserving caller selections and cancellation through asynchronous preparation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair absent from inspected main. No blocking correctness or security findings were identified.

Priority: P1
Reviewed head: 8a5bda6278bf01e54241ecfe5e065b5c98eea4c6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its body reports built-runtime endpoint/credential and revoked-request controls; source inspection found no unresolved introduced authority violation requiring additional final-effect proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its body reports built-runtime endpoint/credential and revoked-request controls; source inspection found no unresolved introduced authority violation requiring additional final-effect proof.
Evidence reviewed 8 items Verified introduced scope: The supplied complete merge-base-to-head patch contains the focused completion repair. The verified test merge against its pinned main parent changes the same seven paths; unrelated endpoint drift was excluded.
Still necessary on inspected main: Current main retains caller configuration and directories after runtime acquisition, reads mutable request fields through preparation, and unconditionally offers prepared inline model facts. Its two production files differ from the reviewed head by the proposed repair. No merged replacement is established; inspection of the latest release's completion blob was unavailable, so no shipped-fix claim is made.
Canonical admission context: The completion captures request choices before awaiting admission and then passes the acquired snapshot's configuration and directories through runtime selection and authorization. The existing lease owner already rebinds new admissions to committed configured owners and supports preserving explicit workspace overrides.
Findings None None.
Security None None.

How this fits together

Isolated completions provide fresh, tool-free model calls for generated labels, utility tasks, and plugins. Runtime admission supplies the configuration and credential context that the selected harness or CLI uses for inference.

flowchart TD
  A[Utility or plugin request] --> B[Capture selections and cancellation]
  B --> C[Admit runtime generation]
  C --> D[Resolve model and credentials]
  D --> E[Revalidate caller authority]
  E --> F[Harness or CLI inference]
  F --> G[Return text and release lease]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +174, Docs +4. Total +180 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 53 51 +2
Tests 4 177 3 +174
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 234 54 +180

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +2; tests/support net +174 Context consolidation offsets most production growth; added coverage targets configuration mixing and mutation during admission.

Technical review

Best possible solution:

Use one admitted generation for endpoint, credentials, runtime policy, and directories while retaining explicit caller choices and live cancellation checks.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the path: replace the configured runtime before admission completes, then observe completion preparation using the old caller context. This review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. The patch repairs the existing admission owner and reuses the existing inline-model builder without introducing another configuration or credential path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b8731bc88a7c.

Labels

Label changes:

  • add P1: Configuration replacement can pair a previous credential with a new endpoint in shared utility and plugin completion workflows.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its body reports built-runtime endpoint/credential and revoked-request controls; source inspection found no unresolved introduced authority violation requiring additional final-effect proof.

Label justifications:

  • P1: Configuration replacement can pair a previous credential with a new endpoint in shared utility and plugin completion workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its body reports built-runtime endpoint/credential and revoked-request controls; source inspection found no unresolved introduced authority violation requiring additional final-effect proof.

Evidence

What I checked:

  • Verified introduced scope: The supplied complete merge-base-to-head patch contains the focused completion repair. The verified test merge against its pinned main parent changes the same seven paths; unrelated endpoint drift was excluded. (9b5ba97b00a8)
  • Still necessary on inspected main: Current main retains caller configuration and directories after runtime acquisition, reads mutable request fields through preparation, and unconditionally offers prepared inline model facts. Its two production files differ from the reviewed head by the proposed repair. No merged replacement is established; inspection of the latest release's completion blob was unavailable, so no shipped-fix claim is made. (src/agents/isolated-completion.ts:398, b8731bc88a7c)
  • Canonical admission context: The completion captures request choices before awaiting admission and then passes the acquired snapshot's configuration and directories through runtime selection and authorization. The existing lease owner already rebinds new admissions to committed configured owners and supports preserving explicit workspace overrides. (src/agents/isolated-completion.ts:402, 8a5bda6278bf)
  • Authority reaches the dispatch boundary: Both harness versions revalidate before credential handoff; fallback attempts revalidate after failures, and finally closes the callback authority and releases the lease. The host-prepared completion path forwards the captured validator to completeSimple, which checks authority and cancellation after transport initialization and before provider dispatch. (src/llm/stream.ts:116, 8a5bda6278bf)
  • Transport isolation reuses existing normalization: Prepared inline rows are reused only for their captured configuration. Other configurations fall through the existing inline builder, preserving per-model transport precedence and Google URL normalization. Added cases cover cloned configuration, provider transport, model transport, and removal of retired headers. (src/agents/embedded-agent-runner/model.ts:217, 8a5bda6278bf)
  • Captured runtime evidence and limits: The supplied body at sourceRevision a46bf849f001f124fa102c571f3cca597ee1148a9e00943bef9a749732140cb9 reports 21 built-runtime controls at the reviewed head: coherent endpoint/credential pairs, retained-generation behavior, no HTTP after revocation or abort, and unchanged captured sampling. It separately reports 274 focused tests and a successful build. These are author-reported observations; this read-only review did not execute them or inspect underlying receipts. The body explicitly excludes authenticated upstream-provider and Codex-account proof. (8a5bda6278bf)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Verified 8a5bda6278bf01e54241ecfe5e065b5c98eea4c6 for landing. The repair captures the original request choices and validators, then carries the admitted configuration/directories through CLI and V1/V2 authorization. Projected configurations rebuild their inline transport/header facts through the existing owner. Production +2; tests/support +174; docs +4.

Validation passed: 274 focused tests, full build, full changed-file checks, independent P2 review, and 21 completed-build HTTP/harness controls. The proof tree is 7711008c73c4eb174bfa2a7e1cf2294438f5e1b3; all 8,531 runtime files stayed unchanged during replay. New requests used the current endpoint and credential together; retained requests stayed on their original generation; revoked/aborted requests sent no HTTP. All fixture processes and directories were cleaned up. These controls use synthetic credentials through real built code; authenticated external-provider or Codex-account execution is not claimed.

Commands recorded in the validation receipts:

node --import ./scripts/tsx.mjs scripts/test-projects.mts src/agents/isolated-completion.test.ts src/agents/harness/isolated-completion.native-auth.test.ts src/agents/embedded-agent-runner/model.test.ts src/agents/embedded-agent-runner/model.inline-provider.test.ts src/agents/embedded-agent-runner/model.generation-scope.test.ts src/agents/prepared-model-runtime.test.ts src/agents/runtime-plan/materialize-model.test.ts
pnpm build
node scripts/check-changed.mjs -- docs/plugins/sdk-agent-harness.md src/agents/embedded-agent-runner/model.test.ts src/agents/embedded-agent-runner/model.ts src/agents/harness/isolated-completion.native-auth.test.ts src/agents/isolated-completion.test-support.ts src/agents/isolated-completion.test.ts src/agents/isolated-completion.ts

Exact-head CI passed. ClawSweeper has no before-merge findings. Native review artifacts are validated with zero findings. The repository-native prepare/merge workflow is next.

@steipete
steipete merged commit 4da5d44 into main Sep 6, 2026
249 checks passed
@steipete
steipete deleted the codex/130706-extract-isolated-integrated-20260905 branch September 6, 2026 02:05
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 6, 2026
* origin/main:
  fix(cli): keep note text with Windows and Unicode line endings (#139512)
  fix(agents): keep isolated completion context on its admitted generation (#139607)
  fix: avoid declaration builds during source-server updates (#139392)
  fix(models): keep discovered models after catalog refresh failures (#139357)
  fix(gateway): record a transcript notice when a run fails before replying (#139439)
  refactor(ios): reuse shared integer conversion (#139581)
  fix(sessions): prevent database lock failures during reclamation (#139469)
  perf(test): reuse transforms within owned scheduler slots (#139553)
  test(agents): share sparse transcript input fixtures (#139589)
  chore(ui): refresh control ui locales (#139481)
  fix(slack): keep prototype-named emoji shortcodes intact (#136374)
  fix(gateway): deliver upgrade rejection responses under Bun (#139516)
  refactor(test): simplify catalog guards and fix native report fixture (#139496)
  fix(macos): prevent dashboard fixture loopback timeouts (#139556)
  fix(matrix): preserve selected reply targets inside threads (#139479)
vincentkoc added a commit to ylcn91/openclaw that referenced this pull request Sep 6, 2026
* commit '6c55a99226ed0611ca088004c81b00fb296f1f71': (182 commits)
  test(ui): scope dashboard settings setup to the top frame (openclaw#139618)
  refactor(skills): share pending proposal creation (openclaw#139617)
  fix(release): accept frozen targets before worker bundles (openclaw#136699)
  fix(gateway): preserve percent sequences in media filenames (openclaw#139508)
  fix: preserve current update availability alongside update history (openclaw#139501)
  feat(diagnostics): expose garbage collection duration metrics (openclaw#139592)
  fix(ui): keep Logbook timestamps clear of the activity stripe (openclaw#139539)
  fix(ui): keep Swarm outcomes visible after completion (openclaw#139490)
  test: check file accessibility without runtime-specific return values (openclaw#139590)
  refactor(sdk): keep helper types private (openclaw#139601)
  fix(cron): preserve current-session delivery intent (openclaw#139491)
  fix: prevent browser profile permission hangs in Doctor (openclaw#139612)
  fix(agents): repair storage-failure test fixture after failover owner move (openclaw#139531)
  fix(cli): keep note text with Windows and Unicode line endings (openclaw#139512)
  fix(agents): keep isolated completion context on its admitted generation (openclaw#139607)
  fix: avoid declaration builds during source-server updates (openclaw#139392)
  fix(models): keep discovered models after catalog refresh failures (openclaw#139357)
  fix(gateway): record a transcript notice when a run fails before replying (openclaw#139439)
  refactor(ios): reuse shared integer conversion (openclaw#139581)
  fix(sessions): prevent database lock failures during reclamation (openclaw#139469)
  ...
vincentkoc added a commit that referenced this pull request Sep 6, 2026
* commit 'refs/openclaw/tasks/pr-135167-main-latest':
  test(ui): scope dashboard settings setup to the top frame (#139618)
  refactor(skills): share pending proposal creation (#139617)
  fix(release): accept frozen targets before worker bundles (#136699)
  fix(gateway): preserve percent sequences in media filenames (#139508)
  fix: preserve current update availability alongside update history (#139501)
  feat(diagnostics): expose garbage collection duration metrics (#139592)
  fix(ui): keep Logbook timestamps clear of the activity stripe (#139539)
  fix(ui): keep Swarm outcomes visible after completion (#139490)
  test: check file accessibility without runtime-specific return values (#139590)
  refactor(sdk): keep helper types private (#139601)
  fix(cron): preserve current-session delivery intent (#139491)
  fix: prevent browser profile permission hangs in Doctor (#139612)
  fix(agents): repair storage-failure test fixture after failover owner move (#139531)
  fix(cli): keep note text with Windows and Unicode line endings (#139512)
  fix(agents): keep isolated completion context on its admitted generation (#139607)
  fix: avoid declaration builds during source-server updates (#139392)
  fix(models): keep discovered models after catalog refresh failures (#139357)
  fix(gateway): record a transcript notice when a run fails before replying (#139439)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…ion (openclaw#139607)

Capture call-owned model/profile/sampling choices and validator/cancellation
references before asynchronous admission. Carry the acquired configuration and
directories through runtime selection, CLI dispatch, model materialization,
and authorization. Derive implicit runtime policy after admission while
preserving explicit model, profile, runtime, and workspace requests. Remove
the CLI path's ambient configuration fallback.

Reuse prepared inline transport/header facts only with their captured config.
Request projections retain canonical inline normalization while catalog,
registry, and borrowed generation facts stay with their existing owner.

Refs openclaw#130706. Production LOC: net +2; context consolidation absorbs the
request-ownership capture except for the nested sampling-value copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant