Pr/rpc fixes#140
Conversation
A completed task kept its runFunc closure for the manager's 10-minute run-retention window. When the closure captured large state (parsed inputs, accumulators, intermediate outputs), that state stayed live for every retained task — a leak that scales with the number of past runs. Release runFunc once executeTask finishes: it is invoked nowhere else and retries are already exhausted by then. Completed tasks keep only their lightweight result and snapshot for viewing.
Implement request-scoped timing accumulation for HTTP handlers with Server-Timing header emission. Provides AddTiming and Track APIs for measuring operation phases within the RPC executor and custom handlers, summing durations by phase name and emitting millisecond-precision metrics in the response header. The middleware preserves http.Flusher for streaming responses and integrates without importing rpc package dependencies.: feat
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughThis PR adds frontend lint tooling, updates the entity webapp icon wiring, refreshes aichat model and dependency data, adds hidden flag propagation, changes markdown ordering, filters RPC converter flags, adds HTTP timing instrumentation, normalizes route deduplication, and releases worker closures after task completion. ChangesClicky-UI Lint Tooling
Webapp Icon Component Migration
AI Chat Default Model Catalog Update
Hidden CLI Flag Support
Schema-Ordered Markdown Formatting
RPC Converter Flag Filtering
HTTP Server-Timing Middleware
RPC Route Dedup for Wildcard Names
Task Worker RunFunc Release
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
Gavel crashed before producing resultsExit code: 1 Last lines of gavel.logFull |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
flags/binding.go (1)
125-134: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReject hidden+required flags for body-less RPC calls.
ParseStructFieldsallowshidden:"true"andrequired:"true"together, butrpc/converter.godrops hidden fields from the generated parameters. That makes the value unreachable for GET/HEAD-style RPCs, so Cobra will still fail with a missing required flag. Add a parser check or a test for this combination.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flags/binding.go` around lines 125 - 134, ParseStructFields currently allows hidden and required flags to be combined, but hidden fields are omitted by rpc/converter.go so body-less RPC calls can never supply them. Add a validation in ParseStructFields or the flag metadata path to reject hidden:"true" with required:"true" together, and cover the behavior with a test around the info.Hidden/info.Required handling and cmd.MarkFlagRequired/MarkHidden setup.
🧹 Nitpick comments (1)
rpc/serve.go (1)
498-501: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRoute output should go through clicky logging, not
fmt.Printf.These warning lines write directly to
os.Stdout. Per the repository guidelines, library code should route output through the clicky logging path (e.g.clicky.Warnf) rather thanfmt.Printf/fmt.Println, so live task rendering isn't corrupted. The pre-existingfmt.Printfcalls elsewhere in this function share the same issue.As per coding guidelines: "Do not write directly to
os.Stdoutoros.Stderrin library code; route output through the clicky logging/writer path instead" and "emit logs throughclicky.Infof,clicky.Errorf,clicky.Warnf, orclicky.Debugfrather thanfmt.Println".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rpc/serve.go` around lines 498 - 501, The duplicate-endpoint warning in the RPC registration flow is writing directly to standard output via fmt.Printf, which should be routed through clicky logging instead. Update the warning path in the endpoint registration logic in serve.go to use clicky.Warnf (or the appropriate clicky logger) for the duplicate endpoint message and the related Path/Already registered/Skipping details, and replace the other fmt.Printf calls in the same function with clicky logging so library output does not bypass the task rendering path.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/enitity/webapp/.oxlintrc.json`:
- Around line 3-8: The oxlint config in the webapp example references the
clicky-ui plugin via a specifier that resolves outside this repository, so
update the setup accordingly. Either change the plugin path in the
.oxlintrc.json entry for clicky-ui to point to a location inside this repo, or
add clear documentation in the relevant setup docs explaining that a sibling
clicky-ui checkout is required. Use the clicky-ui plugin entry in the jsPlugins
array as the locator.
In `@rpc/http/middleware.go`:
- Around line 12-18: TimingMiddleware currently relies on timingRecorder.stamp()
being triggered by WriteHeader/Write/Flush, so handlers that return without
writing never set Server-Timing. Update TimingMiddleware to call rec.stamp()
after next.ServeHTTP returns, and keep the existing write-path behavior in
timingRecorder unchanged. Add a regression test around TimingMiddleware to cover
a handler that returns without writing and assert the Server-Timing header is
still emitted.
---
Outside diff comments:
In `@flags/binding.go`:
- Around line 125-134: ParseStructFields currently allows hidden and required
flags to be combined, but hidden fields are omitted by rpc/converter.go so
body-less RPC calls can never supply them. Add a validation in ParseStructFields
or the flag metadata path to reject hidden:"true" with required:"true" together,
and cover the behavior with a test around the info.Hidden/info.Required handling
and cmd.MarkFlagRequired/MarkHidden setup.
---
Nitpick comments:
In `@rpc/serve.go`:
- Around line 498-501: The duplicate-endpoint warning in the RPC registration
flow is writing directly to standard output via fmt.Printf, which should be
routed through clicky logging instead. Update the warning path in the endpoint
registration logic in serve.go to use clicky.Warnf (or the appropriate clicky
logger) for the duplicate endpoint message and the related Path/Already
registered/Skipping details, and replace the other fmt.Printf calls in the same
function with clicky logging so library output does not bypass the task
rendering path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 354ff0d0-8083-4437-8944-fae7e2198e29
⛔ Files ignored due to path filters (1)
examples/enitity/webapp/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (30)
.gitignoreCONTRIBUTING.mdMakefileaichat/agent.goaichat/agent_test.goaichat/models.goaichat/models_test.goexamples/enitity/webapp/.oxlintrc.jsonexamples/enitity/webapp/package.jsonexamples/enitity/webapp/pnpm-workspace.yamlexamples/enitity/webapp/src/App.tsxexamples/enitity/webapp/src/ChatWidget.tsxexamples/enitity/webapp/tsconfig.jsonexamples/enitity/webapp/vite.config.tsflags/binding.goflags/parser.goflags/parser_test.goflags/types.goformatters/map_input_test.goformatters/markdown_formatter.gorpc/converter.gorpc/converter_flags_test.gorpc/http/middleware.gorpc/http/middleware_test.gorpc/http/timing.gorpc/http/timing_test.gorpc/serve.gorpc/serve_test.gotask/worker.gotask/worker_release_test.go
…edge case Gavel-Issue-Id: 6b2997e35e373dc3d3209e33280094ab Claude-Session-Id: f7ecddc5-467d-4fd4-a7b8-f0778f653659
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Description
Brief description of the changes in this PR.
Type of Change
Testing
Checklist
Breaking Changes
If this is a breaking change, please describe the impact and migration path for existing users:
Additional Notes
Add any additional notes, screenshots, or context about the changes here.
Summary by CodeRabbit
Server-Timingheaders.