Repository navigation
Conversation
me2seeks
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent operated by me2seeks make. It is not an independent human review and does not replace one.
Summary
Applies the Runtime Policy network proxy to the Client's own outbound bot traffic. The issue (#5091) is real: model execution resolves the proxy inside the Host with per-connection transports, but BotRegistry is constructed in the Desktop process, so bot requests bypassed the configured proxy entirely. The new client-network-proxy.ts bridges the seam via setActiveProxy, documents the process-wide state contract, and retries host_not_ready refusals on a bounded [1s, 5s, 15s] ladder since the first resolution races Host connection setup. Host-side network-proxy-coordinator.ts and protocol codecs carry the resolution operation.
Findings
- [P2] No
testlane has run on this head — the CI rollup shows onlylabel pass. For an 863-line networking change with new coordinator logic and an epoch-relevant protocol file (packages/runtime-host/src/protocol/index.ts), the requiredtestgate must run green before merge. The PR is also still a draft. - [P3]
RETRY_DELAYS_MSexhaustion is silent: after the 15s third retry the Client stays direct with no user-visible signal that the configured proxy could not be applied — bot traffic then leaks past the user's network policy until the next proxy edit or restart.onErrorexists as a dep; confirm it's wired to a diagnostic surface in production, not just tests.
Verdict
needs-changes — direction and layering are right (process-wide seam documented honestly), but zero CI signal on the head and the silent-exhaustion path need attention; also still a draft.
The guide said the channel's proxyUrl reaches every bot API call through proxiedFetch. It does not. No bridge reads proxyUrl, and proxiedFetch asks resolveActiveProxy() for the app's network proxy, which nothing in the product ever sets — so on main every bot request goes direct. The earlier claim came from reading proxiedFetch without tracing who populates the value it reads. The live verifications that looked like proxy coverage all ran with a TUN-mode proxy active, which intercepts below the application. They do not demonstrate Maka-level proxy support, and the guide now says so. Replaces the five affected passages with one Network routing section: what does not route (proxyUrl, the unwired app proxy), what would stay outside proxiedFetch even once wired (the gateway sockets, and the Slack, Feishu/Lark and WeCom SDKs), and what works today (a system-level route). Adds it to the known limitations and points at apache#5159, which wires the app proxy into the REST paths only. Also records that iLink replies are sent with an empty context_token and inbound context is never kept, credited to apache#5115, where it was first identified. Left marked untested, since the iLink route could not be exercised. Refs apache#3894 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
dac0aba to
0f80745
Compare
|
Thanks — both findings were fair. Rebased onto current [P2] draft / no [P3] silent exhaustion. Agreed, and the diagnosis was sharper than "add a log" — the real defect was that the ladder ended. While the policy asks for a proxy this Client cannot obtain, bot traffic is going direct past the user's network policy, and no amount of reporting fixes that; stopping the retries is what leaves it in place until the next proxy edit or restart. So the last delay (60s) now repeats instead of the budget running out, with one retry held in flight so a failing explicit refresh cannot fan out into a second ladder. On the surface question: I stopped short of a toast or a Verification was also redone against the rebased head. The decisive case points the policy at a port with nothing listening — a request that still succeeds there is one that leaked past the proxy: A is Still unanswered from #5091, and the one thing I would not want to merge without a maintainer view: |
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed 0f80745bb34b686d3b4af49ad57a4a58a6c186fa. The new Host operation resolves the effective proxy for Client-owned bot traffic, and Desktop refreshes it at startup and after a proxy settings patch. The protocol now carries the proxy secret and bumps compatibility epoch to 199.
I found one P2: when an enabled authenticated proxy has no stored credential, the Host returns credential_not_configured, but the Client treats it like a disabled proxy and calls setActiveProxy(null). proxiedFetch then sends Telegram/other bot traffic directly, contrary to the configured proxy policy. The added test explicitly expects this direct fallback. An unavailable credential should fail closed for Client-owned outbound traffic, or at least preserve a distinct unavailable state rather than converting it to "proxy disabled". This also matters when a previously working credential is removed while the proxy policy remains enabled.
Current-head hosted test, audit, and label checks are green; static merge-tree against main ae71ab319 and git diff --check are clean. I did not independently run Windows/Clash, a packaged Desktop, or a live bot request. I did not find another substantiated issue in the inspected wiring and protocol paths. This is not an approval or merge recommendation.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
| } | ||
| lastReportedError = undefined; | ||
| attempt = 0; | ||
| apply(resolved.kind === "ready" ? (resolved.proxy ?? null) : null); |
There was a problem hiding this comment.
[P2] Keep credential_not_configured distinct from a disabled proxy. The Host returns this state specifically when policy requires proxy authentication but the secret is missing (network-proxy-coordinator.ts:87-89). Mapping it to null makes proxiedFetch omit the dispatcher and send bot traffic directly, including after a previously saved credential is deleted while authentication remains enabled. The new test currently asserts that fallback. Block Client-owned outbound requests until the credential is configured, rather than silently bypassing the user's enabled proxy policy.
|
This pull request has had no new commits for 30 days and has been marked stale. It will be closed in 7 days unless a new commit is pushed. Comments do not reset this timer: only a new commit does. If the pull request is intentionally long-lived, a maintainer can apply the |
…ffic `setActiveProxy` had no production caller, so `resolveActiveProxy()` always returned null and the bot bridges' `proxiedFetch` never built a proxy dispatcher. Every bot request went direct whatever Network settings said, which on a blocked network surfaces as the `Fetch timeout` in apache#5091. Model execution is unaffected because it resolves the proxy inside the Host and injects a transport per connection. The bot bridges cannot: `BotRegistry` is constructed in the Client process, and the resolved proxy — including its credential — only exists Host-side. Add `network-proxy.resolve` so the Host can serve that resolved proxy, and apply it in the Client at Host registration and whenever a settings patch writes the proxy policy. A non-local Host describes a different machine's network, so its policy is never adopted; the Client stays direct instead. Refs apache#5091 Generated-by: Claude Code
… log Review noted that the retry ladder ran out silently: after the third delay the Client stayed direct with no signal, so bot traffic kept going past the network policy the user configured until the next proxy edit or restart. While the policy asks for a proxy this Client cannot obtain, something is wrong that giving up cannot fix. Repeat the last delay instead of exhausting the ladder, and hold one retry in flight so a failing explicit refresh does not fan out into a second one. Report the failure through the same redacted `[bots:*]` support-log channel that carries the bot connection failures it causes, rather than a bare console.error, so both appear together in an attached log. Refs apache#5091 Generated-by: Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…issing When the network policy enables an authenticated proxy but no credential is stored, the Host answers `credential_not_configured`. The Client mapped that to a disabled proxy, so `proxiedFetch` sent bot traffic direct, past the policy the user configured, including after a saved credential was removed. Add a blocked state to the active proxy seam: `proxiedFetch` now refuses to send while it is set, and the Client enters it on `credential_not_configured`, reporting once on the `[bots:proxy]` channel. Saving the credential is a proxy patch, so the refresh it triggers unblocks traffic. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
0f80745 to
c1911d0
Compare
The guide said the channel's proxyUrl reaches every bot API call through proxiedFetch. It does not. No bridge reads proxyUrl, and proxiedFetch asks resolveActiveProxy() for the app's network proxy, which nothing in the product ever sets — so on main every bot request goes direct. The earlier claim came from reading proxiedFetch without tracing who populates the value it reads. The live verifications that looked like proxy coverage all ran with a TUN-mode proxy active, which intercepts below the application. They do not demonstrate Maka-level proxy support, and the guide now says so. Replaces the five affected passages with one Network routing section: what does not route (proxyUrl, the unwired app proxy), what would stay outside proxiedFetch even once wired (the gateway sockets, and the Slack, Feishu/Lark and WeCom SDKs), and what works today (a system-level route). Adds it to the known limitations and points at apache#5159, which wires the app proxy into the REST paths only. Also records that iLink replies are sent with an empty context_token and inbound context is never kept, credited to apache#5115, where it was first identified. Left marked untested, since the iLink route could not be exercised. Refs apache#3894 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Rebased onto current Epoch. 199 has since been taken on [P2]
Affected suites pass locally (desktop proxy and settings IPC 27, runtime proxy/network 83, coordinator 9, protocol 93). Runtime and runtime-host typechecks, biome and Scope note: the Feishu, WeCom and Slack SDK clients and the bot WebSocket connections never went through Still open for a maintainer: whether |
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I reviewed the current 15-file diff at c1911d07750b86d8a3bd85b382761e8f21339c4a, including the Desktop startup/settings wiring, serialized proxy refresh and retry behavior, Host resolution and strict protocol codecs, operation grants, active proxy state, outbound fetch guard and tests. I also read the previous review at 0f80745bb34b686d3b4af49ad57a4a58a6c186fa and compared the missing-credential behavior.
The previously reported missing-credential P2 is fixed. With the actual current compiled applier, active state and proxiedFetch, a controlled Host result of credential_not_configured blocked the request and a real loopback HTTP server received zero requests. Explicitly applying a direct policy then permitted one request. Restoring only the actual prior applier, with the same result and current outbound modules, caused one direct request instead. Both diagnostic cases passed their expected current/control assertions. No real proxy password or external bot service was used.
A fresh npm ci --ignore-scripts, dependency patches and the normal root npm run build:test completed successfully. I ran 137 focused tests covering the applier, settings IPC, Host coordinator, protocol and proxied fetch, plus 26 existing Bot bridge tests; all passed. These include actual local HTTP requests as well as controlled Host/bridge adapters, not an end-to-end packaged Desktop or vendor-account run.
I found no additional confirmed P0–P2 in this scope. Important limits remain: this wires Client-owned REST requests using proxiedFetch; gateway WebSockets and SDK-owned transports are not thereby proxied. An unresolved Host query retains the last proxy state and retries, so an initially unresolved state can still be direct. The new operation deliberately carries the proxy secret from Host to Client and is granted to remote owners; the reviewed Desktop path consumes it in the main process, without returning it through the renderer settings result. I did not independently validate the full remote-owner security boundary, Windows/Clash, real bot accounts or Desktop E2E.
Against current main 85a1031c10d104456127f35aac1523b9ffb1a384, the actual merge-tree and protocol guard passed: 237 → 238. git diff --check passed, and current-head test/audit checks are successful. The PR description still says epoch 199; please refresh that prose to match the implementation. Recheck the epoch against the live base when integrating, since another pending PR also proposes 238. There is no database migration in this diff.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
setActiveProxyhas no production caller anywhere in the repository, soresolveActiveProxy()always returnsnulland the bot bridges'proxiedFetchnever builds a proxy dispatcher. Every bot request goes direct whatever the Network settings say. On a blocked network that surfaces as theFetch timeoutin the report, and it explains why enabling TUN was the only thing that worked — TUN intercepts below the application, so it needs no cooperation from this seam.Model execution was never affected: it resolves the proxy inside the Host and injects a transport per connection. The bot bridges cannot do that.
BotRegistryis constructed in the Client process, the local Host is a separate spawned process, and the resolved proxy — including its credential — only exists Host-side. That is the actual gap; the protocol exposed onlynetwork-proxy.test.So this adds
network-proxy.resolve, served byHostNetworkProxyCoordinatorfrom the existingresolveNetworkProxyExecution()andtoRuntimePolicyProxy(), and applies the result in the Client at Host registration and whenever a settings patch writes the proxy policy.Two decisions worth flagging:
remoteorenvironmentHost describes the wrong network. Those profiles are not even asked — the Client stays direct rather than guessing.[bots:*]support-log channel that carries the bot connection failures it causes, so both appear together in an attached log.RUNTIME_HOST_COMPATIBILITY_EPOCHgoes to 238. Two builds can share an epoch and differ in operations, so without the bump a Client could reach an already-running older local Host that cannot answer the new operation — and a Client cannot tell that refusal apart from a proxy that is genuinely unset.The fix covers every bot platform, not just Telegram —
telegram,discord,qq,dingtalkandwechatbridges, credential verification inbot-test.ts, and the Desktop onboarding and QQ scan-login paths all shareproxiedFetch.Fixes #5091
Verification
Windows 11 with Clash listening on
127.0.0.1:7897.HTTP_PROXY/HTTPS_PROXYare stripped from the process to match a normal desktop launch.Driving the real chain end to end — Host coordinator → protocol codec → applier →
setActiveProxy→ the bots'proxiedFetch→ a live request toapi.telegram.org. The decisive case is B: pointing the policy at a port with nothing listening must make the request fail, because a request that still succeeds is one that leaked past the proxy.A is
maintoday — the request ignores the policy entirely. B shows traffic is now genuinely routed through the configured proxy. C shows the non-local gate holds: a remote Host's policy is not adopted. D shows a working proxy is used.Separately, on the original report's network conditions (TUN off, system proxy on), the unwired seam reproduces the reported symptom verbatim —
Fetch timeoutafter 10017ms, matchingTELEGRAM_REQUEST_TIMEOUT_MS = 10_000— and populating the seam returnsHTTP 200in 2453ms.Checks run locally:
npm run lint,npm run format:check,npm run check:asf-headers— clean@maka/runtime-hosttypecheck clean;apps/desktoptsconfig.main.jsoncleannetwork-proxy-coordinatorandclient-network-proxysuites, plusruntime-host-settings-ipc-main,proxied-fetchandprotocolNot run: the full workspace suite and the Desktop E2E specs. Three renderer typecheck errors (
mcp-page.tsx,use-focused-preview.ts) and the@maka/uibuild are broken in my local checkout; this branch touches neitherpackages/uinor the renderer, so they are environment staleness rather than results about this change.Two Runtime Host suites do not pass on this machine, and neither is evidence about this change:
handshake-compatibility.test.tsfails 4 of 6, identically on unmodifiedmain(RuntimeHostTransportError: read_eof).host-kernel.test.tsis unstable here regardless of the change: unmodifiedmainfails 4 of 81 and the failing set differs between runs (write EPIPE,Runtime Host did not enter composition,shutdown did not cleanly close every resource). This branch failed 1–2 of 81 — a subset of what cleanmainproduces.framed-transport.test.tspasses 6 of 6. These look like the local Windows platform-fixture and cleanup problems tracked in #5059; CI or a reviewer on Linux/macOS should confirm both suites.Security
network-proxy.resolvesends the proxy credential from the Host to the Client. That is new, and SECURITY.md calls outproxiedFetchspecifically, so it deserves explicit review. The reasoning: a Client that runs its own outbound traffic cannot dial an authenticated proxy without the secret, and the alternative — a separate Client-side proxy setting — duplicates configuration the user has already entered. The failure path returns a fixed message rather than the underlying error, which can carry credential material, and there is a test for that.If you would rather keep the secret Host-side, the alternative is a dedicated Client-owned bot proxy setting (option 1 in the report). Happy to switch — this is the one open question from the issue that has not had a maintainer answer.
AI use
Select exactly one:
Tool(s) and scope: Claude Code — root-cause investigation, the implementation, and the tests, under my direction and review. Commits carry
Generated-by: Claude Code.Checklist
Does this PR entail a change in behavior?