Tool payload: stop advertising 37 deprecated-alias schemas (41,998 B / ~24 % of payload) #48
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea#48
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
lib/index.js:420registers every entry ofLEGACY_MAPas a full tool definition. Each one deep-copies the canonical tool's parameter schema (onlyactionis removed fromrequired) and adds a[Deprecated alias for …]description — while the canonical tool stays registered next to it. The same schema is therefore advertised twice.Measured on the live plugin (dsh-gitea 0.8.4, DSH 0.2.1-rc.2, profile
web):The whole tool payload is ~70 % of a 67,048-token first-turn prompt (cross-checked against the session's own
usagerecord: 17,640 fresh + 49,408 cached tokens). The aliases are the largest removable block in the plugin and add zero capability.Method: bytes are
JSON.stringify(tool).lengthsummed over thedata.header.toolsarray of the session'srequest/headerrecord; token ratio ~3.7 B/token. Exact numbers drift as tools are added — the code block below regenerates them.Impact
legacyAliases: truerestores the old surface for any external consumer.Proposal
legacyAliases: z.boolean().default(false); run the loop atlib/index.js:420only when it istrue.LEGACY_MAPand keep legacy-name dispatch inrunHandler, so a replayed old session (or a model echoing an alias name from stale history) still resolves server-side instead ofUNKNOWN_TOOL.The plugin is published on npm (docs + mirror), so a hard delete without a flag is a compatibility decision the operator should make; a default-off flag gets the win now and keeps the switch available.
Scope
LEGACY_MAPcontent unchanged — only whether it is advertised.Acceptance criteria
legacyAliases: truerestores the 0.8.4 tool set byte-for-bytegitea_labels {action:"set"}covers thegitea_issue_set_labelscase, etc.)legacyAliases; CHANGELOG entryVerification Plan
Then live-check one issue + one label operation and compare the advertised alias count (37 → 0).
Dependencies
None. Establishes the canonical baseline used by #49.
Fixed in
3d3537b, released as 0.8.5.legacyAliases: z.boolean().default(false)— the flag defaults to off, so the default boot payload drops by the measured 41,998 B / ~11k tokens.LEGACY_MAPis untouched,runHandlerstill maps an alias to its canonical tool + default action (lib/handlers.js:50), so a replayed session or a model echoing an alias name from stale history still works. Only the advertised surface shrinks.legacyAliases: truerestores the 0.8.4 name set:test/tool-surface.test.mjsbootsapply()against a stub registry and asserts 96 names by default, 133 with the flag, plus the exact canonical order.Measured after the change: canonical
full= 96 names / 65,159 B (byte-identical to 0.8.4),full+ aliases = 107,157 B.npm run check: 180 tests, leak scan and syntax clean. README config table + CHANGELOG entry document the flag.