Skip to content

fix(phase-16/03): ACP audit trail was always empty - #357

Open
thejesh23 wants to merge 1 commit into
rohitg00:mainfrom
thejesh23:fix/acp-audit-trail
Open

fix(phase-16/03): ACP audit trail was always empty#357
thejesh23 wants to merge 1 commit into
rohitg00:mainfrom
thejesh23:fix/acp-audit-trail

Conversation

@thejesh23

Copy link
Copy Markdown
Contributor

What this PR does

The ACP audit trail in the protocol capstone was always empty, so the section of the demo that exists to show it printed nothing.

Kind of change

  • Fix to an existing lesson

Checklist

  • Code runs without errors with the listed dependencies
  • No comments in code files
  • One lesson per commit
  • Tested locally / code output matches what docs/en.md claims

Phase / lesson

Phase 16 · 03-communication-protocols

Detail

docs/en.md says every agent execution produces a full audit entry with "the complete trajectory of tool calls and reasoning steps in between", and that the gateway wraps the execution in an audit trail with trajectory.

Two causes, both required:

  1. sendMessage fired this.processTask(...) without awaiting, so it returned before the handler ran.
  2. delegateTask called auditRunner.run(...) before dispatching, so structuredClone(result.trajectory) snapshotted an array the handler had not filled yet.

Before:

   Task state: working
   Artifacts: 0

4. Audit Trail (ACP)
   Trajectory steps: 0

After — await the handler, and audit after dispatch:

   Task state: completed
   Artifacts: 1

4. Audit Trail (ACP)
   Trajectory steps: 2
     - Searching for React 19 documentation
       Tool: web_search
     - Extracting key findings from search results
       Tool: doc_analysis

Verified with node --experimental-strip-types code/main.ts; the script exits 0 and the other sections are unchanged. Fixing only one of the two leaves Trajectory steps: 0.

docs/en.md says every agent execution produces an audit entry with the complete
trajectory of tool calls in between, and the gateway wraps the execution in that
trail. The demo printed 'Trajectory steps: 0' and 'Artifacts: 0'.

Two causes, both needed: sendMessage fired processTask without awaiting, so it
returned before the handler ran; and delegateTask ran auditRunner.run before
dispatching, so structuredClone(result.trajectory) snapshotted an array the
handler had not filled yet.

Await the handler, and audit after dispatch.

  Task state: completed
  Artifacts: 1
  Trajectory steps: 2
    - Searching for React 19 documentation   Tool: web_search
    - Extracting key findings from search results   Tool: doc_analysis
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fa045398-e779-4957-a7e6-989d925d6afa

📥 Commits

Reviewing files that changed from the base of the PR and between 7157ca7 and 1e5de1f.

📒 Files selected for processing (1)
  • phases/16-multi-agent-and-swarms/03-communication-protocols/code/main.ts

📝 Walkthrough

Walkthrough

The communication protocol example now awaits task processing before failure handling and sends delegated tasks before running audits, while preserving the existing delegation result structure.

Changes

Communication protocol flow

Layer / File(s) Summary
Await task processing before failure handling
phases/16-multi-agent-and-swarms/03-communication-protocols/code/main.ts
TaskManager.sendMessage awaits processTask before its error handler marks the task as failed.
Send delegated tasks before auditing
phases/16-multi-agent-and-swarms/03-communication-protocols/code/main.ts
ProtocolGateway.delegateTask awaits task delivery before running the audit and retains the { task, audit } result shape.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main fix: the ACP audit trail being empty due to sequencing issues.
Description check ✅ Passed The description directly explains the same audit-trail fix and the two causes addressed in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant