fix(relay): normalize effective daemon identity - #345
Conversation
Build daemon identity from effective per-server relay settings so semantically equivalent controls and fully overridden process values no longer restart compatible daemons. Normalize policy aliases, timeout defaults and clamping, endpoints, and default-profile spellings through the shared routing resolvers. Preserve true policy, profile, endpoint, credential-directory and key-rotation, discovery, executable-selection, and placeholder boundaries. Keep require fail-closed. Advance identity metadata to version 2 for one-time replacement of older daemon metadata. Config-path and layer isolation remain unchanged. Sharing daemons across separate temporary configs, including relay-off configs, is explicitly outside this normalization fix. Verified unchanged patch: pnpm check passed; pnpm test passed with 199 files and 1825 tests, with 4 files and 26 tests skipped; focused suites passed 164 tests. Independent Codex autoreview was scoped-clean at the default P0 threshold. Proof used synthetic fixtures only.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81241188ca
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| endpoint: | ||
| policy === 'off' | ||
| ? 'disabled' | ||
| : explicit.explicit | ||
| ? (explicit.url?.toString() ?? 'invalid-endpoint') | ||
| : DEFAULT_RELAY_IDENTITY_URL, |
There was a problem hiding this comment.
Keep explicit and discovered endpoint modes distinct
When a daemon started without an explicit URL discovers endpoint X, a later caller setting MCPORTER_CHROME_DEVTOOLS_RELAY_URL=X produces the same identity and therefore reuses that daemon. The daemon retains its original environment, however, so after a transport recycle it performs discovery again and may connect to a newly reported endpoint Y, ignoring the caller's explicit X. Include whether the endpoint is explicit or discovered in the identity so this mode change restarts the daemon.
Useful? React with 👍 / 👎.
Keep relay fixtures inside the isolated home when clearing discovery variables would otherwise make Windows temp roots disappear. Snapshot all environment aliases before mutation so case-insensitive Windows keys are restored correctly. Guard synthetic relay credential paths using native path containment, including Windows separators, case handling, and paths outside fixture roots. Restore absent importer fixture overrides by removing them instead of assigning the string undefined, avoiding unintended paths and EISDIR. These are fixture corrections only; production relay behavior is unchanged.
|
Codex review: blocked before merge. Reviewed September 4, 2026, 4:59 PM ET / 20:59 UTC. ClawSweeper reviewWhat this changesThe PR changes Chrome DevTools relay daemon freshness identity to compare normalized effective per-server relay settings and adds regression and test-fixture coverage. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: its normalized identity still equates a discovered relay endpoint with an explicitly configured endpoint, allowing a daemon with discovery-based behavior to be reused for a caller that requires a fixed endpoint. Priority: P2 Review scores
Verification
How this fits togetherMCPorter reuses local keep-alive daemons for configured MCP servers. Relay policy, credentials, discovery, and endpoint selection determine whether the running daemon can be safely reused or must restart. flowchart LR
A[Server configuration] --> B[Effective relay settings]
C[Process environment] --> B
B --> D[Endpoint source]
D --> E[Daemon identity]
E --> F{Fresh daemon?}
F -->|yes| G[Reuse daemon]
F -->|no| H[Restart and connect relay]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Include the endpoint source or mode in the effective daemon identity, then add a focused identity and daemon-freshness regression for discovered-X followed by explicit-X. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: start a daemon without an explicit URL that discovers endpoint X, then invoke it with an explicit URL of X. The identity matches although the retained daemon can later rediscover a different endpoint. Is this the best way to solve the issue? No. The normalization must retain explicit-versus-discovered endpoint mode, because equal endpoint strings do not guarantee identical behavior after transport recovery. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9579ed64fed0. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Problem
Chrome relay daemon freshness included raw process environment values even when they resolved to the same runtime behavior. An unset
MCPORTER_CHROME_DEVTOOLS_RELAY_POLICYand explicitpreferproduced different hashes, as could process values fully overridden by a server'senvmap. The mismatch made the daemon client stop and restart an otherwise compatible daemon, potentially prompting for another Chrome direct-attachment approval.Change
Build identity from each applicable server's effective relay settings. Reuse the routing resolvers to normalize policy/defaults/aliases, timeout defaults and clamping, validated endpoints, and default-profile spellings. Exclude fully overridden process values while preserving partial inheritance and raw command/relay-placeholder dependencies. Retain credential-directory and key-rotation identity, discovery/executable inputs, and relevant working-directory dependencies. Advance runtime identity metadata to version 2 so older metadata uses the existing replacement path.
Keep
requirefail-closed and leave config-path/layer socket and transport isolation unchanged. This is a daemon freshness fix, not a global transport-pool identity. Separate temporary configs, including relay-off configs, still produce separate daemons and are explicitly outside this change.Verification
statusandlistTools, without stop/spawn, while meaningful policy/profile/endpoint/discovery changes and credential rotation remain stale.pnpm checkpassed.pnpm testpassed after the Windows fixture corrections: 200 files and 1,840 tests passed; 4 files and 26 tests skipped, with live-test opt-ins disabled.undefinedinstead of removing absent overrides. The follow-up is fixture-only: safe temp placement, alias-aware snapshots, Windows/POSIX credential containment, proper import-override restoration, and synthetic regressions. No production importer behavior, test skips, or timing budgets changed.No real Chrome connections, live daemon operations, credential inspection, or user mcporter configuration edits were used for proof. No changelog or dependency-version changes.