Skip to content

feat(agentsapi): preserve native output and tool history - #156182

Merged
sjf-oa merged 5 commits into
mainfrom
sjf/agentsapi-output-parity
Sep 24, 2026
Merged

sjf-oa merged 5 commits into
mainfrom
sjf/agentsapi-output-parity

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

OpenClaw needs to present Agents API native activity through the same output and history contracts used by its other harnesses. Sharing presentation operations lets the adapter keep native protocol handling without duplicating transcript and callback policy.

What Problem This Solves

Agents API command output, commentary, reasoning summaries, saved session state, and billed usage must reach the host consistently during streaming and recovery. This PR wires those native records into the shared projection operations merged in #156187 and sits before the tools and file-transfer layers.

Changes

  • Project native commands, tool records, commentary, reasoning summaries, and environment progress with stable native identities.
  • Reconcile saved turn history and settle output callbacks under the current attempt owner.
  • Preserve usage observed for admitted turns when final REST accounting is empty or partial. Canonical records replace matching turn contributions without double counting.
  • Keep the current native web-search default, model/key fingerprint, and MVP input contract when moving below the later tools and file-transfer PRs.
  • Add focused projection accounting tests and update existing native-session fixtures to supply authoritative saved turn records.

Evidence

Independent source review of the lower-stack implementation and approved usage fix is clean. The shared refactor retains its relocated output-formatting tests beside their owner.

The current published head is 69b99db14f9eaa27a49efd84a5ff1d55a77bfeaa, rebased onto main after #156187 merged. All five wiring commits replay patch-identically; the Agents API and shared projection source bytes match the tested bdcbcab846d5c18e91ed1a8953ab65dcc72e19c9. Current-head CI is green, with all 42 selected checks passing. Its six Node test shards took 3 minutes 35 seconds from first start to last completion, with 18 minutes 8 seconds summed runtime and a longest shard of 3 minutes 35 seconds.

Validation on the pre-rebase implementation:

  • The two usage regressions fail against the previous accounting loop and pass with the fix.
  • Projection tests pass (3 tests, 32.386 seconds wall for pnpm test extensions/agentsapi/agentsapi-messages.test.ts --maxWorkers=1, including cold compiler preparation; test bodies total 10 milliseconds).
  • Existing session receipt/cancellation tests pass (3 tests, 4.111 seconds wall for pnpm test extensions/agentsapi/agentsapi-session.test.ts --maxWorkers=1).
  • Agents API lint, production and extension-test type checks, line-cap guard, and full dependency checks pass.
  • Independent source review reports no actionable P0-P2 findings.

Pre-rebase CI is green. Its six Node test shards took 1 minute 49 seconds from first start to last completion, with 7 minutes 3 seconds summed runtime and a longest shard of 1 minute 43 seconds.

Fresh real Docker/Slack proof used a native Linux/arm64 image built from bdcbcab846d5c18e91ed1a8953ab65dcc72e19c9, with runtime/UI compilation and actual bundled-plugin loading verified. The packaged Slack plugin required its standalone package-local dependency layout; the correction preserved source and dependency pins. No mocks, fakes, or direct native input bypasses were used.

  • An ordinary Slack turn created a hosted Linux VM session, executed a real successful shell command, delivered the final response, and settled native and Gateway state.
  • A second real command exited with status 23. Native state, normalized tool failure, the persisted result, and the delivered Slack final agreed. Each persisted tool call/result appeared once, and repeated history reads were identical.
  • A Slack /stop reached a running VM command. Actual native output contained its running marker, the command failed with exit status 130, the native session became idle, one error tool result was persisted, and Slack delivered the stopped result. The Gateway reported no active run.
  • A follow-up Slack message steered a running command within the same native root turn. The original command completed once, the native turn included the updated instruction, Slack delivered the updated final, and the session settled.
  • Actual before/after screenshots and 24 genuine thread readbacks verified five italic preview states at one timestamp, a separate plain final, and preview removal. The full commentary-content case failed because model-written prose included exit/status metadata. The lifecycle pass does not erase that failure.
  • Successful canonical usage and cache accounting were observed. Empty/partial final REST accounting is protected by the regressions above; the live run did not induce a REST accounting failure.

