feat(zed): support hosted Zed agent threads - #509
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
makoMakoGo
force-pushed
the
feat/zed-agent-support
branch
from
May 5, 2026 08:49
2df6ff2 to
baa37d6
Compare
makoMakoGo
marked this pull request as ready for review
May 5, 2026 09:41
makoMakoGo
force-pushed
the
feat/zed-agent-support
branch
from
May 5, 2026 09:45
baa37d6 to
32070fa
Compare
junhoyeo
approved these changes
May 5, 2026
junhoyeo
left a comment
Owner
There was a problem hiding this comment.
Reviewed via parallel audit β see thread. MERGE WITH NITS verdict; nits will be addressed in a follow-up PR (cfg-gate macOS path block, regression test for Zed markup vs Zed pricing, doc TODO for reasoning tokens). New SQLite parser is schema-flexible, read-only opens, 32 MiB cap, all 16 files coherently scoped to Zed support. tests + clippy green.
junhoyeo
added a commit
that referenced
this pull request
May 10, 2026
β¦rage (#514) chore: address audit nits across #509, #511, #512 Consolidated follow-up for audit findings on three recently-merged PRs. None are correctness blockers; this is hardening + coverage. # PR #509 β feat(zed): support hosted Zed agent threads scanner.rs: cfg-gate the macOS Zed `Library/Application Support` fallback path with `#[cfg(target_os = "macos")]`. Without it the block ran on Linux too β harmless because the path can't exist there, but inconsistent with the Windows branch which is already cfg-gated. Pure hygiene. lib.rs: document a future-risk in `pricing_multiplier`. Today the +10% Zed-hosted markup is keyed on `message.client == "zed" AND message.provider_id == "zed.dev"`, which is correct because tokscale bundles upstream-provider LiteLLM rows (anthropic/openai/google) for the underlying models. If LiteLLM ever ships rows under provider `zed.dev` that already include the markup, this would double-bill β a comment now warns the next maintainer to thread matched-price provenance through `apply_pricing_if_available` before relying on that case. lib.rs: two negative regression tests for the markup gate, locking in the existing positive test: - non-zed client + provider_id="zed.dev" β no markup (e.g., a claudecode message that mentions the provider should pay base rate, not Zed's hosted rate). - zed client + non-zed provider (BYOK path with provider_id pointing directly at "anthropic", etc.) β no markup. Important forward-compat: if Zed adds BYOK support and the parser switches to upstream provider IDs, the markup must NOT fire. # PR #511 β fix(codex): deduplicate forked token count history lib.rs: add a negative test that locks in two turns whose `last_token_usage` deltas are byte-identical but emitted at distinct timestamps both survive dedup. The fork-dedup key includes timestamp, so this is correct today; without the test, a future selectivity tightening (e.g. dropping timestamp from the key) could silently erase legitimate usage. # PR #512 β feat(auth): support non-interactive API token auth SettingsClient.tsx: clear `createdToken` from React state after the user copies it. The raw token is shown once and only once; once copied it should leave the component tree so it no longer lives in DevTools / extension snapshots of React state. Users who haven't copied yet still have the value in the reveal panel until they click copy or navigate away. authToken.test.ts: add an expired-token test asserting `GET /api/auth/token` returns 401 with `{ error: "API token has expired" }` when `authenticatePersonalToken` resolves with `status: "expired"`. The branch existed in route.ts but was uncovered. README.md: document the auth-token precedence (env `TOKSCALE_API_TOKEN` > saved credentials file) and the revocation flow (Settings > API Tokens > Revoke; takes effect immediately, returns 401 thereafter). # Out of scope (intentionally not addressed) - Import-path consistency in `route.ts` (audit nit N1): `@/lib/auth /bearerToken` does not resolve under vitest because the frontend has no vitest config to mirror tsconfig path aliases. Switching the import to the alias breaks `npx vitest run`. The fix is to add a `vitest.config.ts` with `resolve.alias`, which is a wider surface change than this nit-cleanup PR warrants. The relative import stays as it was on main. - Legacy plaintext OR-clause in personalTokens.ts (audit M2): a pre-existing migration affordance, not introduced by #512; removal should be paired with a one-shot data migration that rehashes any remaining plaintext rows. - Dead `session_id_from_meta`/`session_forked_from_id` fields on `CodexParseState` (audit nit on #511): looks like deliberate groundwork by the original author. Removing it without their consent is overreach. # Validation - `cargo test -p tokscale-core` β 662 passed (3 new tests) - `cargo clippy -p tokscale-core --all-features -- -D warnings` β clean - `cargo fmt --all -- --check` β clean - `npx vitest run __tests__/api/authToken.test.ts __tests__/lib/bearerToken.test.ts` β 8/8 pass Constraint: All fixes must lock in current behavior (negative tests, cfg gates, doc comments) without changing observed behavior of any shipped feature Constraint: No vitest config changes β the import-style nit yields to that constraint Confidence: high Scope-risk: narrow β 5 files, +188/-0, no behavior change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #498
Summary
threads/threads.dbwithjsonandzstdpayload supportprovider == "zed.dev") to avoid double-counting external ACP agentsTesting
cargo test -p tokscale-core zed && rtk cargo test -p tokscale-cli zed