Bug: Audit log missing duration_ms for request_next_task — no perform…#577
Open
treble37 wants to merge 1 commit into
Open
Bug: Audit log missing duration_ms for request_next_task — no perform…#577treble37 wants to merge 1 commit into
treble37 wants to merge 1 commit into
Conversation
…ance baseline exists - Fix lwgray#228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This PR closes the remaining gaps in the request_next_task audit logging work for issue #228. It adds regression tests first, then fixes the two missing behaviors: audit entries now record task_count=0 when the board is empty instead of omitting the field, and the FastMCP/HTTP request_next_task path now routes through the same audited handler used by the stdio server so duration_ms and task_count are captured consistently across transports.
What does this PR do?
It adds regression coverage for request_next_task audit behavior, fixes audit task counting so empty boards log task_count=0, and routes FastMCP request_next_task calls through handle_tool_call so HTTP/FastMCP requests use the same audit wrapper as stdio.
Why is this change needed?
Before this change, the acceptance criteria for #228 were only partially met: task_count was dropped when the board was empty, and the FastMCP/HTTP request_next_task path bypassed the audit wrapper entirely. That meant duration_ms and task-count telemetry were not reliably recorded on all supported request paths.
Related Issue(s):
Fixes #(issue number)
📸 Proof: Marcus ran on my machine
Replace this line with your screenshot or terminal output.
Type of Change
Branch Information
developbranch (notmain)upstream/developChanges Made
Testing
Unit Tests:
pytest)Integration Tests:
Manual Testing:
Describe what manual testing you performed:
Test Environment:
Code Quality
pre-commit run --all-files)mypy src/)black src/)isort src/)ruff check src/)detect-secrets scan)Documentation
docs/Privacy / Telemetry
docs/telemetry.md§ What we collecthas a writer in the codebase that actually populates it by
the time this PR merges (no "we collect this" promises
without code that ships the data).
docs/telemetry.md§ What we collectis verifiably not shipped (no code paths add it to a
telemetry event).
print/sys.stdout.writeadded to a telemetry codepath is justified — Marcus's MCP stdio mode reserves stdout
for JSON-RPC, and any non-protocol bytes corrupt the channel.
Default: write to stderr or a log file.
docs/telemetry.mdis updated in the same PR.Documentation Changes:
Backwards Compatibility
Breaking Changes (if any):
Migration Guide (if needed):
Screenshots / Demos
Before:
After:
Performance Impact
Performance Notes:
Dependencies
New Dependencies:
Checklist
Additional Notes
Reviewer Focus Areas:
Open Questions:
Post-Merge Actions
For Maintainers
develop