Additional real Docker/Slack proof ran on the current published 69b99db14f9eaa27a49efd84a5ff1d55a77bfeaa head, using a separate native Linux/arm64 Gateway and fresh state:

  • An ordinary Slack setup and command reused one hosted Linux VM session. The command's genuine START and DONE output deltas arrived 59.975 seconds apart and it completed with exit 0.
  • Native records, the normalized stream, and durable history agree on one command call/result pair, two commentaries, one final response, and one usage record. Repeated durable reads were byte-identical, with no duplicate idempotency keys. The actual Slack final was delivered once.
  • Both per-turn and whole-session usage match native accounting. The command turn recorded 21,384 uncached input tokens, 103,264 cached input tokens, and 1,009 output tokens, totaling 125,657. Active context size remains unavailable.
  • The native session returned to idle, the Gateway turn settled, pending inputs and delivery queues were empty, and the Gateway process had no restart.
  • Another fresh session completed one command with genuine START and DONE deltas 60.102 seconds apart. Native and durable accounting agreed on 124,462 tokens (21,245 uncached input, 101,926 cached input, and 1,291 output). It persisted one call/result pair, one final, and one usage record, delivered one Slack final, and settled with empty queues and the same Gateway process.
  • A separate fresh setup completed successfully but persisted zero token counts, while later native session, turn-list, and turn-retrieve reads agreed on 57,858 tokens. The terminal usage and final REST accounting snapshots during settlement were not retained, so the cause remains unresolved. This limits the live accounting claim to the matching command case above.

An additional current-head recovery run used a separate native Linux/arm64 Docker Gateway, fresh state, the configured default model, and ordinary Slack input:

  • After the native command was admitted and its genuine START output arrived, a one-shot operator physically destroyed the Gateway's accepted TLS/HTTP/1 event-stream socket while the real VM command was running. One replacement stream received HTTP 200 1.183 seconds after observed socket closure. The Gateway process and native binding remained unchanged; no input replay, cancellation, or Gateway restart was used.
  • The same native command completed once with exit 0 after 61.873 seconds and contained both output markers. Native saved records, normalized events, and durable history agree on one command call/result pair, two commentary records, one final, and one positive usage row. Repeated transcript reads were byte-identical with no duplicate idempotency keys, and Slack delivered one final.
  • Command accounting matches native turn usage: 1,770 uncached input + 102,130 cached input + 1,123 output = 105,023 tokens. Setup accounting also matches at 57,662 tokens; the session total is 162,685. Both turns completed, the native session became idle, the Gateway turn settled, the binding retained no lease, and all persistent-work counts were zero.
  • Direct setup snapshots show null terminal-event and normal REST usage, then positive cleanup REST usage 1.708 seconds after the completed normal REST snapshot. That later accounting was persisted correctly. This records a real late-availability case without attributing the earlier unexplained zero-usage settlement.
  • The command's primary usage observer stopped at admission with capture_validation_failure, and an auxiliary read-only subscriber captured START but ended before DONE. Command completion and accounting are therefore established by canonical native REST records, normalized events, durable history, and Slack delivery, rather than missing observer snapshots.

Limits: an earlier command's early stdout was absent from both native saved work and its observed stream; the current-head runs above separately prove actual streamed START and DONE delivery. Two nonempty reasoning summaries from the earlier interrupted turn are persisted once, but the default Gateway history response filters them through shared heartbeat presentation logic; a separate proposed correction is awaiting approval. The fresh current-head runs returned only empty reasoning summaries. The earlier zero-usage settlement remains unexplained because its original terminal/final REST snapshots were not retained. Live tests did not induce a final REST accounting failure; the focused regressions cover empty and partial reads. ClawSweeper's latest review identified no actionable code or security findings and dropped the conditional historical null-ID concern because no reachable legacy-session path or such row was established.

@clawsweeper

