GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — mcpx: surface ttlMs/cacheScope in mcpclient and expire pool catalogue cache (#1602) by dezren39 · Pull Request #1608 · developing-today/code Conversation
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 80f8fee81d
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if ttlMs != nil { | ||
| if !h.HasTTL || *ttlMs < h.TTLMs { | ||
| h.TTLMs = *ttlMs | ||
| } | ||
| h.HasTTL = true |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Account for absent TTLs when aggregating list pages
When one page declares a positive TTL but another omits ttlMs, merge ignores the absent hint and retains the positive TTL. The pool consequently treats the entire combined catalogue as fresh, including the response that should be immediately stale. This also affects resources/list and resources/templates/list, which share an aggregate: a positive resource TTL can make templates without a TTL cacheable. Track absent hints across successful responses and make the effective aggregate TTL zero if any response omitted it, while retaining absence information separately if needed.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if minTTL < 0 { | ||
| minTTL = 0 | ||
| } | ||
| deadline = fetchedAt.Add(time.Duration(minTTL) * time.Millisecond) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Anchor cache expiry to each response's receipt time
When a modern upstream supplies a short tools TTL and subsequent resource or prompt listing is slow, adding the minimum TTL to fetchedAt extends freshness beyond the declared interval because fetchedAt is sampled only after all sequential calls finish. For example, tools with a 100 ms TTL followed by a two-second resources listing remain reusable for another 100 ms despite having expired during the refresh. Compute deadlines from each response's receipt time and take the earliest absolute deadline instead of adding the minimum duration to the refresh completion time.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // expired cache collapse into a single refresh. A nil staleGen is an | ||
| // explicit refresh and always re-lists. | ||
| func (p *Pool) refreshSchemas(ctx context.Context, staleGen *time.Time) ([]mcpclient.Tool, []mcpclient.Resource, error) { | ||
| p.refreshMu.Lock() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Honor context cancellation while waiting for a refresh
When another catalogue refresh is running, this mutex wait cannot observe the waiting caller's cancellation or deadline. For example, Server.WarmAsync refreshes using an independent background timeout, so a concurrent request through handleRefresh or upstreamResourceURI can remain blocked until that background refresh finishes even after its own context expires. Previously, each caller reached the context-aware acquisition and RPC paths directly. Use a cancellable refresh gate or shared-result wait that selects on ctx.Done() so one slow upstream refresh cannot hold canceled requests open.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
# Conflicts: # pkgs/mcpx/docs/spec/conformance-matrix.md # pkgs/mcpx/internal/conformance/coverage_stateful.go
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: ff81c5255b
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if !p.schemaAt.IsZero() && (p.schemaDeadline.IsZero() || time.Now().Before(p.schemaDeadline)) { | ||
| t, r, e := p.tools, p.resources, p.schemaErr | ||
| p.schemaMu.RUnlock() | ||
| return t, r, e |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Apply expiry to the daemon's tool catalogue read paths
When a modern upstream's TTL expires after a live refresh, normal tool listings still serve the expired catalogue indefinitely because they never reach this check. Registry.Tools reads CachedSchemas directly (internal/daemon/registry.go:441), Namespaces marks any nonzero schemaAt as cached, and CLI ensureSchemas refreshes only when that cached flag is false. Warm(false) also skips those entries. Repository-wide search shows the only production call to Pool.Schemas is in resource-URI resolution (internal/daemon/routes_proto.go:1004). Wire tool catalogue reads through freshness-aware access, or expose expiry to their refresh decision, so the new TTL handling affects actual tool discovery.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.