feat(proxy): harden authorized tool discovery - #5
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f1ab7805e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| const upstreamCallCount = observations.reduce( | ||
| (sum, entry) => sum + (typeof entry.upstream_call_count === "number" ? entry.upstream_call_count : 0), | ||
| 0, |
There was a problem hiding this comment.
Check zero-upstream evidence in the repeat run
When the adapter's repeat run invokes an upstream business Tool or omits upstream_events, this sum still reads only the primary observations; repeat_observations contributes only its ranking signature. The repeat can therefore have side effects while zero_upstream_calls passes, producing false security evidence, so upstream evidence must be required and aggregated for both matrices.
Useful? React with 👍 / 👎.
| const output: Record<string, unknown> = {}; | ||
| for (const key of Object.keys(value).sort(compareStableText)) { | ||
| const normalized = canonicalize((value as Record<string, unknown>)[key], ancestors); | ||
| if (normalized !== undefined) output[key] = normalized; |
There was a problem hiding this comment.
Preserve
__proto__ keys in canonical catalogs
When an upstream JSON Schema defines a valid property named __proto__, assigning that key into {} invokes the legacy prototype setter instead of creating an own property. Canonical serialization consequently drops the definition, so catalogs that differ only in this property's schema receive the same digest and tool references; the proxy signature also misses the schema change and may suppress its tool-list notification. Construct the canonical object with a null prototype or an own-property-safe API such as Object.fromEntries.
Useful? React with 👍 / 👎.
Outcome
Harden portable
find_tooldiscovery without changing the three-tool Interface or the Native, Compact, and Extreme mode contract.0.1.1-alpha.2documented as an unpublished source candidate.Related issue
N/A.
Change type
Verification
Compatibility and recovery
find_tool,call_tool, andread_result.read_result.find_toolrequests fail locally without an upstream business call.Checklist
main.npm run typecheck,npm run lint, andnpm run format:checkpass.CHANGELOG.mdand the English/Chinese setup documentation are updated.