clawsweeper Bot commented Sep 23, 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 extensions: codex extensions: agentsapi size: XL labels Sep 23, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-output-parity branch from 83be6a4 to df05b1a Compare September 23, 2026 04:53
@sjf-oa
sjf-oa changed the base branch from sjf/agentsapi-tools-files to sjf/agentsapi-shared-projection September 23, 2026 04:53
@openclaw-barnacle openclaw-barnacle Bot removed agents Agent runtime and tooling extensions: codex labels Sep 23, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-output-parity branch from df05b1a to a18a434 Compare September 23, 2026 05:02
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 12:12 AM ET / 04:12 UTC (Revision 8).

ClawSweeper review

What this changes

The Agents API plugin projects native command activity, commentary, reasoning, saved tool history, and token usage into OpenClaw chat output and transcripts, including after a stream reconnect.

Merge readiness

✅ Ready for maintainer review

Keep open: current main has the shared projection prerequisite but does not provide this Agents API behavior. The current-head admitted-turn disconnect evidence addresses the previous proof blocker, and this review found no concrete introduced defect.

Priority: P2
Reviewed head: 69b99db14f9eaa27a49efd84a5ff1d55a77bfeaa

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Detailed current-head native recovery evidence and focused regressions support a coherent patch, with an isolated accounting observation documented but not attributed to this change.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The Agents API plugin's changed stream and saved-history projection was exercised on the pinned head through an ordinary Slack turn on a native Linux/arm64 Docker Gateway. The reported admitted-turn socket disconnect, successful resubscription, single completed command and final delivery, byte-identical transcript reads, and matching native and Gateway accounting cover the prior recovery gap. One earlier zero-usage setup remains unexplained without its settlement snapshots. The PR changes transcript contents through existing message contracts, with no stored schema change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The Agents API plugin's changed stream and saved-history projection was exercised on the pinned head through an ordinary Slack turn on a native Linux/arm64 Docker Gateway. The reported admitted-turn socket disconnect, successful resubscription, single completed command and final delivery, byte-identical transcript reads, and matching native and Gateway accounting cover the prior recovery gap. One earlier zero-usage setup remains unexplained without its settlement snapshots. The PR changes transcript contents through existing message contracts, with no stored schema change.
Evidence reviewed 9 items Current main still lacks this projection: The current-main message projector handles assistant text and a final reply; the new native tool and transcript modules are absent there.
Reconnect owner: An admitted turn resubscribes after a transport disconnect, then reconciles saved state without resubmitting input.
Durable session boundary: Transcript appends require a matching host-prepared session target and recheck current ownership at the append boundary.
Findings None None.
Security None None.

How this fits together

The Agents API plugin sends configured OpenAI turns to a hosted native session and receives streamed events and saved records. It turns those records into Gateway output callbacks and durable OpenClaw transcript entries.

flowchart LR
A[Chat input] --> B[Gateway run]
B --> C[Agents API plugin]
C --> D[Hosted session]
D --> E[Stream and saved records]
E --> F[Projection and reconciliation]
F --> G[Chat output and transcript]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2070, Tests +302, Docs +39. Total +2411 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 7 2396 326 +2070
Tests 2 313 11 +302
Docs 1 43 4 +39
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 2752 341 +2411

Review metrics

Metric Value Why it matters
Production and test growth production +2,070 net lines; tests +302 net lines The plugin-owned native projection and reconciliation account for the production growth; the added tests target usage and session receipts.

Root-cause cluster

Relationship: canonical
Canonical: #156182
Summary: The merged shared-projection refactor is a prerequisite, while this PR owns the distinct Agents API wiring.

Members:

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

Technical review

Best possible solution:

Agents API turns should retain one coherent live and durable record per native item across completion, cancellation, and reconnect, while reporting usage that is available at settlement.

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

Not applicable to this feature PR. The submitted current-head Docker and Slack runs give a concrete after-change behavior path; this read-only review did not run the plugin.

Is this the best way to solve the issue?

Yes. The plugin retains native protocol handling and uses the already merged shared projection contracts, avoiding a second core presentation owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 86c2919245f7.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This improves an explicitly selected plugin runtime with a limited user blast radius.
  • merge-risk: 🚨 session-state: The PR reconciles native saved records into durable transcripts, where identity or ordering errors could affect session history; current-head reconnect proof exercises the central path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The Agents API plugin's changed stream and saved-history projection was exercised on the pinned head through an ordinary Slack turn on a native Linux/arm64 Docker Gateway. The reported admitted-turn socket disconnect, successful resubscription, single completed command and final delivery, byte-identical transcript reads, and matching native and Gateway accounting cover the prior recovery gap. One earlier zero-usage setup remains unexplained without its settlement snapshots. The PR changes transcript contents through existing message contracts, with no stored schema change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The Agents API plugin's changed stream and saved-history projection was exercised on the pinned head through an ordinary Slack turn on a native Linux/arm64 Docker Gateway. The reported admitted-turn socket disconnect, successful resubscription, single completed command and final delivery, byte-identical transcript reads, and matching native and Gateway accounting cover the prior recovery gap. One earlier zero-usage setup remains unexplained without its settlement snapshots. The PR changes transcript contents through existing message contracts, with no stored schema change.

Evidence

What I checked:

Likely related people:

  • sjf-oa: 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-09-23T05:11:03.045Z sha a18a434 :: needs real behavior proof before merge. :: [P1] Redact command titles before publishing native events | [P2] Preserve native ordering when appending commentary and tool history | [P2] Update the receipt fixture for canonical turn admission
  • reviewed 2026-09-23T05:57:40.583Z sha c378fc9 :: needs real behavior proof before merge. :: [P1] Redact command titles before publishing native events | [P2] Preserve native ordering when appending commentary and tool history | [P2] Update the receipt fixture for canonical turn admission
  • reviewed 2026-09-23T07:15:40.058Z sha c378fc9 :: needs real behavior proof before merge. :: [P1] Redact command titles before publishing native events | [P2] Preserve native ordering when appending commentary and tool history | [P2] Update the receipt fixture for canonical turn admission
  • reviewed 2026-09-23T09:54:42.813Z sha 8d6057c :: needs real behavior proof before merge. :: [P1] Accept legacy user-message IDs during history reconciliation | [P2] Retain observed usage when the final REST read fails | [P2] Update the receipt fixture for canonical turn admission
  • reviewed 2026-09-24T00:39:19.493Z sha bdcbcab :: blocked before merge. :: [P1] Accept null IDs on legacy saved user messages
  • reviewed 2026-09-24T01:20:49.513Z sha bdcbcab :: blocked before merge. :: [P2] Accept nullable historical user IDs before parsing saved history
  • reviewed 2026-09-24T03:26:41.917Z sha 69b99db :: blocked before merge. :: none

@sjf-oa

sjf-oa commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Real Slack presentation captures for public implementation c378fc9. These use different fixtures: the earlier failed readiness attempt, a fresh italic commentary marker while its command was active, and a plain final answer. They establish rendered presentation only. Steering, cancellation, reconnect, and usage acceptance are not established by these screenshots.

Earlier failed readiness attempt:

Earlier failed readiness attempt

Commentary delivered during a live command:

Italic commentary during a live command

Plain final answer:

Plain final answer

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 23, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-shared-projection branch from 69216a4 to 6568fc5 Compare September 23, 2026 07:24
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-output-parity branch from c378fc9 to 61cb8a0 Compare September 23, 2026 07:32
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-shared-projection branch from 6568fc5 to 1b8e97a Compare September 23, 2026 07:32
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 23, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-shared-projection branch from 1b8e97a to ca34ddd Compare September 24, 2026 00:10
sjf-oa pushed a commit that referenced this pull request Sep 24, 2026
ClawSweeper: "Retain observed usage when the final REST read fails"
#156182 (comment)

