Fix WS auth + gym release directive TypeScript error#16
Merged
iamlukethedev merged 2 commits intoMar 21, 2026
Conversation
The allowWs callback was never actually calling accessGate.allowUpgrade during the WS handshake - the ws library passes (info) not (req), and verifyClient must be set on the WebSocketServer constructor options. Fix: pass verifyClient to WebSocketServer constructor and wrap allowUpgrade to extract info.req. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add "release" value to OfficeGymDirective type for symmetry with
OfficeQaDirective ("qa_lab" | "release"). Previously OfficeGymDirective
was only "gym" with no release state, making the "!== 'release'"
check in eventTriggers.ts dead code that TypeScript flagged as an
unintentional comparison.
Changes:
- deskDirectives.ts: add "release" to OfficeGymDirective type
- deskDirectives.ts: add gym release patterns to skill and command
directive resolvers (e.g. "leave the gym", "done with skills")
- eventTriggers.ts: change !== "release" to === "gym" for clarity
and consistency with reduceOfficeGymHoldState pattern
This fixes: #15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
iamlukethedev
approved these changes
Mar 21, 2026
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.
Summary
Fixes two bugs reported in issue #15:
Bug 1: WebSocket auth failure ("closed before connection is established")
The
allowWscallback was never callingaccessGate.allowUpgradeduring the WS handshake — thewslibrary passes(info)not(req), andverifyClientmust be set on theWebSocketServerconstructor options.Bug 2: TypeScript error on gym directive comparison
OfficeGymDirectivewas"gym"only (no"release"value), making!== "release"dead code that TypeScript flagged. The better fix adds"release"support for symmetry withOfficeQaDirective.Files changed
server/gateway-proxy.jsverifyClientto WebSocketServer constructorserver/index.jsallowWstoverifyClientcallbacksrc/lib/office/deskDirectives.ts"release"toOfficeGymDirectivetype + release patternssrc/lib/office/eventTriggers.ts!== "release"to=== "gym"Test plan
/api/gateway/wsare gated byaccessGate.allowUpgrade🤖 Generated with Claude Code