Repository navigation
feat: expose auditable agent decision traces ENG-16854 - #80
Conversation
|
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
There was a problem hiding this comment.
40 issues found across 3000 files
Not reviewed (too large): apps/ios/Resources/Localizable.xcstrings (~206,862 lines), apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift (~18,841 lines), apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatViewModelTests.swift (~11,859 lines), .agents/skills/autoreview/scripts/autoreview (~10,656 lines), apps/ios/Sources/Model/NodeAppModel.swift (~9,508 lines), apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt (~7,930 lines), apps/ios/Tests/NodeAppModelInvokeTests.swift (~7,490 lines), apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt (~5,295 lines), apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt (~4,755 lines), apps/shared/OpenClawKit/Tests/OpenClawKitTests/GatewayNodeSessionTests.swift (~3,257 lines), and 13 more - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/android/app/src/main/assets/katex/README.md">
<violation number="1">
P0: All 20 WOFF2 font files in `fonts/` are 95-byte placeholders containing "This is a placeholder file. The original file was not fetched due to sparse-checkout settings.", but this README lists 20 distinct SHA-256 hashes as if they were real KaTeX fonts pulled from the v0.17.0 release archive. At runtime the Android WebView will fail to load any of these placeholder fonts, making rendered math invisible or broken. Either fetch the real WOFF2 fonts from the KaTeX release or update the README to document that the font files are placeholders and note the rendering impact.</violation>
<violation number="2">
P1: The SHA-256 hash documented for `renderer.js` does not match its actual file content. The README claims `3cefe6fba565e189311b29265eb842484a637e1a80b0b5e766ab05bfc9ad452f` but the actual hash is `491dca76d2ef60676c5ac91675d76bc19f840b030f8b3c4df32cf6ef88431741`. Update the README hash to match the committed file so the checksum table is trustworthy.</violation>
</file>
<file name=".github/codex/prompts/maturity-scorecard-agent.md">
<violation number="1">
P1: The `$claw-score` skill referenced in the goal and step 1 does not exist in the codebase. No skill definition, registration, or `skills/` directory is present, and no other agent prompt uses a `$skillName` pattern. The agent will fail at its first required step. Replace the `$claw-score` reference with either explicit inline instructions or a concrete `pnpm` command (like the other agent prompts do), and remove the `$`-prefixed skill pattern unless a matching skill definition is also added.</violation>
<violation number="2">
P2: Step 4 uses the vague instruction 'Run the QA Lab maturity score validation used by this repository' instead of a concrete `pnpm` command. The actual validation script is `pnpm maturity:check`. Other agent prompts consistently use explicit `pnpm` commands. Using a concrete command name makes the agent workflow more reliable and reduces search overhead.</violation>
</file>
<file name=".github/workflows/website-installer-sync.yml">
<violation number="1">
P1: install.sh Docker test will hang or fail — the `--no-prompt --no-onboard` flags and their corresponding env vars were removed, but the script needs at least one form to run non-interactively in CI. The install-cli.sh test in the same job keeps both, so the inconsistency looks unintentional. Add back `--no-prompt --no-onboard` flags (or the env vars) to the install.sh command.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/NodeApp.kt">
<violation number="1">
P1: A quick reconnect after pressing Disconnect can be torn down by this stale asynchronous stop task: the task looks up the current singleton when it executes, not the runtime that existed when STOP was requested. Associating the task with a stop generation (or cancelling/invalidating it when RESUME/connect begins) would prevent a prior stop from disconnecting a new connection.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/voice-call-channel.md">
<violation number="1">
P2: Category Scope items are all placeholder text `Voice Call Channel` with no actual scope descriptions. Scorers cannot evaluate channel-setup, access, routing, media, or realtime-voice coverage from this rubric. Replace each item with specific, evaluable scope entries matching the pattern used by every other rubric in this directory (e.g. `agent-runtime-and-provider-execution.md`, `android-app.md`, `anthropic-provider-path.md`).</violation>
</file>
<file name=".github/workflows/dependency-guard.yml">
<violation number="1">
P1: Retargeting a PR can change its dependency diff without updating the head, but this workflow does not listen for the `edited` activity used for base-branch changes. The guard can therefore retain a result computed against the old base; including `edited` would re-evaluate the PR (with any needed filtering for unrelated title/body edits).</violation>
<violation number="2">
P2: The guard executes trusted checker scripts from the event's base SHA, which can be stale for an older PR event and may omit the current `dependency-guard.mjs` or its fixes. The repository already uses `github.workflow_sha` for this exact stale-base risk, so the three guard checkouts should use that trusted workflow revision instead.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/gateway/ChatSendAck.kt">
<violation number="1">
P1: `chatSendAckHistorySinceSeconds` stops tracking history only for terminal success, but terminal failures (timeout, error) also stop the ack's lifecycle. Using `isTerminal` instead of `isTerminalSuccess` prevents wasted computation against a dead ack.</violation>
</file>
<file name=".agents/skills/openclaw-docker-e2e-authoring/SKILL.md">
<violation number="1">
P2: The verification section tells authors to run `OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:<lane>` but `OPENCLAW_SKIP_DOCKER_BUILD` is not referenced anywhere in the codebase — no script or config reads it, so setting it has no effect. If the intent is to skip the Docker build during iteration, either wire up the env var in the relevant scripts, or remove it from the documentation.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayCustomHeaders.kt">
<violation number="1">
P2: Case-variant header names are not deduplicated, so configurations such as `Authorization` plus `authorization` send multiple values for one HTTP field and can be interpreted differently by the reverse proxy. Treat header names case-insensitively and reject or deterministically collapse collisions before adding them to the request.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/discord.md">
<violation number="1">
P2: Unclosed backtick before `sessions_spawn({`: the opening backtick has no matching close, so everything that follows on this line renders as inline code. Close the span after the function signature to keep the rubric readable.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/google-chat.md">
<violation number="1">
P2: Duplicate scope items make the rubric ambiguous — a scorer would not know whether the second occurrence carries extra weight or is accidental. Remove the trailing duplicate.</violation>
<violation number="2">
P2: Duplicate scope items bloat the rubric and make scoring ambiguous — a reviewer would not know whether the second occurrence adds weight or is accidental. Trim the duplicated tail starting from the second 'Account resolution' so each scope item appears once.</violation>
</file>
<file name=".github/actions/docker-e2e-plan/action.yml">
<violation number="1">
P2: Claude live lanes can authenticate with `CLAUDE_CODE_OAUTH_TOKEN`, but this check does not accept that credential, so OAuth-only jobs fail validation before running. Include `CLAUDE_CODE_OAUTH_TOKEN` in the Anthropic alternatives.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/gateway/NetworkMonitor.kt">
<violation number="1">
P2: A network loss racing the initial snapshot can leave the monitor permanently believing the dead network is validated, so the next real network restore will not trigger either gateway session's reconnect. The seed needs to be coordinated with callback updates (for example, revalidate the snapshot after registration/state updates or serialize seeding and callback delivery) so a stale active network cannot be re-added after `onLost`.</violation>
</file>
<file name=".github/actions/setup-android-toolchain/action.yml">
<violation number="1">
P2: A replaced or compromised archive at the download endpoint would be installed and executed as `sdkmanager` without verification, so this action is not fully reproducible despite describing a pinned toolchain. Verifying the archive against a committed SHA-256 (or trusted signature) before `unzip` would prevent an unexpected toolchain from entering CI.</violation>
</file>
<file name=".agents/skills/technical-documentation/agents/openai.yaml">
<violation number="1">
P2: Both icon_small and icon_large reference ./assets/icon.jpg but the icon file does not exist at the resolved path. Without the asset, the agent UI will show a broken or missing icon. Add the icon file or correct the path.</violation>
</file>
<file name="apps/android/app/src/debug/java/ai/openclaw/app/ui/CanvasLifecycleTestActivity.kt">
<violation number="1">
P2: presentHtml() measures elapsed time synchronously around controller.navigate() and show(), but WebView navigation and JavaScript execution are asynchronous. presentSlowPage() returns a value essentially identical to presentFastPage() because the 2s busy-wait runs on the WebView's JS thread, not the calling thread. This makes the returned Long misleading — tests that expect a timing difference between slow and fast page presentation will get false passes or confusing failures. Consider providing a callback- or suspend-based variant that waits for page load completion before measuring.</violation>
</file>
<file name=".github/workflows/sticky-disk-cleanup.yml">
<violation number="1">
P2: Cleanup depends on undocumented runner-side `BLACKSMITH_ENV`/`BLACKSMITH_REGION` variables that this workflow never provisions, so on a runner without that custom environment contract every allowlisted deletion fails validation (and an ARM runner is misclassified as amd64). Using the guaranteed `RUNNER_ARCH` for architecture and explicitly selecting or provisioning a region-specific runner/region value would make the safety check deterministic.</violation>
</file>
<file name=".crabbox.yaml">
<violation number="1">
P2: The `prewarm` job runs `command: "true"` (instant no-op) with `stop: never`, so the VM hydrates, runs nothing, and is never reclaimed. If the prewarm trigger fires more than once, each cycle leaves an idle Azure D4ads_v6 instance running indefinitely, wasting compute credits until manual cleanup.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayStoreMigration.kt">
<violation number="1">
P2: Legacy device authentication is lost for device IDs or roles containing `.` because this guard leaves the old key unmigrated, while the new `DeviceAuthStore` never reads that unscoped key. Migrating the complete suffix (or parsing it with the known key-segment rules) would preserve those valid entries.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/native-windows-companion-app.md">
<violation number="1">
P2: Windows architecture handling lists only x64 but omits ARM64, which is a growing Windows platform (Snapdragon X Elite, Surface Pro 11, Surface Laptop 7). A native companion app scored against this rubric could receive full completeness marks for architecture handling while missing ARM64 support, which is a meaningful gap for a native Windows app.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/mattermost-line-irc-nextcloud-talk-nostr-twitch-tlon-synology-chat.md">
<violation number="1">
P2: Media and Rich Content scope list appends a duplicate trailing block (Tlon/Urbit ship URL/code setup through Rich text conversion). Remove the repeated entries.</violation>
<violation number="2">
P2: Conversation Routing and Delivery scope list appends a duplicate trailing block (Nextcloud Talk through Rich text conversion). Remove the repeated entries.</violation>
<violation number="3">
P2: Access and Identity scope list appends a duplicate trailing block (Synology Chat through Rich text conversion). Remove the repeated entries.</violation>
<violation number="4">
P2: Channel Setup and Operations scope list appends a duplicate trailing block of entries (Nextcloud Talk through Rich text conversion). Remove the repeated entries so each capability appears once.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/node/JpegSizeLimiter.kt">
<violation number="1">
P2: Configuring `maxQualityAttempts` to 0 now throws from `checkNotNull(best)` before returning a result, because this refactor removed the unconditional initial encode and does not validate the attempt count. Preserving one initial encode or rejecting non-positive attempt counts would keep the failure explicit and compatible with the previous behavior.</violation>
</file>
<file name=".agents/skills/release-openclaw-ci/scripts/verify-provider-secrets.mjs">
<violation number="1">
P2: When Anthropic returns headers before the deadline but its body stalls, aborting the JSON parse is swallowed here and the preflight reports `invalid_response` instead of `timeout`. Let `AbortError` reach the outer catch while retaining malformed-JSON as `invalid_response`, so release diagnostics identify the actual failure.</violation>
<violation number="2">
P2: A typo such as `--timeout-ms=nope` turns `timeoutMs` into `NaN`, and Node treats that as an immediate timer, so valid provider calls are reported as timeouts instead of rejecting the invocation. Validating a finite positive timeout before making requests would keep release failures actionable.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/imessage-bluebubbles.md">
<violation number="1">
P2: Duplicate items in Channel Setup and Operations list: the first 7 items are repeated at the end after Account Config. Remove the trailing duplicate block so the list stays deduplicated and scorable.</violation>
<violation number="2">
P2: Duplicate items in Native Controls and Approvals list: Native Actions, Private API, Message Tool are listed twice. Remove the trailing repeat.</violation>
<violation number="3">
P2: Duplicate items in Access and Identity list: Group Policy, Mentions, System Prompts are listed twice. Remove the repeated 3 items at the end.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/chat/ChatQuestion.kt">
<violation number="1">
P2: An unrecognized gateway status is currently treated as actionable pending state, which can show Submit/Skip and send `question.resolve` for a terminal or newly introduced status. Handling `"pending"` explicitly and failing closed for unknown statuses would prevent accidental mutation of records the client does not understand.</violation>
</file>
<file name=".agents/skills/claw-score/references/completeness/ios-app.md">
<violation number="1">
P2: Distribution scope only covers internal preview status; the Android rubric covers both public and manual install paths plus release smoke/startup performance, and watchOS covers public/support status and release metadata. If the iOS app ships through the App Store or will do so, the scoring rubric won't reflect that distribution path. Consider adding App Store release, release validation, and startup performance items.</violation>
</file>
<file name="apps/android/THIRD_PARTY_LICENSES/openclaw/licenses/AndroidX Wear.txt">
<violation number="1">
P2: The Apache 2.0 warranty disclaimer is truncated — the final sentence `See the License for the specific language governing permissions and limitations under the License.` is missing. The file currently ends mid-disclaimer. Every other Apache 2.0 attribution file in this directory (both full-text and abbreviated formats) completes the disclaimer with this closing clause. Consider appending it for consistency and proper attribution.</violation>
</file>
<file name=".github/actions/detect-docs-changes/action.yml">
<violation number="1">
P2: Markdown fixture changes now report `docs_changed=false` even though the action's output contract says any `.md`/`.mdx` change sets it true. Keeping the fixture as `non_docs` for `docs_only` is compatible with the contract if this branch also sets `docs_changed=true`; otherwise the output description should explicitly document the exclusion.</violation>
</file>
<file name="apps/android/app/src/main/java/ai/openclaw/app/node/NodeUtils.kt">
<violation number="1">
P2: Canvas eval replies can be malformed JSON when the evaluated value contains a tab, backspace, form feed, or another JSON control character; this new KDoc claims `toJsonString` always returns a JSON string literal despite the incomplete escaping. Escaping the full JSON control range, or using a standard JSON quoting/serialization helper, would make the documented contract true.</violation>
</file>
<file name=".agents/skills/technical-documentation/agents/governance-agent.md">
<violation number="1">
P2: Return section omits 'policy drift' as an explicit output, even though the description, goals, and orchestration guidance in SKILL.md all name it as a core concern. Add a policy-drift output line so the agent's contract matches what orchestration expects.</violation>
</file>
Note: This PR contains a large number of files. cubic only reviews up to 200 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
|
Cubic review feedback (#4792931953) audited against exact head The live PR contains 19 changed files (+583/-5). The review's 40 findings reference unrelated paths outside this PR diff and came from a wrong-base/~3,000-file comparison, so they require no changes in this PR. There are no inline review threads to resolve on the actual changed surface. |
Follow-up: bound trace array counts on the producer (rare-but-drops-reply)Traced the boon-core rejects (HTTP 400) any Why it matters: anychat's callback loop ( Severity: low likelihood (needs >128 tool calls in one run), high impact when it fires. Tracking as a follow-up rather than blocking this PR. Fix (producer-side, ~1 line): const MAX_TRACE_ITEMS = 128; // must stay <= boon-core AUDIT_TRACE_MAX_ITEMS
const toolInvocations = (params.toolSummary?.invocations ?? []).flatMap(...).slice(0, MAX_TRACE_ITEMS);
const visibleTools = normalizeNames(params.toolSummary?.visibleTools).slice(0, MAX_TRACE_ITEMS);
// evidence derives from toolInvocations, so it inherits the capBelt-and-suspenders option: have boon-core truncate to 128 instead of 400 — an oversized cosmetic field should never cost the user their reply. This is the concrete bite of the already-flagged "128/240 limits duplicated across Ruby and TS with no shared constant" nit — the producer simply doesn't enforce the count half. |
Port of #80 onto the `boon` release branch. #80 merged to `main` (the upstream mirror) by mistake and can't reach the fleet from there; `boon`'s run/ layer is structured differently so this is a manual re-port, not a cherry-pick. Wire contract (enums/keys/schemaVersion/decision ladder) is byte-identical to #80 and matches boon-core's validator (getboon/boon#13591). Also folds in the >128 array count-cap follow-up (MAX_TRACE_ITEMS=128) that #80 lacked, so an oversized trace can't trigger a boon-core 400 that drops the whole reply. Slack: delivered as a trailing standalone "How this was verified" context message (boon has no segment reply model; appending blocks would demote the answer text to fallback-only). Flagged for review. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Fidelity-audit finding vs #80: boon's normalizeToolMetas sits between the blocked-status producer (subscribe handler) and the trace consumer (buildTraceToolSummary), and dropped the `status:"blocked"` marker #80 preserved in its own normalizer. Effect: a permission-denied/approval-unavailable tool call (errored:false, status:blocked) reached the trace as status:undefined -> classified "ok" -> reported disposition:completed/tool_execution_succeeded/high. A blocked run was reported to the user as a verified success — defeating the feature's core auditability guarantee, and untested (the plumbing test hand-built blocked metas, bypassing the normalizer). Adds `status?:"blocked"` to Raw/Normalized types + copies it forward, mirroring #80's attempt-result.ts normalizer, plus a regression test through the normalizer. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
#80 (#92) * feat: expose auditable agent decision traces on boon (ENG-16854) Port of #80 onto the `boon` release branch. #80 merged to `main` (the upstream mirror) by mistake and can't reach the fleet from there; `boon`'s run/ layer is structured differently so this is a manual re-port, not a cherry-pick. Wire contract (enums/keys/schemaVersion/decision ladder) is byte-identical to #80 and matches boon-core's validator (getboon/boon#13591). Also folds in the >128 array count-cap follow-up (MAX_TRACE_ITEMS=128) that #80 lacked, so an oversized trace can't trigger a boon-core 400 that drops the whole reply. Slack: delivered as a trailing standalone "How this was verified" context message (boon has no segment reply model; appending blocks would demote the answer text to fallback-only). Flagged for review. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix: carry blocked tool status through normalizeToolMetas (ENG-16854) Fidelity-audit finding vs #80: boon's normalizeToolMetas sits between the blocked-status producer (subscribe handler) and the trace consumer (buildTraceToolSummary), and dropped the `status:"blocked"` marker #80 preserved in its own normalizer. Effect: a permission-denied/approval-unavailable tool call (errored:false, status:blocked) reached the trace as status:undefined -> classified "ok" -> reported disposition:completed/tool_execution_succeeded/high. A blocked run was reported to the user as a verified success — defeating the feature's core auditability guarantee, and untested (the plumbing test hand-built blocked metas, bypassing the normalizer). Adds `status?:"blocked"` to Raw/Normalized types + copies it forward, mirroring #80's attempt-result.ts normalizer, plus a regression test through the normalizer. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix: preserve reply metadata + derive disposition before trace cap (ENG-16854) Addresses two cubic review findings on the boon port: P1 (agent-runner metadata loss): attachAgentDecisionTrace cloned the terminal payload with a bare `{...payload, auditTrace}` spread, orphaning boon's WeakMap-backed ReplyPayloadMetadata (reply/threading, transcript, block-stream identity) on every traced reply. Now copies it via copyReplyPayloadMetadata. P2 (cap-before-disposition): the >128 cap sliced toolInvocations before the decision ladder counted outcomes, so a failure/blocked call beyond item 128 was discarded and the trace could report high-confidence success for a run that failed a tool. Now the disposition is derived from the FULL normalized invocation set; only the emitted toolInvocations/evidence arrays are bounded. Adds regression tests for both. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(slack): follow delivered thread for audit trace + bound context text (ENG-16854) Address PR review feedback on the audit-trace port: - deliverAuditTrace now follows the ACTUAL delivered thread (result?.threadTs), not the request threadTs. When a primary send degrades to the channel on a rejected anchor, send.ts returns threadTs: undefined; the old ?? threadTs fallback re-posted the trace against the dead thread and triggered a second invalid-thread retry. - resolveSlackAuditTraceBlock truncates the assembled context mrkdwn to Slack's 3000-char text-object limit. The 12-item list cap alone can still exceed it with long tool names, which Slack rejects with a 400 and boon-core then drops the reply. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
What Problem This Solves
Agent replies currently expose only prose, so downstream chat surfaces cannot distinguish a tool-grounded result from an unverified, failed, blocked, or permission-gated response.
Why This Change Was Made
This adds an optional, bounded
auditTraceto the final assistant reply. The trace is projected only from runtime facts already known to OpenClaw: visible tool names, invocation order and terminal status, confidence, disposition, and a deterministic reason. Slack receives a compact "How this was verified" context block.The trace excludes prompts, reasoning, tool arguments and results, secrets, and raw exceptions. Existing replies without a trace remain unchanged.
AI-assisted. Local autoreview was explicitly waived because GitHub runs Claude and Codex review on this PR.
User Impact
Users can see whether an answer was actually verified with tools, could not be verified, failed, or requires permission. Downstream clients can render the same evidence without reconstructing agent behavior from prose.
Evidence
git diff --checkpassed.Summary by cubic
Expose an optional
auditTraceon final assistant replies to show how an answer was verified, and render a compact “How this was verified” block in Slack. This helps clients distinguish tool‑grounded results from unverified, failed, blocked, or permission‑gated responses.New Features
auditTraceto assistant replies with: visible tool names, invocation order, terminal status, confidence, disposition, and a deterministic reason.Migration
auditTrace; existing behavior is unchanged if it’s absent.Written for commit 30d49b6. Summary will update on new commits.