Merge final REST usage with observed usage by admitted turn ID. Canonical
records replace matching contributions, while omitted turns keep observed
usage and repeated accounting does not double count them.
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-output-parity branch from 8d6057c to 5f5c49f Compare September 24, 2026 00:18
sjf added 5 commits September 23, 2026 18:28
ClawSweeper: "Retain observed usage when the final REST read fails"
#156182 (comment)

Merge final REST usage with observed usage by admitted turn ID. Canonical
records replace matching contributions, while omitted turns keep observed
usage and repeated accounting does not double count them.
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-output-parity branch from bdcbcab to 69b99db Compare September 24, 2026 01:28
@openclaw-barnacle openclaw-barnacle Bot removed agents Agent runtime and tooling extensions: codex labels Sep 24, 2026
@sjf-oa

sjf-oa commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR body now contains real Docker/Slack evidence from the published 69b99db14f9eaa27a49efd84a5ff1d55a77bfeaa head, including streamed command output, exactly-once durable records, native accounting comparisons, and settled sessions. Current-head CI is green. The observed-usage repair and its regressions remain separate commits.

Please assess the updated evidence and stated limits. A separate setup persisted zero usage while later native reads reported nonzero usage; the settlement snapshots were not retained, so the cause is unresolved. The disconnect checks aborted before reservation or injection, and reconnect remains unverified. The conditional null-ID historical-user finding is still unapplied while the maintainer considers it. No external-session import or attachment path exists, and no such record was observed in these plugin-created sessions.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 24, 2026
@sjf-oa

sjf-oa commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR evidence now includes a successful real admitted-turn disconnect on current head 69b99db14f9eaa27a49efd84a5ff1d55a77bfeaa, using a fresh native Linux/arm64 Docker Gateway and ordinary Slack input.

After genuine native command admission and START output, the Gateway's accepted TLS/HTTP/1 SSE socket was physically destroyed once. One replacement stream received HTTP 200 1.183 seconds after observed closure. The same VM command completed once with exit 0 after 61.873 seconds. Native saved records, normalized events, and durable history agree on one call/result pair, two commentary records, one final, and one positive usage row; repeated reads were byte-identical and Slack delivered one final. Command usage matches native accounting at 105,023 tokens, setup at 57,662, and session total at 162,685. Native is idle, both turns completed, the Gateway settled, the binding has no lease, and all persistent-work counts are zero. The test Slack connection was released after settlement while retaining the Gateway process.

Direct setup snapshots show null terminal-event and normal REST usage followed by positive cleanup REST usage 1.708 seconds after the completed normal REST snapshot; that positive accounting persisted correctly. This does not establish the cause of the earlier unexplained 57,858-token setup discrepancy. Its original settlement snapshots remain unavailable.

Capture limits are documented: the command's primary usage observer stopped at admission, and an auxiliary native reader captured START but ended before DONE. Completion and usage rely on canonical native REST records, normalized events, durable history, and actual Slack delivery, rather than unavailable observer snapshots. No REST accounting failure was induced; empty/partial accounting regressions protect the approved fix.

Please review the updated proof and remaining accounting limit. No further source changes were made, and exact-head CI remains green.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 24, 2026
@sjf-oa
sjf-oa merged commit 4c40118 into main Sep 24, 2026
156 of 159 checks passed
@sjf-oa
sjf-oa deleted the sjf/agentsapi-output-parity branch September 24, 2026 04:18
@sjf-oa

sjf-oa commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…6182)

* feat(agentsapi): project native output and reconcile saved history

* fix(agentsapi): retain observed usage after accounting read failures

ClawSweeper: "Retain observed usage when the final REST read fails"
openclaw#156182 (comment)

Merge final REST usage with observed usage by admitted turn ID. Canonical
records replace matching contributions, while omitted turns keep observed
usage and repeated accounting does not double count them.

* test(agentsapi): cover projection usage and authoritative session receipts

* refactor(agentsapi): keep projection implementation helpers module-local

* test(agentsapi): use the projection factory and preserve fixture types

---------

Co-authored-by: Sarah Fortune <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: agentsapi 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: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

2 participants