Skip to content

fix(safeguard): resolve compaction provider/model before registering runtime#73704

Open
joeykrug wants to merge 30 commits into
openclaw:mainfrom
joeykrug:fix/57901-safeguard-compaction-model
Open

fix(safeguard): resolve compaction provider/model before registering runtime#73704
joeykrug wants to merge 30 commits into
openclaw:mainfrom
joeykrug:fix/57901-safeguard-compaction-model

Conversation

@joeykrug

@joeykrug joeykrug commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #57901.

What Problem This Solves

Normal safeguard auto-compaction still registers the active session model even when agents.defaults.compaction.model selects a different summarization target. Main's new route-aware auth planner fixed explicit compaction, but normal safeguard registration still ignored the override.

A safeguard override also needs its model route and credential to remain one atomic tuple. Binding a target credential into the active attempt registry can corrupt same-provider sessions before compaction starts.

Summary

This refresh is merged with main at 266d49cddb977c45d40f13d27045214db29bc756 and adapts the safeguard override to the current route-aware runtime planner.

  • Resolve the configured safeguard target before synchronous extension registration.
  • Reuse an existing prepared auth plan only when it exactly matches the target provider/model.
  • Otherwise prepare the target through the atomic runtime flow:
    prepareAgentRuntimeAuthmaterializePreparedRuntimeModelresolvePreparedRuntimeAuthAttemptsresolvePreparedRuntimeModelAuth.
  • Preserve the selected model route, auth requirement, request transport overrides, runtime policy, selected profile, and credential as one tuple.
  • Resolve the target with an isolated AuthStorage/ModelRegistry; never mutate the active attempt's auth registry.
  • Carry the prepared model, target registry, and resolved auth plan through the safeguard runtime registry.
  • Prefer the prepared safeguard model and its paired registry in the hook.
  • Reject prepared routes whose runtime policy does not support the OpenClaw runtime.
  • Preserve locked native-harness sessions on their pinned model.
  • Warn and fall back to the active model when the configured target cannot be resolved or authenticated.
  • Keep explicit compaction on main's current prepared-route implementation while forwarding its resolved model, registry, and auth plan into safeguard runtime state.

Safety Invariants

  • A same-provider override using a different profile cannot replace the active session key.
  • Cross-provider model, API, base URL, route requirement, transport overrides, runtime policy, selected profile, and key are resolved together.
  • The safeguard hook looks up target credentials in the target registry, not the active attempt registry.
  • buildEmbeddedExtensionFactories remains synchronous by receiving a precomputed target.

Evidence

Validated on exact local tree b38eded0065419c75b3b1f369b96d7359c0cb239:

  • PR head: 9f2ac5d5ac9e17d20e9ec7be684f82157b4b3327
  • Merge parents: prior PR head ecfc4491ece04b29ccb48c42ecb6a40d6e0d8a37 and main 266d49cddb977c45d40f13d27045214db29bc756
  • Diff from merged main: 9 files, +1022/-21
  • Core production TypeScript — passed
  • Core test TypeScript — passed
  • Planner/safeguard focused suites — 238 tests passed
  • Compaction context/resource-loader suites — 62 tests passed
  • Duplicate extension-project coverage — 26 tests passed
  • Concrete OpenAI route regression asserts API, base URL, auth requirement, request overrides, runtime policy, selected profile, and key
  • Same-provider alternate-profile regression proves target-key isolation from the active registry
  • oxfmt --check, type-aware oxlint --deny-warnings, and git diff --check — passed
  • Independent semantic review confirmed the adapted diff preserves main's atomic route/auth contract

A direct compact-hooks subset currently reproduces 9/102 failures on an unmodified 266d49c worktree as well as the merge tree; the conflicted compact implementation and harness are byte-identical to main. No unrelated main fix is included here. Fresh exact-head GitHub CI is running.

Testing Scope

