Plan-issue seed states the literal arguments of its two Forgejo read calls #273
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck#273
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
Agents in plan-issue sessions consistently call
forgejo_read_issueandforgejo_list_issue_commentswith a parameter namedissue_number. The schema declaresnumber(plus the aliasindex), so the call fails validation and costs a round trip. This is the second time the same failure has appeared with a different wrong name: theindexalias innumberedParamsexists only because agents previously guessedindexjust as consistently.The cause is not naming taste, it is missing information:
customTools(apps/server/src/bridge/in-process.ts:323-329). A custom tool withoutloadModedefaults to"discoverable"(@oh-my-pi/pi-coding-agent/src/extensibility/custom-tools/types.ts:206-207), and deck setsloadModenowhere.xd://and removed from the top-level tool list (tools/xdev.ts:85-88,sdk.ts:4546-4554,session/session-tools.ts:1328-1333), so their JSON Schema never reaches the provider request.tools.xdevDocsdefaults to"catalog"(tools/settings.ts:1025-1029), so no device docs are inlined either. Each Forgejo tool's entire prompt-side presence is one catalog line: its name plus a description truncated to 200 bytes (tools/xdev.ts:364-367,XDEV_EXTERNAL_DESCRIPTION_CAP = 200at:253), followed by "Readxd://<tool>for full docs + JSON schema before first use".So the agent must produce an args object for a tool whose parameter names it has never been shown, and fills the gap from training priors. Priors are stable across sessions, which is exactly why the wrong name is consistent:
issue_numberis GitHub's REST/MCP name for this parameter, andindex— the previous consistent guess — is the Forgejo REST API's name for it. Addingindexas an alias made one prior correct without closing the gap, so the next-strongest prior surfaced. Addingissue_numberwould repeat that.Two aggravating facts, both confirmed by reading the code this session: the
.refine()that makes a number mandatory is an ArkType narrow dropped from the wire schema (@oh-my-pi/pi-ai/src/utils/validation.ts:1783-1785), so even the on-demand docs rendernumber?: number; index?: numberwith nothing marked required; and unknown keys are stripped beforefoldIndexAliasruns (omptype/src/zod.ts:405,extras: "delete"), so no deck-side tolerance can ever see a key the schema does not declare.The failure is concentrated in the plan-issue workflow, where these two calls are the first thing a session does. The fix is to stop making the agent infer the call: the plan-issue prompt already knows the issue number, so it states the argument objects verbatim. The tool schema is deliberately left untouched — no new alias, no change to
numberedParams.Approach
Both edits are independent; either order builds and leaves tests passing.
1. Deck plan-issue system context states both calls verbatim
In
apps/server/src/forgejo/plan-issue.ts,planIssueSystemContext(line 65) buildsseed; its issue branch (line 68) currently reads:Replace the first two sentences so the call arguments appear literally, with the known issue number substituted. The rest of the sentence (description/title handling) is unchanged:
Only the
b.issueNumber !== nullbranch changes. The inbox and free-text branches (lines 69-71) call neither tool and stay as they are. No other part of the returned template changes.2.
/plan-issuecommand states the same shapeIn
.omp/commands/plan-issue.md, step 1's issue bullet (line 12) currently reads:Replace it with the argument shape spelled out (the number is only known at runtime here, so
Nstays symbolic):Line 21 of the same file also names
forgejo_read_issuein the preflight; it instructs no call arguments and is left alone.3. Pin the rendered text
In
apps/server/src/forgejo/plan-issue.test.ts, inside the existingdescribe("planIssueSystemContext", …)block (line 37;baseis defined at line 38 withissueNumber: null), add a test next to the existing seed tests:This is the behaviour the change exists for — the number is interpolated into both argument objects — and it fails against the current text.
Nothing else is touched:
numberedParamsandfoldIndexAliasinapps/server/src/forgejo/tools/shared.tskeep thenumberfield and theindexalias exactly as they are, so workflows outside plan-issue (implementation sessions, comment-triggered sessions) keep the fallback they rely on.Critical files & anchors
apps/server/src/forgejo/plan-issue.ts:65-89—planIssueSystemContext; the issue branch ofseedis the only line to change. It is a TypeScript template literal, so the JSON braces need no escaping but the surrounding backticks do..omp/commands/plan-issue.md:11-17— step 1 "Resolve the seed"; only the#Nbullet changes.apps/server/src/forgejo/plan-issue.test.ts:37-56— the existingplanIssueSystemContexttests and thebasebinding to spread from.Verification
Prerequisite: workspace dependencies installed (
bun installat the repo root) — a barebunrun in this container failed on a missing transitive module, so install first if the suite cannot start.apps/server:bun test src/forgejo/plan-issue.test.tsThe new test must pass, and the three pre-existing
planIssueSystemContexttests must still pass. Confirm it is load-bearing by checking it fails before step 1 is applied.apps/server:bun run typecheck.N). Expected observable result: the session's first Forgejo tool call isforgejo_read_issuewith{"number": N}and succeeds — noValidation failed for tool "forgejo_read_issue"result and no retry — followed byforgejo_list_issue_commentswith{"number": N, "page": 1}.Assumptions & contingencies
planIssueSystemContextor run/plan-issue. If the wrong parameter name is later observed in implementation or comment-triggered sessions, apply the identical treatment toapps/server/src/bridge/session-policy.ts:643andapps/server/src/forgejo/conversation-detect.ts:318-321, which instruct the same two calls; do not add a schema alias.tools.xdevDocsis assumed to stay at its default"catalog". If it is ever set to"inline"or"builtins"with aforgejo_*glob intools.xdevInlineDevices(apps/server/src/model-config.ts:530-536is where deck would set it), full parameter schemas reach the prompt and this prompt text becomes redundant rather than wrong; leave it in place.