issue-189: Implement the penpot_whoami tool and wire the extension entry point #222
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!222
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-189/implement-the-penpot-whoami-tool-and-wire-the-exte"
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?
189: Implement the penpot_whoami tool and wire the extension entry point
Closes #189 — 189.
Generated in 9m 33s.
Review findings
I'll start by exploring the repository and understanding the current state.Now let me apply the High severity fix to
whoami.ts:Now the Medium and Low findings:All gates re-run: penpot suite 68/68 pass, stricttsc --noEmitoverextensions/penpot/src/**/*.ts(sources + tests) clean, rootnpm testunchanged at 194/195 with the same pre-existinglocal-install.test.mjs:1875failure.Review Findings — 189
Summary
Fixed every finding in the anchored penpot change. The High finding is resolved by making
penpot_whoamisignal failure the way pi actually observes it:errorResultwas replaced with afailToolhelper that throws (throw new Error(error.message)), since pi only setsisErrorforexecute()calls that throw —AgentToolResulthas noisErrorfield and returning a value never sets the flag. The now-inertisErrorinterface member, its docstrings, and the sixresult.isError/details.errorassertions inwhoami.test.tswere removed, and the failure tests now assert on the thrown error's message via arunToolFailure()helper. The unreachabledetails.errorpayload was dropped fromWhoamiToolDetailsaccordingly. Medium 1 was fixed by re-scoping rule 2 of thedecodeErrorBodydocstring (raw Transit excerpt omitted when status guidance applies; body still onPenpotError.rawBody). Medium 2 was fixed by updating both stale README descriptions (README.md:38,README.md:143) to namepenpot_whoami. Low was fixed by adding an[Unreleased] → AddedCHANGELOG bullet covering the tool,PENPOT_URL/PENPOT_TOKEN, and theAuthorization: Token <token>scheme.One part of the High finding's suggested fix was deliberately not applied:
extensions/forgejo/src/index.ts:143uses the same inertisErrorpattern, but it is a separate extension with its own jest suite and 69isErrorassertions acrossextensions/forgejo/tests/tools.test.ts; rewriting it is out of scope for issue 189 and too large/risky for this single pass, so it is left for its own change. Nothing from the review remains unresolved within the penpot change itself.Critical
High
isError: trueon the result object, but pi only marks a tool call as failed whenexecutethrows:AgentToolResulthas noisErrorfield (pi-agent-core/dist/types.d.ts:316),executePreparedToolCallreturns{ result, isError: false }for any normally-returned value, and the official docs state "Returning a value never sets the error flag regardless of what properties you include in the return object" (@earendil-works/pi-coding-agent/docs/extensions.md:1984). Consequently the docstring at whoami.ts:65-68 and the assertions at whoami.test.ts:157,174,197,214,237 encode behaviour that does not exist, and the tool's headline failure (missing/expiredPENPOT_TOKEN) is reported to the model/UI as a successful call. Suggested fix: inerrorResult(whoami.ts:107),throw new Error(error.message)so pi catches it, setsisError: trueand reports the message without a stack trace, then update the tests toassert.rejects; or, if the details payload must be retained, keep returning the text but delete theisErrorinterface/claims and stop asserting the flag.extensions/forgejo/src/index.ts:143shares this inert pattern, so fix both together to avoid re-introducing it in the later penpot tools.Medium
decodeErrorBodydocstring now contradicts the implementation: rule 2 says Transit bodies "always include the raw excerpt", but the new status-guidance branch (errors.ts:402-412) deliberately omits it for 401/403/404 bodies. Suggested fix: reword rule 2 so the raw-excerpt statement is scoped to Transit bodies without status guidance, and note that the untouched body is still carried onPenpotError.rawBody.penpot_whoamiis registered; the repository-layout entry at README.md:143 repeats the same stale wording. Suggested fix: update both to name the registered tool, e.g. "penpot_whoami(verifyPENPOT_URL/PENPOT_TOKEN) — more tools to follow; needsPENPOT_URL/PENPOT_TOKEN".Low
[Unreleased]section has no entry for the first user-visible penpot tool, while comparable extension work is recorded (e.g. the mongodb registration at CHANGELOG.md:11). Suggested fix: add an### Addedbullet describingpenpot_whoami, thePENPOT_URL/PENPOT_TOKENconfiguration, and theAuthorization: Token <token>scheme.Documentation
Updated files: