Introduction¶
When running agents with opencode in the dsh-go mobile app or Harness Web, you often encounter a “stuck” experience. In many cases, the bottleneck isn’t the model itself but the network chain: DNS resolution, TCP handshake, TLS, cross-region routing, gateway forwarding. When all these steps are lumped together, it’s hard to tell which segment is slow, and therefore hard to know whether switching IPs or tweaking configurations will help.
dsh-go’s native plugin system allows capability extension, but by default there’s no feature to decompose the opencode link or benchmark it. This plugin was built to solve the problem of “chain slowness” and “model slowness” being measured as one undifferentiated number. It separates first-byte latency of the chain from the model’s TTFT and tok/s, so you can make an informed decision about whether to switch edge IPs.
What It Is¶
yueguangwangzuo/opencode-go-boost is a native dsh-go plugin that also supports the plugin settings page in Harness Web. Its core function is: selecting the fastest route from Cloudflare edge to opencode.ai/inference/go, and measuring chain first-byte latency and model speed independently.
The maintainer is yueguangwangzuo, and it’s categorized as a “Network Tool.” It doesn’t change the model itself—instead, it first confirms whether the network chain is dragging down first-byte latency, then decides whether an IP switch is warranted.
Core Features¶
Chain First-Byte Benchmarking¶
The plugin displays a status bar above the input box in the format HKG 362ms · …139.104, with the unit being first-byte latency. The candidate list is built from Cloudflare 15-segment stratified sampling, DNS resolution, and the currently pinned IP. The system rejects 198.18/15, private, and loopback addresses to avoid false measurements.
At the chain level, it performs a two-step filter:
- TCP fast-check: only IPs that connect within ~1.5 seconds advance to the next step.
- Real-request validation: sends
/cdn-cgi/traceto verify the zone is serving, and rejects 10xx platform errors and 5xx errors.
Finally, results are ranked by “near-region colo first + first-byte latency.”
Model Benchmarking (TTFT & tok/s)¶
Model speed measurement is based on real requests. The “Model Speed” panel fires 3 rounds of real requests, each ~200 tokens, then aggregates to compute TTFT (time to first token), tok/s, and variance. The median is used by default; if variance exceeds 60%, it’s flagged as “unstable.”
This is done because a single tok/s reading is highly variable: the same IP went from 112 to 217 tok/s within two hours—hardly any decision value.
Full-Chain Decomposition¶
The “Full Chain” panel breaks down first-byte latency segment by segment, including DNS, TCP, TLS, cross-region, gateway, and model. If a segment is unreachable, it displays — rather than using DNS time to masquerade as chain latency. Full-chain benchmarking is only triggered on click; it does not auto-enter fast-check or auto-optimization flows.
Capsules & Actions¶
- Capsule “Switch to Fastest IP”: re-measures the candidate list and pins the currently fastest IP.
- Capsule “Full Chain”: triggers data collection for the Full Chain panel.
- Capsule “Model Speed”: triggers the 3-round real requests for the Model Speed panel.
Harness Web Settings Page¶
In the web UI under “Settings → Edge IP Optimization,” you can see the same status, rankings, full-chain, and benchmarking interface as on mobile. The engine is shared—mobile and web display the same data.
Bot Tool¶
The plugin provides a edge_ip tool for the Bot, supporting subcommands like status / test / chain / speed3 for manually triggering benchmarks in conversation.
Differences from dsh-best-ip¶
| dsh-best-ip | This plugin | |
|---|---|---|
| Adapter | Only recognizes pi-ai | Three-level fallback: engine current selection → profile cordis.patch.yml → constant; can also locate third-party adapter endpoints |
| What it measures | Primarily first-byte | First-byte and tok/s measured separately, plus TTFT, backend placement, variance |
| IP-switch decision | Switch if fast | First determines “is it chain-slow or model-slow”; in auto mode, new IP must be 25% faster for 2 consecutive rounds |
| Effect mechanism | Modifies DNS / hosts | In-process dns.lookup hijack, scoped to target domain only, reverts on uninstall |
| Key source | Own config | CUSTOM_OPENCODE_API_KEY / OPENCODE_GO_API_KEY / adapter-generated per-account DSH_OPENCODE_GO_ACCOUNT_* / .credentials.yaml |
The two can coexist: this plugin reads dsh-best-ip’s candidate list as additional input (read-only).
Installation & Activation¶
Before installing, ensure:
- dsh-go mobile app (native capsules / status bar / panels), or Harness Web (settings page).
- Default model routing goes through
opencode.ai(this is the hardcoded target domain, seeHOSTinlib/index.js). Switching to a different gateway requires changing the constant. - Selecting “Full Chain” full check or “Model Speed” will actually send requests: ~200 tokens per round, ~600 tokens for 3 rounds.
Install command:
git clone https://github.com/yueguangwangzuo/opencode-go-boost.git
dsh plugin --profile web add ./dsh-edge-ip
After installation, restart the engine on the app’s “Engine” page, or refresh the page in the web UI. It takes effect immediately upon install—no profile configuration changes needed.
Uninstall command:
dsh plugin --profile web remove local-edge-ip
Implementation Details¶
- Candidate sources: Cloudflare 15-segment stratified sampling (
lib/probe.js) + DNS + currently pinned IP; rejects198.18/15, private, and loopback addresses. - Filtering flow: TCP fast-check 1.5s → send
/cdn-cgi/traceto validate zone serving → reject 10xx platform errors and 5xx. - Ranking logic: near-region colo first, then first-byte latency.
- Certificate validation: all requests with Authorization use
rejectUnauthorized: true, with no impact on availability. - DNS interception: by default intercepts
dns.lookup/dns.promises.lookupin-process, scoped to the target domain only; falls back to writing system hosts if necessary, with a prompt in the panel. - Benchmark triggers: only fires on click; never auto-burns tokens.
File Structure¶
| File | Purpose |
|---|---|
lib/index.js |
Panels, capsules, status bar, optimization & self-healing flow |
lib/probe.js |
CF segment sampling, TCP fast-check, real-request validation, colo ranking |
lib/bench.js |
Streaming benchmark (TTFT / tok/s / jitter / upstream), multi-round aggregation |
lib/resolver.js |
dns.lookup interception, optional hosts write & migration |
lib/providers.js |
Locates real endpoint & key (three-level fallback) |
lib/chain.js |
Full Chain panel data collection (fast check / full check) |
client.js |
Harness Web settings page & /api/local-edge-ip/* |
test/unit.mjs |
Offline unit tests (17 cases, no network calls) |
Development & Testing¶
- Offline unit tests:
node test/unit.mjs
- Plugin self-check (requires locating the local dsh-go plugin directory first):
node /path/to/dsh/skills/dsh-go-plugin/kit/bin/check.mjs . --load
After modifying lib/, restart on the app’s “Engine” page for mobile, or refresh the page for web (host-side changes still require an engine restart).
Known Limitations¶
- Target domain is hardcoded to
opencode.ai; switching gateways requires changingHOSTandDEFAULTS. - Only tested on Linux / Android proot environments; the hosts-write fallback requires write permissions—a prompt will appear if not available.
- This is not an official opencode project, nor does it represent Cloudflare’s recommended approach. Numbers vary by region, ISP, and backend placement—don’t use others’ absolute values as your baseline.
License¶
MIT
Conclusion¶
This plugin separates opencode’s chain first-byte latency from model speed, so you can confirm “the chain is slow” before deciding “to switch IP.” If you use opencode in dsh-go or Harness Web and want to isolate chain issues from model issues, give this plugin a try.
- Plugin directory page: https://www.skillhub.cn/plugins/yueguangwangzuo/opencode-go-boost
- GitHub: https://github.com/yueguangwangzuo/opencode-go-boost