Skip to content

fix(agents): only a request that cannot fit may fail a turn - #200714

Merged
obviyus merged 4 commits into
mainfrom
fix/context-pressure-owner
Nov 17, 2026
Merged

obviyus merged 4 commits into
mainfrom
fix/context-pressure-owner

Conversation

@obviyus

@obviyus obviyus commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #200483. Thanks @fuller-stack-dev for finding this and for the first fix; this PR applies the same rule to every route that had the bug.

The rule

Only a request that cannot fit the model window may fail a turn. Any other context-pressure signal only schedules maintenance, and maintenance runs only at a boundary where the current tool batch can continue.

What was wrong

Five independent paths stopped or failed a turn on a reserve-based soft threshold even when the request still fit:

Path Before After
Mid-turn check (checkMidTurnPrecheck, #73499/#168338/#190017) soft threshold → MidTurnPrecheckSignal → recovery; a failed compaction surfaced "Auto-compaction failed" maintenance only at a settled boundary; send otherwise
Prompt preflight (attempt-prompt-preflight) reserve budget → precheck failure overflow only when over the window
ChatGPT V2 fallback (#168401) soft fallback threw even while tool calls were pending soft fallback only at a settled boundary
Reply pre-turn compaction (runSessionCompactionIfNeeded, #49479/#130863) failed threshold compaction failed the turn fails only if the prompt cannot fit
CLI post-turn compaction (cli-compaction) failed threshold compaction failed the command fails only if the next prompt cannot fit

Production evidence (gateway logs, 2026-11-16..17): 79 context-pressure stops across team-metal (62), Peanutto (15) and HamVerBot (2). 44 were soft-threshold stops whose request fit the window. Every stop was logged as an embedded_run_agent_end context_overflow failure.

Fix

src/agents/context-pressure.ts is the single owner:

request > window maintenance due boundary safe declined this run decision
yes any any any overflow (recovery may fail the turn)
no yes yes no maintenance (compact, always continue)
no yes yes yes send
no yes no any send (deferred)
no no any any send
  • A boundary is safe when every tool call has a result, no tool item is active, no tool started background work, no Code Mode run is parked (its wait is bound to the session that compaction may rotate), and no approval prompt is waiting.
  • MidTurnPrecheckRequest.pressure and preflightRecovery.pressure are required, so recovery cannot turn maintenance into a failed turn.
  • Maintenance that cannot reduce context is declined for the rest of the run, so it is not retried at every request.
  • Maintenance stops are no longer logged as context_overflow agent failures, nor as livenessState=blocked.

Evidence

Real-model E2E, openai/gpt-6.1-sol (272k window, 204k client threshold, responsesServerCompaction: false). A 182k-token seed turn, then four sequential exec calls; the soft check fires at an estimated 211.6k tokens with the batch settled.

Journey base 237e3e4fe0d1 head
settled batch; client compaction has nothing to summarize turn failed: "Auto-compaction failed before the next model request. Try again or run /compact." (kind=compaction_failure) turn completed: HERON-5521, 0493 (correct); log pressure=maintenance → [context-maintenance] declined … continuing
settled batch; compaction model unavailable turn failed, same text turn completed: HERON-5521, 0493

Head runs use a dist built from a69e3de; base is a dist of 237e3e4fe0d1 (ocx base merge-base). Raw stderr and replies are below.

Base also logged embedded run agent end … failoverReason=context_overflow for each; head logged none.

Captured E2E output (openclaw agent --local, gpt-6.1-sol; head built from a69e3de)

base / settled:

[agent/embedded] embedded run agent end: runId=24267729-7e73-44ec-a958-c2707d0a10ee isError=true model=gpt-6.1-sol provider=openai failoverReason=context_overflow
[agent/embedded] [context-overflow-midturn-precheck] sessionKey=agent:main:explicit:cp-base-settled-1794935543 provider=openai/gpt-6.1-sol route=compact_only estimatedPromptTokens=211627 promptBudgetBeforeReserve=204000 overflowTokens=7627 toolResultReducibleChars=0 effectiveReserveTokens=68000
[agent/embedded] auto-compaction failed for openai/gpt-6.1-sol: Nothing to compact (session too small)
[agent/embedded] [context-overflow-recovery] exhausted context budget recovery for openai/gpt-6.1-sol; livenessState=blocked suggestedAction=retry_or_compact kind=compaction_failure
reply: Auto-compaction failed before the next model request. Try again or run /compact. Completed tool actions were not replayed; verify their effects before retrying.

head / settled:

[agent/embedded] [context-overflow-midturn-precheck] sessionKey=agent:main:explicit:cp-head-settled-1794939550 provider=openai/gpt-6.1-sol pressure=maintenance route=compact_only estimatedPromptTokens=211634 promptBudgetBeforeReserve=204000 overflowTokens=7634 toolResultReducibleChars=0 effectiveRes
[agent/embedded] auto-compaction failed for openai/gpt-6.1-sol: Nothing to compact (session too small)
[agent/embedded] [context-maintenance] declined for openai/gpt-6.1-sol; continuing the turn without maintenance reason=Auto-compaction failed before the next model request: Nothing to compact (session too small)
reply: HERON-5521, 0493

base / compaction-fails:

[agent/embedded] embedded run agent end: runId=18c1d475-1d68-4a67-8c06-84ddfa1cd557 isError=true model=gpt-6.1-sol provider=openai failoverReason=context_overflow
[agent/embedded] [context-overflow-midturn-precheck] sessionKey=agent:main:explicit:cp-base-compaction-fails-1794935543 provider=openai/gpt-6.1-sol route=compact_only estimatedPromptTokens=211644 promptBudgetBeforeReserve=204000 overflowTokens=7644 toolResultReducibleChars=0 effectiveReserveTokens=6
[agent/embedded] auto-compaction failed for openai/gpt-6.1-sol: Unknown model: openai/gpt-0-does-not-exist. Run `openclaw models list --refresh --provider openai` to inspect this provider's model choices, then retry with a model supported by your account.
[agent/embedded] [context-overflow-recovery] exhausted context budget recovery for openai/gpt-6.1-sol; livenessState=blocked suggestedAction=retry_or_compact kind=compaction_failure
reply: Auto-compaction failed before the next model request. Try again or run /compact. Completed tool actions were not replayed; verify their effects before retrying.

head / compaction-fails:

[agent/embedded] [context-overflow-midturn-precheck] sessionKey=agent:main:explicit:cp-head-compaction-fails-1794939609 provider=openai/gpt-6.1-sol pressure=maintenance route=compact_only estimatedPromptTokens=211637 promptBudgetBeforeReserve=204000 overflowTokens=7637 toolResultReducibleChars=0 eff
[agent/embedded] auto-compaction failed for openai/gpt-6.1-sol: Unknown model: openai/gpt-0-does-not-exist. Run `openclaw models list --refresh --provider openai` to inspect this provider's model choices, then retry with a model supported by your account.
[agent/embedded] [context-maintenance] declined for openai/gpt-6.1-sol; continuing the turn without maintenance reason=Auto-compaction failed before the next model request: Unknown model: openai/gpt-0-does-not-exist. Run `openclaw models list --refresh --provider openai` to inspect this provider's m
reply: HERON-5521, 0493

Historical replay of all 79 recorded stops through the new owner:

Old (all 79 stopped as context_overflow) New
44 soft-threshold stops 42 maintenance (turn continues), 2 send (open exec batch)
35 over-window stops 35 overflow (unchanged)

Some of the 35 over-window stops are estimator artifacts after a model switch (e.g. 1,084,694 estimated vs 229,033 measured). That is a separate estimator bug, tracked as a follow-up.

Tests

  • context-pressure.test.ts: every combination of the decision inputs (48 cases), the fix(agents): never fail a turn on the soft compaction threshold #200483 example (206k on 272k/204k), window and boundary predicates.
  • Mid-turn admission table: soft rows now assert maintenance at a settled boundary; new rows cover "soft pressure, open tool batch" (sends) and "over window, open tool batch" (overflow).
  • Fault injection in recovery: maintenance continues the turn when compaction is unavailable, guard-blocked, timed out, or removes nothing; an over-window request still surfaces the failure.
  • ChatGPT V2: a request over the client threshold and inside the window, with an open tool batch, is sent instead of falling back.
  • CLI post-turn compaction: failures fail the command only over the window (existing failure cases now use an over-window session); an under-window failure continues; cancellation still propagates.
  • All src/agents/embedded-agent-runner vitest projects, plus reply memory and CLI compaction suites, pass.

obviyus and others added 2 commits November 17, 2026 22:47
Context pressure had several independent deciders. The mid-turn check, the
prompt preflight, the ChatGPT V2 fallback, reply-level pre-turn compaction and
CLI post-turn compaction each stopped or failed a turn on a reserve-based soft
threshold, even when the request fit the model window. On team-metal, Peanutto
and HamVerBot, 44 of 79 recorded stops in two days were soft-threshold stops.

src/agents/context-pressure.ts is now the single owner, with one decision table:
- request > window: "overflow"; recovery may still fail the turn
- soft pressure at a settled tool boundary: "maintenance"; compact, then always
  continue the turn, whatever the compaction outcome
- soft pressure with an open tool batch: send now and defer
- maintenance that cannot reduce context is declined for the rest of the run

The mid-turn signal and preflight recovery now carry a required `pressure`, so
recovery can no longer turn maintenance into a failed turn. Maintenance stops
are no longer logged as `context_overflow` agent failures.

Supersedes #200483. Thanks @fuller-stack-dev for the report and the first fix.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 17, 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 the scripts Repository scripts label Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

The PR separates optional context maintenance from hard overflow so fitting requests can continue when compaction fails.

Example: A settled tool batch produces an estimated 211,600-token request in a 272,000-token window with a 204,000-token maintenance threshold.

  • Before: Failed compaction ends the turn with compaction-failure guidance.
  • After: Maintenance is declined and the fitting request continues.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Reported real-model results support the central repair, but two runtime defects and diff-caused CLI test failures prevent readiness.
Proof confidence 🐚 platinum hermit (4/6) Maintainer authorship places this PR outside the contributor proof gate; the body reports real-model Gateway continuation after declined and unavailable compaction, with successful recall and maintenance log excerpts.
Patch quality 🦪 silver shellfish (2/6) 4 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Long tool turns fail with compaction or overflow guidance even when the next request fits the model window.
Reason: The production reports establish a concrete interruption, the source confirms its routing, and maintainer authorship supplies the direction decision.

Merge readiness

⛔ Needs changes before merge - 4 items remain

Keep open: this maintainer-authored PR addresses a source-confirmed false-overflow failure still present on main, but cancellation handling, lifecycle classification, and the affected CLI tests need repair.

Priority: P1
Reviewed head: 9405533dd4e25748d886c0a1986455f3e6250ac0

Before merge

  • Preserve caller cancellation when declining CLI maintenance (P2) - When the caller aborts during compaction, the existing compaction catch converts that abort into failureReason. The new window condition suppresses it for a fitting request, and execution reaches the successful session-entry return without another cancellation check. Exact-head CI demonstrates this at 950 tokens in a 1,000-token window: cli-compaction.test.ts:203 receives successful resolution instead of the cancellation error. Preserve caller cancellation independently of token pressure on both native and context-engine outcome paths.
  • Exclude maintenance from lifecycle error classification (P2) - A maintenance signal still has stopReason="error", so isError remains true. Excluding it only from this block leaves derivedWorkingTerminalState="blocked" and causes emitLifecycleTerminal to publish an error field containing "LLM request failed." because lifecycleErrorText was never populated. Thus a fitting request entering maintenance still emits a blocked, error-bearing lifecycle event while recovery continues. Handle the maintenance classification throughout this lifecycle owner rather than only suppressing its warning log.
  • Update the affected CLI maintenance expectations (P2) - The changed policy deliberately resolves ordinary below-window compaction failures, but the existing CLI tests still require rejection for unsuccessful compaction, missing native results, and watchdog timeout. Exact-head CI fails at cli-compaction.test.ts:267, :683, and :783, with an additional unhandled rejection from the timeout assertion. Update those cases to verify fitting-request continuation and retained resume state, while preserving rejection coverage for hard overflow and caller cancellation.
  • Explain or restore the original intent of CLI cancellation and lifecycle preservation - 2dff1c3: The CLI orchestration refactor explicitly preserved authority and lifecycle behavior; treating caller cancellation as successful maintenance is not explained by this PR.

Findings

  • [P2] Preserve caller cancellation when declining CLI maintenance — src/agents/command/cli-compaction.ts:583-586
  • [P2] Exclude maintenance from lifecycle error classification — src/agents/embedded-agent-subscribe.handlers.lifecycle.ts:381-382
  • [P2] Update the affected CLI maintenance expectations — src/agents/command/cli-compaction.test.ts:267-269

Provenance

  • CLI cancellation and lifecycle preservation changes intended behavior without addressing why it exists (2dff1c3: The CLI orchestration refactor explicitly preserved authority and lifecycle behavior; treating caller cancellation as successful maintenance is not explained by this PR.)
  • Transcript continuation history: original intent not found (3366d2c: Deferred transcript projection must settle before session reopening; the older implementation could not be expanded locally because historical objects were unavailable, while current continuation calls remain in place.)

Tests

  • Low-value test src/agents/context-pressure.test.ts: Remove the standalone 206k unsafe-boundary example: the preceding exhaustive table already exercises the identical inputs and expected send decision.
Agent review details

How this fits together

The agent runner combines projected request size with tool-settlement evidence to choose normal inference or compaction recovery, while reply and CLI maintenance handle their surrounding lifecycle boundaries.

flowchart TD
  A[Prepared model request] --> B[Request pressure estimate]
  C[Tool settlement evidence] --> D[Context pressure decision]
  B --> D
  D --> E[Normal inference]
  D --> F[Compaction recovery]
  F --> E
Loading

Technical review

Best possible solution:

Keep the shared pressure decision, preserve cancellation independently of token size, normalize maintenance throughout lifecycle publication, and align the existing CLI regressions.

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

Current main routes reserve-threshold pressure into fallible overflow recovery, and the body supplies matching base-versus-head Gateway results; this read-only review did not execute the reproduction.

Is this the best way to solve the issue?

Sharing the pressure verdict across the existing compaction owners is appropriate, but optional maintenance must preserve cancellation and avoid publishing provider-failure lifecycle facts.

Full review comments:

  • [P2] Preserve caller cancellation when declining CLI maintenance — src/agents/command/cli-compaction.ts:583-586
    When the caller aborts during compaction, the existing compaction catch converts that abort into failureReason. The new window condition suppresses it for a fitting request, and execution reaches the successful session-entry return without another cancellation check. Exact-head CI demonstrates this at 950 tokens in a 1,000-token window: cli-compaction.test.ts:203 receives successful resolution instead of the cancellation error. Preserve caller cancellation independently of token pressure on both native and context-engine outcome paths.
    Confidence: 1
  • [P2] Exclude maintenance from lifecycle error classification — src/agents/embedded-agent-subscribe.handlers.lifecycle.ts:381-382
    A maintenance signal still has stopReason="error", so isError remains true. Excluding it only from this block leaves derivedWorkingTerminalState="blocked" and causes emitLifecycleTerminal to publish an error field containing "LLM request failed." because lifecycleErrorText was never populated. Thus a fitting request entering maintenance still emits a blocked, error-bearing lifecycle event while recovery continues. Handle the maintenance classification throughout this lifecycle owner rather than only suppressing its warning log.
    Confidence: 0.99
  • [P2] Update the affected CLI maintenance expectations — src/agents/command/cli-compaction.test.ts:267-269
    The changed policy deliberately resolves ordinary below-window compaction failures, but the existing CLI tests still require rejection for unsuccessful compaction, missing native results, and watchdog timeout. Exact-head CI fails at cli-compaction.test.ts:267, :683, and :783, with an additional unhandled rejection from the timeout assertion. Update those cases to verify fitting-request continuation and retained resume state, while preserving rejection coverage for hard overflow and caller cancellation.
    Confidence: 1
  • [P3] Inline the single-use preflight failure branch — src/auto-reply/reply/memory-flush.ts:104-109
    settleFailedPreflightCompaction has one caller and only checks the shared window predicate before returning its input unchanged. It introduces a generic exported wrapper without an independent responsibility. Inline the window check and throw at the existing failure branch in agent-runner-memory.ts, followed by return entry.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Request admission and compaction recovery changes intended behavior with a stated reason (e0ed68c: Start maintenance before exhausting the window while retaining nominal hard admission and current request accounting; subsequent recovery changes preserved meaningful compaction failures.)
  • ChatGPT V2 fallback keeps the original intent (8589115: Trigger V2 earlier without moving the client threshold or sending an over-window request; the PR preserves that trigger and explains deferring unsafe soft fallbacks.)
  • Reply pre-turn maintenance changes intended behavior with a stated reason (17cc94a: Continue replies when byte compaction declines; this PR extends nonfatal maintenance to fitting token-pressure cases while retaining the existing session target.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/command/cli-compaction.test.ts src/agents/embedded-agent-subscribe.handlers.lifecycle.test.ts
  • pnpm test src/agents/embedded-agent-runner/run.overflow-context-recovery.test.ts src/agents/embedded-agent-runner/run/attempt-midturn-precheck.test.ts src/agents/embedded-agent-runner/run/chatgpt-v2-compaction.test.ts
  • pnpm check:changed --base 237e3e4

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e0ed68c adds src/agents/embedded-agent-runner/run/attempt-setup.ts:445 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e0ed68c7b845; files: src/agents/embedded-agent-runner/run/attempt-setup.ts)
  • Ayaan Zaidi: Raw commit 8589115 adds src/agents/embedded-agent-runner/run/chatgpt-v2-compaction.ts:127 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8589115803e7; files: src/agents/embedded-agent-runner/run/chatgpt-v2-compaction.ts)
  • marchpure: Raw commit b85147f adds src/agents/pi-embedded-runner/run/midturn-precheck.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b85147ff7615; files: src/agents/pi-embedded-runner/run/midturn-precheck.ts)
  • Vito Cappello: Raw commit 7b39a82 adds src/agents/embedded-agent-runner/run/midturn-precheck.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7b39a827fef3; files: src/agents/embedded-agent-runner/run/midturn-precheck.ts)