No live provider API call was made. Exact-head automated coverage proves route/auth tuple integrity and active-registry isolation. A real provider-backed automatic cross-provider safeguard compaction remains an external maintainer/environment proof gate.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Apr 28, 2026
@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the safeguard auto-compaction path so that agents.defaults.compaction.model is honoured: extensions.ts now resolves the configured compaction model from the model registry before registering the safeguard runtime, and compaction-safeguard.ts flips precedence to runtime?.model ?? ctx.model so the resolved model wins over the session model.

  • Silent failure when registry lookup misses: In resolveSafeguardRuntimeTarget, if the override model isn't found in the registry (typo, unregistered model, absent modelRegistry), runtime.model is set to undefined with no warning. In the compact.ts path where ctx.model is also undefined, this silently cancels compaction instead of falling back to the session model — and the only log is the generic "could not resolve a summarization model" message with no mention of the failed override.

Confidence Score: 3/5

Safe to merge for correctly configured setups, but misconfigured compaction model overrides can silently cancel compaction in the compact.ts path rather than falling back gracefully.

One P1 finding: when the configured compaction model override is not found in the model registry, resolveSafeguardRuntimeTarget returns model: undefined with no warning. In the compact.ts workflow (ctx.model = undefined), this causes compaction to cancel entirely — a regression from the pre-PR behavior of using the session model.

src/agents/pi-embedded-runner/extensions.ts — resolveSafeguardRuntimeTarget needs a warning log (and ideally a fallback) when the registry lookup fails for a non-empty override.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/extensions.ts
Line: 165-169

Comment:
**Silent `undefined` runtime model when registry lookup misses**

When a compaction model override is configured and the provider/model combination differs from the session model, the function falls through to `params.modelRegistry?.find(provider, modelId)`. If `modelRegistry` is absent or the model isn't registered (e.g. a typo in `agents.defaults.compaction.model`, or a freshly-added model that hasn't been imported yet), the lookup returns `null`/`undefined`, and `model: undefined` is silently stored as `runtime.model`.

Downstream in `compaction-safeguard.ts:915`, `runtime?.model ?? ctx.model` evaluates to `ctx.model`. In the `compact.ts` path `ctx.model` is always `undefined`, so compaction will cancel with `{ cancel: true }` and the only log emitted is the generic "could not resolve a summarization model" message — giving the user no indication that their configured override was silently dropped.

