Skip to content

fix(agent): persist webhook traces as JSON objects - #18883

Merged
yuzhichang merged 4 commits into
infiniflow:mainfrom
T1mn:codex/fix-agent-webhook-trace-json
Aug 29, 2026
Merged

yuzhichang merged 4 commits into
infiniflow:mainfrom
T1mn:codex/fix-agent-webhook-trace-json

Conversation

@T1mn

@T1mn T1mn commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Store webhook trace maps directly through Redis SetObj, avoiding double JSON encoding that made persisted traces unreadable to the polling endpoint.
  • Add a miniredis regression test covering two sequential events, polling decode, completion, and the 600-second TTL.

Testing

  • Full internal/handler test binary on Linux/arm64: passed.
  • GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go vet ./internal/handler: passed.
  • git diff --check: passed.

The standard macOS build.sh --test path stops before tests at the existing Linux-only SysProcAttr.Pdeathsig usage.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Aug 27, 2026
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fed4be90-d719-4d84-81ae-177eb8650635

📥 Commits

Reviewing files that changed from the base of the PR and between 77ed0ae and af92829.

📒 Files selected for processing (2)
  • internal/handler/agent_webhook.go
  • internal/handler/agent_webhook_trace_test.go

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The webhook trace code now uses an injectable writer for Redis access. Trace maps are stored directly with a 600-second TTL. Tests verify readable, ordered message and finished events.

Changes

Webhook trace persistence

Layer / File(s) Summary
Inject the trace writer and persist objects
internal/handler/agent_webhook.go
appendWebhookTrace delegates to appendWebhookTraceWithWriter. The helper uses webhookTraceWriter for Redis reads and writes trace objects directly with a 600-second TTL.
Validate readable persisted events
internal/handler/agent_webhook_trace_test.go
The miniredis writer supports the new interface. The test verifies ordered message and finished events and checks the 600-second TTL.

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

Merge Risk: ⚪ Minimal · up to af928

The change fixes webhook trace persistence so the polling endpoint can read traces correctly while preserving existing access controls and expiration behavior. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: jinhai-cn

Poem

A rabbit stores events in a row

Message, then finished, both show
The writer keeps time
Six hundred seconds chime
Readable traces now grow```

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing webhook trace persistence by storing traces as JSON objects.
Description check ✅ Passed The description includes the required Summary section, explains the problem and solution, and records regression coverage and validation results.
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.
  • Fix all pre-merge checks with AI

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.

@yuzhichang
yuzhichang merged commit d450080 into infiniflow:main Aug 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants