Repository navigation
feat: restore task-boundary and cache-expiry compaction - #178485
roboclaw-bot wants to merge 42 commits into
Conversation
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: cabd1eb8-7cdd-4522-a0a5-042ad4e95f2b
Co-authored-by: VACInc <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: b80c0191-135e-4d2f-9dcd-6a228badcc82
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 0926a3ae-bc63-4a08-9407-abacc4b45137
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: f2b38c57-608a-405f-8fc5-20188ba12b52
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 2e785763-9c85-42f6-8a0f-59b5f3c118b8
Restore the feature from #178021 after #178425 while preserving current main and the existing branch history. The merged tree matches applying the inverse of f1689ee to e4ac046. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 026cc808-7ab1-4f32-83eb-2925c2ffaa64
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesThis PR restores agent-requested session compaction and adds optional idle compaction five minutes before eligible cache windows end. Example: An opted-in session completes a request using an accepted 12-hour OpenAI Responses cache lifetime.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it restores useful optional compaction capabilities absent from current main, and no actionable introduced defect was found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe embedded agent runner records compaction requests and cache observations; existing recovery and session-maintenance owners consume them to checkpoint and compact the current transcript. flowchart TD
A[Agent tool request] --> C[Embedded runner]
B[Qualified cache observation] --> C
C --> D[Settled tool boundary]
C --> E[Optional maintenance timer]
D --> F[Existing compaction owner]
E --> F
F --> G[Current session transcript]
Technical reviewBest possible solution: Retain the optional plugin and one-shot timer on the existing compaction, admission, and maintenance owners. Do we have a high-confidence way to reproduce the issue? This is a feature restoration; source inspection confirms current main lacks the restored tool capability and cache-expiry scheduler. Is this the best way to solve the issue? The implementation follows the capability ladder: an optional plugin requests work, while existing host owners retain authority, transcript writing, recovery, and cancellation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1989e3dc4360. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +775, Tests +1001, Docs +163, Config +10, Generated 0, Other +10. Total +1959 across 71 files. Added test files: 7. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (10 earlier review cycles; latest 8 shown)
Reviewed October 20, 2026, 9:01 PM ET / October 21, 2026, 01:01 UTC (Revision 11). |
Bind the captured repair method to its owning health check before the progress callback invokes it. Preserve arguments, asynchronous results and existing error handling. Add a receiver-dependent regression that fails before the repair. Resolves the inherited unbound-method CI error from #178767 without changing compaction behavior. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: f0f0f180-2f20-4e54-8d75-66bbed51cedc
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge pinned main 45f9aed to resolve the actual conflict with #178695. Preserve its API request policy and pricing. Share the model predicate and lifetime resolver, forward prepared TTL policy to settlement, and schedule qualified 12-hour windows at 11h55m. Keep 30m, one-hour, short-window exclusion and the separate built-in OAuth heuristic unchanged. Co-authored-by: VACInc <[email protected]>
Merge pinned main 510249a after the prepublication conflict check found only generated config artifacts in conflict. Regenerate through the canonical owner and preserve the reviewed OpenAI lifetime integration byte-for-byte. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 768211d6-c9d1-4287-97fa-77de809fe078
Share the watchdog-aware clock helper from the unlimited maintenance test with the finite-budget cases. Their completed foreground and checkpoint work must report semantic progress before the real watchdog samples the synthetic clock jump. Keep every timeout, remaining-budget, expiry, and delivery assertion unchanged. Extends the fixture repair extracted from PR #178485 in e4340c2.
Merge pinned main 6f8ca36 after the hosted conflict check exposed its independently landed receiver regression. Retain the upstream equivalent test and remove only our duplicate. Both Doctor production and test files now match upstream; the reviewed cache lifetime integration is unchanged. Agent types and 28 Doctor/embedded-maintenance tests pass on the composition. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 595873d0-03da-489f-9f10-18a26bb2b8b1
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Repair the stale creation-notice fixture after #178493 without changing production provenance or authorization policy. Exercise autonomous agent creation, human isolation without a human requester, and explicit causal-human attribution. Preserve exact stored identity and required-sandbox assertions. Full file and provenance siblings pass on Node; the affected file passes on Bun. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 5cf48bac-e24e-458d-a7ff-4eab0f2f22b3
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
PR #178493 (3097cee) separated the public causal creator from the stored isolation actor. A human isolation identity alone no longer proves that a human initiated a spawned session. This single-file test hunk mirrors PR #178485 byte-for-byte. Cover agent creation, human isolation without a human initiator, and retained causal human attribution while preserving exact storage and sandbox assertions. Production code is unchanged. Proof: repository wrapper, one worker, passes under both Bun and Node. Targeted Gateway test types, typed lint, formatting and independent P2 review pass.
Extracted byte-identically from PR openclaw#178485.
Share the watchdog-aware clock helper from the unlimited maintenance test with the finite-budget cases. Their completed foreground and checkpoint work must report semantic progress before the real watchdog samples the synthetic clock jump. Keep every timeout, remaining-budget, expiry, and delivery assertion unchanged. Extends the fixture repair extracted from PR openclaw#178485 in c11a2be.
PR openclaw#178493 (2f32b4a) separated the public causal creator from the stored isolation actor. A human isolation identity alone no longer proves that a human initiated a spawned session. This single-file test hunk mirrors PR openclaw#178485 byte-for-byte. Cover agent creation, human isolation without a human initiator, and retained causal human attribution while preserving exact storage and sandbox assertions. Production code is unchanged. Proof: repository wrapper, one worker, passes under both Bun and Node. Targeted Gateway test types, typed lint, formatting and independent P2 review pass.
Restores #178021 after #178425. Related: #6757.
What Problem This Solves
Long conversations need optional compaction at useful task boundaries and before eligible cache windows end, without repeatedly compacting short-lived caches.
User Impact
Agents can request task-boundary compaction, and operators can opt into one idle pre-expiry attempt. Every eligible window leaves a five-minute lead: 30 minutes → 25 minutes; one hour → 55 minutes; an effective 12-hour Responses TTL → 11 hours 55 minutes. Windows of five minutes or less never trigger this timer.
The timer remains disabled by default and respects
compaction.enabled: false. Foreground activity cancels pending work; a later successful eligible turn can arm a fresh timer. Maintenance never rearms itself. Normal context-pressure compaction, manual compaction, prompt caching, and model-requested compaction retain their existing behavior.Subscription scope: ChatGPT/Codex OAuth through the built-in OpenClaw runtime may use an explicitly assumed 30-minute idle window, giving a 25-minute idle trigger. This is labeled
codex-idle-heuristic, not a verified Codex TTL. Native Codex app-server and generic CLI timers are not enabled. In particular, the native standalone compact RPC cannot carry the admitted turn generation required by ChatGPT subscription sharing; this change does not bypass that guard or silently switch runtimes.Compaction costs inference and can lose detail; cache hits or savings are not guaranteed. No live configuration was changed and no paid-provider cache experiment was run.
Why This Change Was Made
The existing scheduler now applies one five-minute margin instead of its previous one-minute maximum. Existing API qualification stays intact: effective one-hour Anthropic markers and qualified direct OpenAI minimum windows still require successful cache activity. The new subscription estimate also requires positive cache usage, OAuth, the canonical
openaiprovider, and the official HTTPS ChatGPT Responses backend. Unknown providers, aliases, and custom backends receive no assumed lifetime.Provider-backed estimates retain request-start timing. The subscription heuristic starts at observed completion of model activity, so generation time is not mislabeled idle time. Existing selection, credentials, configuration, compaction-count, foreground, delivery, and lifecycle checks retain ownership of cancellation and admission.
The original restoration and earlier CI repairs remain in history. The earlier conflict refresh used
bead2a8e542740f943fe57e8391e5e6c11e9773d. After the inventory repair, GitHub reported a new actual conflict. A history-preserving merge of pinned main1bd22b28d632ba4082e923d88a2485be61f8c8afresolved it: the only textual conflicts were the generated config count/hash artifacts, regenerated by their owner. Main’s tool-inheritance refactor and removal of its unused development dependency were preserved. The five-minute classifier, timer, maintenance runtime, and authored behavior docs are byte-identical across this refresh. No unrelated API-retention setting was changed.CI then exposed a stale dependency entry in the restored plugin: main already requires TypeBox 1.3.37, while its manifest and importer still named 1.3.36. The three-line repair aligns those entries with the existing main pin. The lockfile was regenerated from the verified valid main graph; every other importer, package, and snapshot remains unchanged. No dependency policy was weakened.
Evidence
Inherited creation-notice fixture only: CI job 118970499842 exposed an expectation predating feat: attribute delegated work to the initiating human #178493. That landed contract keeps the original isolation actor but projects the separately captured causal creator; a human isolation actor alone does not prove human initiation. The unchanged fixture reproduced the failure locally. The repaired fixture covers autonomous agent, human isolation without a human requester, and explicitly retained causal-human attribution; exact persisted-actor and required-sandbox assertions remain. No production identity, authorization, or compaction code changed. All 21 tests across the affected file and three provenance siblings pass on Node (58.95 s); the affected file also passes on Bun (11.84 s). Targeted Gateway test types, type-aware lint, format and diff checks pass; independent P0–P2 review is scoped-clean.
Landed API-lifetime integration: the actual conflict with feat(openai): opt into 12-hour prompt caching #178695 was resolved by merging pinned main
45f9aed4ef6831def7ac483ca5acf2ed1bf7fc93. Its request fields, defaults, compatibility rules and pricing are preserved. The model-version predicate is shared, and optional idle compaction consumes the same lifetime resolver with the prepared request policy. Qualified direct Responses requests using12hnow schedule at 11h55m, not 25m. Completions do not inherit this Responses-only option; the built-in OAuth assumption stays separately labeled 30m/25m. Unknown endpoints and short windows remain excluded.Cross-contract proof: 175 tests across nine complete files passed in 128.75 s, covering request builders, pricing, parameter precedence, classifier, settlement forwarding, scheduler boundaries, prefix stability and embedded-command maintenance. Three new policy cases failed before the fix. Targeted agent/package test types, nine-file lint, formatting, two-file MDX, canonical config/inventory checks, frozen install and diff checks passed. The complete candidate received a clean independent P0–P2 review against the pinned main.
Generated-baseline composition: a prepublication check found new conflicts only in generated config baselines. A second history-preserving refresh pinned
510249a88634dd3e8562bfb467abe9a2052d9af5; both canonical generators were run and checked. The reviewed cache-policy implementation remained byte-identical. Final agent types, all 16 session-prompt-state tests and all three source-built isolated-Gateway scenarios passed (236.99 s combined; Gateway test file 22.50 s). An earlier Gateway attempt failed before collecting tests because Rolldown panicked; a bounded single-thread compiler invocation passed without changing source or disabling a gate. No paid-provider experiment was used.Narrow inherited Doctor repair: check-lint-core-2 found an unbound repair method introduced on main by fix(doctor): show progress while checks and repairs run #178767. The affected file was byte-identical to pinned main; a fresh upstream check found no later fix. Capturing the method with
.bind(check)preserves its original receiver without changing arguments, asynchronous results, progress, dry-run or error handling. One receiver-dependent owner regression fails before the repair and passes afterward. Focused lint now reports zero errors; formatting, the owning test-type shard and diff checks pass. The relevant Doctor invocation passed 19 tests, with 10 Windows-only tests skipped on Linux (50.61 s). Independent P0–P2 Auto Review is scoped-clean. That repair did not change installation, live state, provider or compaction policy; it is retained through the later API-lifetime integration.Generated inventory repair: complete retained logs for exact-head jobs check-docs and baseline ratchets identify the same stale inventory output. The canonical check reproduced it on
0ea0dad834d3. Runningpnpm plugins:inventory:genregenerated all inventory/reference outputs; the complete diff is only core plugins 73 → 74 and reference pages 174 → 175.pnpm plugins:inventory:checknow passes—the identical failing gate used by both jobs. Config-doc drift/count validation, two-file MDX validation, andgit diff --checkalso pass. No generated content was patched by hand, and the five-minute/runtime behavior is unchanged.Composed-head validation: 77 tests across the tool-search preparation consumer (19), prompt-prefix stability (5), classifier (33), and scheduler (20) passed in 94.00 s. Targeted agent test types passed. All three isolated-Gateway scenarios passed again (22.77 s test-file duration; 263.76 s including current-source preparation). Full frozen installation, both canonical generators and drift checks, and diff checks passed. These runs validate the incoming tool-inheritance contract with the retained compaction binding; they are not paid-provider TTL or native Codex timer proofs.
Earlier dependency admission: the exact frozen-lockfile mismatch from the build-artifacts job was reproduced locally. After repair, both frozen graph validation and the full
pnpm install --frozen-lockfilepass with supply-chain policies unchanged. This was a PR integration defect, not an infrastructure retry.Earlier dependency-repair proof: 59 affected tests passed on the reconciled install, using TypeBox 1.3.37: classifier/route guards (33), scheduler (20), prompt-prefix stability (5), and the plugin capability consumer (1). Targeted agent test types also pass. The focused invocation took 61.76 s.
Earlier dependency-repair Gateway proof: requested compaction before continuation without replay, disabled configuration, and rejected-summary recovery. Test-file duration: 22.08 s; full invocation: 223.67 s including current-source runtime preparation. These are runtime/non-regression proofs, not native Codex timer or paid-provider TTL proofs.
Initial feature proof: 122 tests across seven full files passed before the dependency repair, including the complete embedded-command maintenance consumer, coordinator, defaults schema, and config-baseline integration. Nine intended timing/heuristic failures reproduced the previous behavior before implementation. These earlier results retain their original input binding; they are not relabeled as final-head CI.
Fake-clock proof checks 25-minute and 55-minute boundaries, immediately before and at admission, short-window exclusion, disabled/unset opt-in, global disable, active foreground cancellation, fresh scheduling after activity, and no self-rescheduling. The cross-expiry fixture explicitly configures its existing six-minute work budget for a deliberate five-minute-ten-second clock jump; no production timeout increased.
Incremental TypeScript/docs lint, formatting, two-file MDX validation, config generation/drift/count checks, and diff checks passed. The generated lockfile is validated by pnpm rather than hand-formatted. Fresh independent P0–P2 Auto Review is scoped-clean for both the timing change and the final three-line install repair.
Retained compaction proof binding: tested composition
4f2e5da4be4c3868aa13edbcac570f787cb3c92b, published headf79498d7dbcfb93088c533f88a27b40913535106, identical tree83fdecfa36803750f3b95692dec866d4660f9975. The publication commit changes no files. The complete inventory repair is in70b1beb6eb6f; the conflict-only refresh preserves it and adds main’s changes plus canonical config-baseline outputs. Earlier dependency proof remains bound to1c5726231bf2/ tree41988c47ccac8c233088ac8d51fed7a029a92d49; timing implementation remains in6195ece47dd4.Retained Doctor binding: tested Doctor repair
f0efa49ec9476698564acddf6a6101a61c134635, published head0af8b98821ffb037733f0c62ed835859ecce13f0, identical tree59d4d6af5580491d76a4aaa0907a36d7913bcbaa. The publication marker changes no files. At that head, only the Doctor repair owner and its regression differed fromf79498d7dbcf; those 77-test and three-Gateway results retain their earlier source binding.API-integration proof binding: integration commit
d78f8ae85ecfc24f55540cedb9e3a8ce606b727a/ tree8fb5d0b4b502710589c19fe76bef6328e5c48d21; final tested composition380d6f54d42bfc010144fb839441f615789cdb2f, published headc6d77dc2d88979d272f1ba09367db4bd07e72a1e, identical treef81dba71e9379f42c136a094d28f74ea5dd745f3. The publication marker changes no files.Retained conflict-reconciliation binding: main independently landed the Doctor receiver fix and equivalent regression. The later actual conflict was resolved by merging pinned main
6f8ca36775f92b8d7f2c3983ae31668a23b33ef3, retaining its test rather than duplicating it. Doctor production/test files now match that upstream exactly. The reviewed cache integration remains byte-identical. Agent types, all 28 Doctor/embedded-maintenance tests (55.18 s), canonical config/inventory checks and diff checks pass on tested commit6c09f98ca6dc2a7f09c2cc09188cfca116c25e8c. Published headf47d6aa29124679494019523fb73a48ac5485680has the identical tree9285cbc3264d7cd72e91a47743a849cdf8d5e900; its publication marker changes no files. The preceding 175-test and Gateway results retain the specific bindings above.Current test-only binding: tested commit
ce2a595a5d6722d61143c909c652dead784d8410, published headaa1883da081b2a5006c4f815e451b8523b8464bb, identical treee3f3ed24b2b0d94da1fcb4cb0bb30efdece3dc5c. Onlysrc/gateway/server.sessions.create-notices.test.tsdiffers fromf47d6aa29124; all prior runtime proof retains its stated source binding. The publication marker changes no files.Exact-head hosted CI and ClawSweeper completion remain separate requirements. New-head CI timing remains pending. The PR is left unmerged.
@VACInc requested and guided this restoration. The imported X fixture correction was authored by @steipete in #177556; its original commit authorship is preserved.
Worked on by
Work sessions