Repository navigation
feat(069-A1): byte capture on ActivityRecord (pre-truncation RequestBytes/ResponseBytes) - #553
Merged
Merged
Conversation
Surface existing activity-log data (per-call server/tool/status/duration/bytes) as Web UI graphs so users see where agents spend tokens: per-tool call histogram, response-size token-sink ranking, error rate, latency, timeline, behind a dashboard switcher. Fast via actor-owned incremental stats aggregate + TTL cache (no per-request full scan). v1 uses bytes as token proxy; accurate per-call tokens deferred (FR-010). Roadmap PILLAR A. Paperclip goal d7164fdf.
Run /speckit.plan + /speckit.tasks. Codebase verification corrected three spec assumptions: ActivityRecord stores no byte sizes (capture two int fields at the write path), chart.js/vue-chartjs already installed (reuse, no library selection), and /activity/stats does not exist (add /activity/usage). Aggregation is actor-owned + incremental + snapshot + TTL cache + cold-start rebuild (CN-002/CN-003/FR-005). Cross-lane decomposition: backend streams A1->A2->A3 (my lane), frontend B1/B2 delegated, blocked by A3. Related #745 Co-Authored-By: Paperclip <noreply@paperclip.ing>
…re-truncation capture - Add `request_bytes` and `response_bytes` (omitempty int) fields to ActivityRecord; legacy records missing the fields decode to 0. - Populate both fields in ActivityService.handleToolCallCompleted from event payload. - Emit pre-truncation byte sizes in EmitActivityToolCallCompleted and its server wrappers; compute rawByteSize(result) and rawByteSize(activityArgs) before forwardContentResult is called so truncated responses still report full sizes. - Fix ListActivities to copy the new fields when constructing result records. - TDD: TestActivityRecord_ByteFieldsRoundTrip (T001) and TestHandleToolCallCompleted_ByteCapture (T003) written before implementation. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Deploying mcpproxy-docs with
|
| Latest commit: |
7784c77
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2760dab2.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://069-observability-usage-grap.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 26737509838 --repo smart-mcp-proxy/mcpproxy-go
|
Dual-AI review of #553 flagged that TestHandleToolCallCompleted_ByteCapture only asserts the activity service stores values handed to it — it never exercises the A1 invariant that handleCallToolVariant measures rawByteSize on the RAW result/args BEFORE forwardContentResult truncates. Add TestRawByteSize_MeasuredBeforeTruncation (internal/server): drive an over-threshold response + args through the real measure-then-truncate sequence and assert (a) RequestBytes/ResponseBytes equal the full pre-truncation json.Marshal size, (b) the forwarded body is actually truncated and shorter than the raw response, (c) the captured ResponseBytes strictly exceeds the post-truncation payload — proving measurement precedes truncation. Also note the double-Marshal overhead on rawByteSize for future profiling (review's optional ask). Related: MCP-786, MCP-748, spec 069
Dumbris
added a commit
that referenced
this pull request
Jun 1, 2026
* docs(064): Glass Cockpit — transparent & steerable agent cockpit spec Spec, plan, and design artifacts for making the existing Paperclip "MCPProxy" cockpit (spec 045) transparent and steerable: invert the default from "proceed" to "checkpoint at every design-decision boundary" via three human gates (plan-of-attack, per-spec design, pre-merge) mapped to Paperclip native primitives (executionPolicy approval stages, request_confirmation/suggest_tasks interactions, issue_tree_holds), with reasoning visible before each gate and a single "waiting on you" view. Phased rollout: A) config + agent-instruction only (the dry-run target), B) a Paperclip plugin for the fused transparency UI, C) a fork only if A/B fall short. SynapBus is log/wiki only, never on the critical path. Includes rewritten gate-aware agent instructions, consumed-API + executionPolicy + agent-instruction contracts, data model, research, and operator quickstart. Supersedes spec 062's fresh-dev-instance approach; extends spec 045. * docs(064): amend gate model — human-merge → dual-AI auto-merge + human veto Session 2 amendment to FR-005 + US3: replace the mandatory human-merge gate (throughput bottleneck) with draft-PR + dual-AI-review consensus auto-merge. Two reviewers on different model families (Gemini 2.5-pro Critic + Codex), never the implementer; tests-green + both-accept → auto-merge; human is an optional 3rd reviewer with veto (request-changes/hold freezes auto-merge). Prerequisite flagged: a bot GitHub identity (agents currently = author's gh, and GitHub forbids self-approval) — interim fallback is 2-AI-review-as- required-check with the human merging. codex-local Paperclip adapter exists. * docs(064): dual-AI-review auto-merge — reviewer doctrine + engineer draft-PR + setup Adds the Session-2 gate-model deliverables: reviewer/REVIEWER.md (shared RV-1..RV-6 dual-review doctrine), codex-reviewer/AGENTS.md (2nd reviewer on codex-local), amends engineer ENG-4 to open DRAFT PRs + request 2 AI reviewers (no self-merge), and auto-merge-setup.md (GitHub branch-protection config + the bot-identity prerequisite + interim human-merge fallback + open items). * docs(064): reviewers on subscription auth only; Gemini quota-exhausted, Codex gpt-5.5 ready Per user directive: both AI reviewers use paid SUBSCRIPTION logins, not API keys. - Gemini Critic: subscription/OAuth, pin gemini-2.5-pro (3.5/3 UNVERIFIED — quota exhausted on every probe today; switch if confirmed). TWO blockers: quota + empty-prompt adapter bug → cannot accept yet. - Codex reviewer: ChatGPT subscription, gpt-5.5 (codex-cli 0.46.0) — READY now. - Live two-reviewer set today = Codex + human (FR-005f) until Gemini recovers. * docs(064): Critic GEMINI.md — subscription-only, quota-blocked; Kimi+Codex as live pair Gemini settings pin gemini-3.1-pro-preview (subscription/OAuth) but quota is exhausted (no reset hint) + empty-prompt adapter bug → Critic can't accept yet. Live 2-AI reviewer pair = Codex gpt-5.5 + Kimi-K2.5 (opencode_local, Gcore key present); Gemini rejoins as 3rd reviewer when quota returns. * docs(064): stand up Codex+Kimi reviewer agents; codex config fix Live dual-AI reviewer pair created in the running Paperclip cockpit and verified responding (2026-05-31): - CodexReviewer — codex_local / gpt-5-codex (5b94562c-…) - KimiReviewer — opencode_local / Kimi-K2.5 (fdaa1d4c-…) Both carry managed instruction bundles (shared doctrine + RV-1..RV-6 + role notes), report to CEO, idle, heartbeat off (woken by review-stage). Docs: - add canonical kimi-reviewer/AGENTS.md (the design lacked it) - correct codex-reviewer/AGENTS.md model facts (gpt-5.5 -> gpt-5-codex) - auto-merge-setup.md: live pair is Codex+Kimi; Gemini Critic becomes the 3rd reviewer when its subscription quota recovers codex config fix (~/.codex/config.toml, not in repo): model_reasoning_effort xhigh->high and model gpt-5.5->gpt-5-codex. On codex-cli 0.46.0 + ChatGPT subscription auth, gpt-5.5 needs a newer CLI and gpt-5.4/5.3-codex/5.2 are auth-restricted; gpt-5-codex/gpt-5 are the working models. Backup at ~/.codex/config.toml.bak.pre-reviewer-fix.* * docs(064): engineers drive PRs green + bundle docs/ updates (ENG-8/9) engineer/AGENTS.md: - ENG-8: drive every required check to green before review — run local verification before push, watch `gh pr checks --watch`, push fixes until all green; never leave/hand off a red PR, never --no-verify or weaken a check. Green CI is the engineer's job, not the reviewer's. - ENG-9: when a change touches CLI/REST/MCP API/config/defaults/security or anything under docs/, the SAME PR must update docs/ (+ CLAUDE.md/ oas/swagger.yaml/README where mirrored). Docs-only changes exempt from TDD. - ENG-5 reworked to dual-AI merge-readiness (Codex+Kimi accept + all CI green). reviewer/REVIEWER.md RV-3: red/pending check = automatic request_changes; missing docs when the change warrants them = request_changes. Applied to the live Paperclip brains: 3 engineers (Backend/Frontend/MacOS) re-flattened from canonical; Codex+Kimi reviewer brains refreshed. * docs(064): record applied CI-context branch protection on main Phase-1 gate live on main (no bot identity needed): required_status_checks strict=false with 8 always-run, non-path-conditional contexts (Lint, Unit Tests ubuntu, Build ubuntu/macos/windows, Build Frontend, Validate PR title, Verify OpenAPI Artifacts). Existing 1-review + enforce_admins=false kept. Verified: green PR #553 satisfies all 8 (blocked only by review); in-flight PR #555 blocked on pending required checks. Documents the deliberately- excluded checks and the Go-version-pinned context-name fragility. * docs(064): ENG-3 — branch from origin/main, never from a feature branch Forking a work branch from another feature branch drags its unmerged commits into the PR (root cause of spec-064 docs leaking into the MCP-770 race fix #556). ENG-3 now mandates fetch + branch from origin/main explicitly, in both the engineer bundle and the contract.
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.
Summary
request_bytesandresponse_bytes(int, omitempty) toActivityRecord— foundational byte data for Spec 069 usage graphs.rawByteSize(result)andrawByteSize(activityArgs)measured beforeforwardContentResult/ the legacy truncation loop inmcp_routing.go.0(unknown), preserving backwards compatibility.ListActivitiesfield copy to propagate the new fields from storage.EmitActivityToolCallCompleted/emitActivityToolCallCompletedwrappers extended withrequestBytes, responseBytes int; error call sites pass0, 0.Test plan
TestActivityRecord_ByteFieldsRoundTrip— JSON round-trip + legacy decode-to-0 (T001)TestHandleToolCallCompleted_ByteCapture— service stores pre-truncation sizes from event payload (T003)internal/...suite green (approval-hash canary, required by tasks.md T025)Blocks: A2 aggregate work (T005+).