PR surface

Source +296, Tests +235, Other +2. Total +533 across 38 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 19 366 70 +296
Tests 17 250 15 +235
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 0 +2
Total 38 618 85 +533

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: canonical
Canonical: #200714
Summary: This PR explicitly broadens the earlier mid-turn soft-threshold repair to the other compaction entry points.

Members:

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

Labels

Label changes:

  • add P1: Reported production tool turns repeatedly fail despite fitting the model window, interrupting active agent workflows.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P1: Reported production tool turns repeatedly fail despite fitting the model window, interrupting active agent workflows.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 12:49 PM ET / 17:49 UTC.

A parked Code Mode run is bound to its session, and compaction may rotate the
session, so a boundary with a parked run is not safe for maintenance. CLI
post-turn maintenance now honours cancellation before continuing.

Co-authored-by: obviyus <[email protected]>
@obviyus
obviyus merged commit fb9337a into main Nov 17, 2026
133 checks passed
@obviyus
obviyus deleted the fix/context-pressure-owner branch November 17, 2026 18:31
@obviyus

obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as fb9337a. Bug: five paths stopped or failed turns on the soft compaction threshold even when the request fit the window (44 of 79 production stops in two days). Fix: one owner, context-pressure.ts. Only an over-window request can fail a turn; soft pressure compacts at a settled tool boundary and always continues. Proof: real gpt-6.1-sol runs where base failed the turn and head answered correctly, a replay of all 79 stops, and fault-injection tests. Thanks @fuller-stack-dev for #200483.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…#200714)