Consider logging a warning here when the registry lookup fails and there is an explicit override:
```typescript
const model = params.modelRegistry?.find(provider, modelId) as
  | ProviderRuntimeModel
  | null
  | undefined;
if (model == null) {
  log.warn(
    `[compaction-safeguard] Configured compaction model "${provider}/${modelId}" was not found in the model registry. Falling back to session model.`,
  );
}
return { provider, modelId, model: model ?? undefined };
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(safeguard): resolve compaction provi..." | Re-trigger Greptile

Re-review progress:

Comment thread src/agents/pi-embedded-runner/extensions.ts Outdated
@clawsweeper

clawsweeper Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 12, 2026, 10:00 PM ET / July 13, 2026, 02:00 UTC.

Summary
The PR prepares the configured safeguard compaction model, route, registry, and authentication tuple before synchronous extension registration and carries that prepared target into compaction runtime state.

PR surface: Source +495, Tests +506. Total +1001 across 9 files.

Reproducibility: yes. from source: current main gives ctx.model precedence over the registered safeguard runtime model, matching the reports that the configured override is ignored. A live current-main reproduction was not performed during this read-only review.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #57901
Summary: This PR is the active candidate fix for the canonical safeguard compaction override issue; one closed report describes the same ignored override, while the alias report overlaps target resolution but contains a narrower alias-specific symptom.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live Gateway or terminal proof of an automatic cross-provider safeguard compaction using the configured model without changing the active session credential.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Focused tests and CI exercise the route/auth tuple, but the contributor explicitly reports no live provider-backed automatic compaction; add redacted terminal or Gateway logs showing the configured target and unchanged active credential, update the PR body, and request @clawsweeper re-review if a fresh review does not trigger automatically.

Risk before merge

  • [P1] A real Gateway run has not yet shown that automatic safeguard compaction actually uses a different provider/model and its intended credential while leaving the active session credential unchanged.
  • [P1] The patch changes both provider authentication selection and session-scoped compaction runtime state; a mismatch not represented by the focused fixtures could route compaction through the wrong model, profile, endpoint, or key.

Maintainer options:

  1. Require provider-backed safeguard proof (recommended)
    Keep the PR open until a redacted live run shows automatic compaction using the configured cross-provider target while the active session route and credential remain unchanged.
  2. Accept automated coverage only
    Merge based on the focused route, profile, and key-isolation tests while explicitly accepting that the real provider integration path remains unobserved.

Next step before merge

  • [P1] Obtain the contributor's live provider-backed automatic-compaction proof, then review the exact merge result and completed checks; no narrow mechanical code defect remains for ClawSweeper repair automation.

Security
Cleared: The auth-sensitive diff adds no dependency, workflow, secret-permission, or supply-chain change, and no concrete credential disclosure or authorization defect was found in the isolated-registry design.

Review details

Best possible solution:

Use one shared route-aware preparation path for manual and safeguard compaction, retain the isolated target registry and regression coverage, and require redacted live Gateway proof that an automatic cross-provider safeguard compaction uses the configured target without altering the active session credential.

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

Yes from source: current main gives ctx.model precedence over the registered safeguard runtime model, matching the reports that the configured override is ignored. A live current-main reproduction was not performed during this read-only review.

Is this the best way to solve the issue?

Yes, the proposed pre-registration preparation and isolated model/auth tuple address the owner boundary more safely than changing model precedence alone. The implementation still needs real provider-backed automatic-compaction proof before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 58e84401903b.

Label changes

Label justifications:

  • P2: This fixes a documented compaction model override that is ignored in one runtime path, with meaningful but bounded provider and session impact.
  • merge-risk: 🚨 session-state: The PR changes session-manager-scoped compaction model and registry state, where incorrect pairing could make compaction use stale or mis-associated runtime state.
  • merge-risk: 🚨 auth-provider: The PR prepares and carries a separate provider route, auth profile, credential, and model registry for compaction, so merge safety depends on preserving that tuple.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Focused tests and CI exercise the route/auth tuple, but the contributor explicitly reports no live provider-backed automatic compaction; add redacted terminal or Gateway logs showing the configured target and unchanged active credential, update the PR body, and request @clawsweeper re-review if a fresh review does not trigger automatically.
Evidence reviewed

PR surface:

Source +495, Tests +506. Total +1001 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 7 507 12 +495
Tests 2 515 9 +506
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 1022 21 +1001

What I checked:

Likely related people:

  • starbuck100: Merged feature history credits this contributor with introducing agents.defaults.compaction.model, making them relevant to the intended override contract. (role: introduced behavior; confidence: high; files: src/config/types.agent-defaults.ts, src/agents/embedded-agent-runner/compact.ts)
  • oliviareid-svg: Recent merged work aligned explicit and context-engine compaction with the configured model override, directly adjacent to this safeguard-only gap. (role: adjacent compaction-route contributor; confidence: high; files: src/agents/embedded-agent-runner/compact.ts, src/agents/embedded-agent-runner/compaction-runtime-context.ts)
  • steipete: Repository history connects this contributor to compaction defaults, headroom, manual compaction behavior, and model-override plumbing across config and runtime surfaces. (role: recent compaction/defaults contributor; confidence: medium; commits: 7dbb21be8e57, a3747b1ee3ae, 7920f8d4fdeb; files: src/config/types.agent-defaults.ts, src/config/zod-schema.agent-defaults.ts, src/agents/agent-settings.ts)
  • joeykrug: Beyond authoring this PR, prior merged history credits this contributor with timeout-recovery compaction work in the same runtime area. (role: prior compaction contributor; confidence: medium; files: src/agents/embedded-agent-runner/compact.ts, src/agents/embedded-agent-runner/run/attempt.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (7 earlier review cycles)
  • reviewed 2026-07-03T20:10:14.104Z sha 422c601 :: found issues before merge. :: [P3] Remove the PR-only proof script
  • reviewed 2026-07-11T20:56:59.844Z sha 74e144c :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-11T21:16:20.265Z sha 8c1ad51 :: needs real behavior proof before merge. :: [P1] Bind the override provider's auth before registration
  • reviewed 2026-07-11T21:47:55.877Z sha ecfc449 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-11T21:58:11.812Z sha ecfc449 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-11T23:59:57.872Z sha 9f2ac5d :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-12T04:15:53.349Z sha 3c6d842 :: needs real behavior proof before merge. :: none

@joeykrug
joeykrug force-pushed the fix/57901-safeguard-compaction-model branch 2 times, most recently from 1736c23 to d12930f Compare April 28, 2026 20:57
joeykrug added a commit to joeykrug/openclaw that referenced this pull request Apr 28, 2026
… registry

Greptile P1 feedback on PR openclaw#73704: when agents.defaults.compaction.model is
configured with a provider/modelId that isn't registered, resolveSafeguardRuntimeTarget
silently returns model: undefined. In compact.ts paths where ctx.model is also
undefined, this causes compaction to silently cancel with only a generic log.

Now we log a clear warning naming the failed provider/modelId, so misconfigured
overrides surface instead of being dropped silently.
joeykrug added a commit to joeykrug/openclaw that referenced this pull request May 10, 2026
… registry

Greptile P1 feedback on PR openclaw#73704: when agents.defaults.compaction.model is
configured with a provider/modelId that isn't registered, resolveSafeguardRuntimeTarget
silently returns model: undefined. In compact.ts paths where ctx.model is also
undefined, this causes compaction to silently cancel with only a generic log.

Now we log a clear warning naming the failed provider/modelId, so misconfigured
overrides surface instead of being dropped silently.
@joeykrug
joeykrug force-pushed the fix/57901-safeguard-compaction-model branch from 0e82fa2 to 4b2bdc5 Compare May 10, 2026 05:07
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 10, 2026
joeykrug and others added 4 commits May 10, 2026 01:34
…runtime

Fixes openclaw#57901. Previously `buildEmbeddedExtensionFactories` populated the safeguard runtime with the active session model and the safeguard hook preferred ctx.model over runtime?.model, so users configuring `agents.defaults.compaction.model` saw no effect for safeguard auto-compaction (only manual /compact and context-engine paths honored it).

This change shares the compaction target resolution between the explicit compaction runtime context and the safeguard runtime, then swaps the precedence in the safeguard hook so the configured compaction model wins when present, falling back to the session model when no override is set.

Adds a regression where `ctx.model` is the session model and `agents.defaults.compaction.model` is different — confirms the configured model is used.

Co-authored-by: Joey Krug <[email protected]>
… registry

Greptile P1 feedback on PR openclaw#73704: when agents.defaults.compaction.model is
configured with a provider/modelId that isn't registered, resolveSafeguardRuntimeTarget
silently returns model: undefined. In compact.ts paths where ctx.model is also
undefined, this causes compaction to silently cancel with only a generic log.

Now we log a clear warning naming the failed provider/modelId, so misconfigured
overrides surface instead of being dropped silently.
@joeykrug
joeykrug force-pushed the fix/57901-safeguard-compaction-model branch from 4b2bdc5 to cc66444 Compare May 10, 2026 05:43
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels May 12, 2026
@MarkMa84

Copy link
Copy Markdown

Any update?

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 20, 2026
@clawsweeper clawsweeper Bot added the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Jun 4, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 8, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 8, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 11, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: 185b19a17c238654d9092e63ef3e59d31095e20c

joeykrug added 3 commits June 28, 2026 18:37
# Conflicts:
#	extensions/slack/src/monitor/send.runtime.ts
#	src/agents/embedded-agent-runner/extensions.ts
#	src/agents/embedded-agent-runner/run/attempt.ts
#	ui/src/ui/views/workboard.ts
Resolve the configured safeguard compaction target before runtime registration, preserve native-harness model locks, and warn while retaining the active session model when an override cannot be resolved.

Trim PR-only proof and unrelated collateral files while preserving the synchronized main tree.

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed the synchronized refresh in 74e144c000adcb765e05531c146f6210426eb281.

  • True merge commit with ordered parents: prior PR head 422c6017c1636160a005a1ab3180183a9bfabeb7, then main cutoff 262baedcf7fa3d66dc35cce7d0253e0a31f0cc0e.
  • Narrowed the PR to six focused source/test files (+277/-17); removed the PR-only proof script and unrelated collateral churn.
  • Addressed the earlier unresolved-model Greptile warning: a missing configured compaction model now emits a warning and retains the active session model instead of registering model: undefined. A focused regression test covers this.
  • Preserved native-harness model locks, cross-provider auth-profile dropping, resolved context-window selection, and both normal-run and explicit-compaction callers.

Exact-cutoff validation: production and test TypeScript projects passed; 4 focused Vitest files / 154 tests passed; six-file formatting, targeted oxlint, and git diff --check passed. The affected src/agents full-core lint shard passed. No live provider API call was made, and the repository-wide lint command was not completed end-to-end locally after upstream moved during validation.

@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

Copy link
Copy Markdown
Contributor Author

CI triage for exact head 74e144c000adcb765e05531c146f6210426eb281:

  • The sole source/test CI failure is checks-node-compact-small-whole-1, where unrelated src/tui/tui-pty-local.e2e.test.ts timed out waiting for a newly created TUI session. The other 56 jobs in that CI run passed, including production types, test types, lint, guards, build artifacts, security, CodeQL, OpenGrep, and the affected agent suites.
  • I reran that exact TUI PTY file against the synchronized local tree: 1 file passed, 8/8 tests passed, 68.37s.
  • The Real behavior proof check now passes on the unchanged head after the PR body was given the required What Problem This Solves and Evidence headings.
  • I attempted to rerun only the failed GitHub job, but the connected GitHub integration returned 403 Resource not accessible by integration.

A maintainer or automation identity with Actions write permission will need to click Re-run failed jobs to clear the stale TUI timeout; no compaction-path code change is indicated by the failure.

The prior exact-head CI run had one unrelated TUI PTY session-adoption timeout. The same test passes locally on the synchronized tree (8/8); this empty same-tree commit retriggers Actions without changing the patch.

Copy link
Copy Markdown
Contributor Author

Exact-head CI retrigger is now 8c1ad51b4ba34ec1d19d2c389f149b9ea0602925.

This is an empty same-tree commit: tree 9dd2766a273a53cddca27a0487328bdc35abe34a is unchanged from 74e144c000adcb765e05531c146f6210426eb281, and the synchronized main cutoff remains in ancestry. It exists only because the Actions integration could not rerun the proven-flaky TUI PTY job (403), while the exact test passes locally 8/8.

The PR body now has the required What Problem This Solves and Evidence sections, and the previous exact head already produced a passing Real behavior proof check after that metadata correction.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the exact-head P1 in ecfc4491ece04b29ccb48c42ecb6a40d6e0d8a37.

  • Extracted the explicit-compaction auth contract into a shared helper: target-model getApiKeyForModel → provider runtime auth prepare/protect/apply → authStorage.setRuntimeApiKey.
  • Normal safeguard setup now resolves the configured target, selects the target provider's auth profile/store (never the active provider profile after a provider switch), prepares the model, and binds its runtime credential before synchronous extension registration.
  • Explicit /compact uses the same helper and passes its effective prepared model into registration.
  • Target resolution/auth failure warns and falls back to the active model instead of registering an unauthenticated target.
  • Added a real in-memory regression with active Anthropic auth and an OpenAI key present only in AuthProfileStore, plus a missing-target-auth fallback regression.

Exact-head local validation: core and core-test TypeScript projects passed; 8 compaction-focused files / 464 tests passed; 12 run-attempt support files / 190 tests passed; targeted formatting/lint and git diff --check passed. No live provider call was made; the real provider-backed automatic-compaction proof remains an external environment gate.

@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

Reconcile safeguard compaction target resolution with the route-aware runtime auth planner. Preserve the prepared model route, runtime policy, transport overrides, and credential tuple in an isolated target registry so compaction overrides cannot mutate active-session auth.

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact head 9f2ac5d5ac9e17d20e9ec7be684f82157b4b3327 is a two-parent merge with main 266d49cddb977c45d40f13d27045214db29bc756 and replaces the stale bespoke safeguard auth helper with main's atomic route-aware planner.

The prepared safeguard target now carries one model/route/profile/key tuple in a dedicated target AuthStorage/ModelRegistry; the active attempt registry is never mutated. The runtime preserves model route, auth requirement, request transport overrides, runtime policy, selected profile, and target registry, and the hook prefers that paired registry. New cross-provider and same-provider regressions prove concrete route integrity and active-key isolation.

Exact local tree b38eded0065419c75b3b1f369b96d7359c0cb239: core production/test types pass; 238 focused planner/safeguard tests, 62 context/resource tests, and 26 duplicate extension tests pass; formatting, deny-warnings lint, and diff checks pass.

@clawsweeper

clawsweeper Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@joeykrug thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

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

Labels

agents Agent runtime and tooling merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safeguard compaction ignores compaction.model config — uses session model instead

2 participants