Context pressure had several independent deciders that stopped or failed a turn on a reserve-based soft threshold even when the request fit the model window: the mid-turn check, prompt preflight, the ChatGPT V2 fallback, reply pre-turn compaction and CLI post-turn compaction.

src/agents/context-pressure.ts is now the single owner. Only a request larger than the window may fail a turn. Soft pressure compacts only at a settled tool boundary (no pending, active, background or parked Code Mode work) and always continues the turn; maintenance that cannot reduce context is declined for the rest of the run.

Real-model E2E on gpt-6.1-sol (272k window, 204k threshold): base failed the turn with "Auto-compaction failed"; head completed with the correct answer in both journeys. Replay of 79 production stops: 44 soft-threshold stops now continue.

Supersedes openclaw#200483. Thanks @fuller-stack-dev.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 18, 2026
Staging route 1 for openclaw#129388 (staging only; no PR ref move).
Upstream main b894fe5 (fetched 2026-11-18T19:00Z),
merge base 9122a49 (the chain's own absorb). 42 conflicted paths, all resolved
here; rerere replayed none.

Agent schema: upstream 703c82d (openclaw#200533) owns 43 (pending-input endings) and 44 is
free in this tree, so continuation's recipient authority moves 43 -> 44:
- SQLite owner runs upstream's 43 step, then the idempotent authority step;
- PostgreSQL ladder: 42 tool usage, 43 endings (from V42), 44 authority (from V43);
- backup scopes 43 session_pending_inputs (upstream), 44 session_recipient_authority;
- port descriptor pin 44, historical 27-43; witness admits upstream's 43;
- the fleet bridge classifies 38-43; it admits only upstream's own 43 there, so the
  never-deployed chain 43 (upstream 42 + authority) is refused before any write;
- jump-14 42 (the fleet on ab5a30e) now runs upstream's 42 and 43, then authority;
- package schemaVersions.agent 44; agent-schema-history doc rows 42/43/44 and the
  authority section (the chain had left it at 42).

One owner where upstream now owns a fork extraction:
- session-restart-resume: upstream's resolveStartupRestartMarker (openclaw#201060) replaces
  the fork's session-restart-resume-marker.ts (deleted); the fork's tombstone early
  return stays ahead of upstream's interrupted-settle check.
- user-turn-transcript: upstream's applyUserTurnReplacementText replaces the fork's
  byte-identical applyPersistedUserTurnReplacementText (deleted).
- migration witness: upstream's agentSchemaVersions (+43) replaces the fork's
  AGENT_WITNESS_SCHEMA_VERSIONS.
- session-event delivery: the fork's #1447 cron failure-copy withholding moves into
  upstream's createSessionEventReplyDelivery; session-event-handoff equals upstream.

Other resolutions keep both sides (import unions checked against real uses; upstream
openclaw#200533 marker shape `{}`, end causes, lifecycleRestartScope; fork restart tombstones
and operator recovery). attempt.cwd-split.test.ts follows upstream's deletion
(openclaw#198916); its one fork case moves to attempt.continuation-tools.test.ts.
Generated outputs regenerated (config docs, gateway validators, postgres schema,
worker inventory). Compile follow-through: compactionTarget.storePath (openclaw#200714) and
two fork test cleanups pass upstream's new finishPendingInput end cause.

Refs: openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 18, 2026
…route the rehomed attempt case

- agent-runner.continuation-postcompaction-autocompaction: upstream
  openclaw#200714 (fb9337a) fails a turn on a failed preflight compaction only
  when the request cannot fit the context window. The "required
  compaction's failure" case now crosses the 200k window (still fails,
  delegate staged), and a new case pins the fitting request that proceeds
  with the delegate still staged. Red at 8e63e3d (expected the failure
  copy at 150k), green here.
- attempt.continuation-tools.test.ts (rehomed from upstream's deleted
  cwd-split suite) has no `vi` of its own, so the classifier routed it to
  unit-fast-isolated, where the attempt harness has no host owner ("Agent
  admission requires its host owner"). It joins the host-broker list.

Refs: openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
…rk fixtures

Compile and behavior follow-through for upstream APIs the merge brought in,
each red on ddd0ec7 and green here:
- sessions-spawn-cloud: upstream's new paired-device case (openclaw#197469) mocks
  registerRun as void; the fork's registration returns ownership, so the mock
  returns a committed-row ownership (tsgo agents-tools TS2322; 16/16).
- finishPendingInput now takes an end cause (openclaw#200533): the fork's recorder
  case and transcript-events case pass "failed" (tsgo other TS2554).
- postcompaction-autocompaction: upstream's SessionMaintenanceRequest needs
  sourceTarget/sourceIdentities (prepareSessionMaintenanceRequest), so the
  command case prepares the request before scheduling (TS2739); the
  pressure-handoff report supplies the four subtrees upstream interns
  (openclaw#199748; 10 cases "snapshot is not an Object" without it, from chain
  47edd05); and the required-compaction-failure case crosses the 200k
  window with a new fitting-request case for openclaw#200714's fit-only preflight
  failure (from staging ead2225; red at 150k without it). 13/13.

(cherry picked from commit 47edd05)
Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…#200714)

Context pressure had several independent deciders that stopped or failed a turn on a reserve-based soft threshold even when the request fit the model window: the mid-turn check, prompt preflight, the ChatGPT V2 fallback, reply pre-turn compaction and CLI post-turn compaction.

src/agents/context-pressure.ts is now the single owner. Only a request larger than the window may fail a turn. Soft pressure compacts only at a settled tool boundary (no pending, active, background or parked Code Mode work) and always continues the turn; maintenance that cannot reduce context is declined for the rest of the run.

Real-model E2E on gpt-6.1-sol (272k window, 204k threshold): base failed the turn with "Auto-compaction failed"; head completed with the correct answer in both journeys. Replay of 79 production stops: 44 soft-threshold stops now continue.

Supersedes openclaw#200483. Thanks @fuller-stack-dev.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>

Release adaptation: Reviewed soft pressure safe-boundary maintenance and preserved overflow protections. Includes final unchanged memory/gateway helper extractions needed by cap.

(cherry picked from commit fb9337a)

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
Context pressure had several independent deciders that stopped or failed a turn on a reserve-based soft threshold even when the request fit the model window: the mid-turn check, prompt preflight, the ChatGPT V2 fallback, reply pre-turn compaction and CLI post-turn compaction.

src/agents/context-pressure.ts is now the single owner. Only a request larger than the window may fail a turn. Soft pressure compacts only at a settled tool boundary (no pending, active, background or parked Code Mode work) and always continues the turn; maintenance that cannot reduce context is declined for the rest of the run.

Real-model E2E on gpt-6.1-sol (272k window, 204k threshold): base failed the turn with "Auto-compaction failed"; head completed with the correct answer in both journeys. Replay of 79 production stops: 44 soft-threshold stops now continue.

Supersedes #200483. Thanks @fuller-stack-dev.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fb9337a)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 28703d8fbcd79dd6cfb5a82aea5ca3b370862590)
(cherry picked from commit 5050a8b2af18d68a2e2c509819387206ca1a002a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant