fix(dashboard): make Codex permission requests visible in the dashboard#38
Merged
Conversation
Second-wave audit (#33 Tier-1), verified by hand. Native OpenCode permissions reach the dashboard as raw SDK events typed `permission.requested`/`permission.resolved`. The Codex bridge has no SDK passthrough — it emits `pilot.permission.pending`/`pilot.permission.resolved`, which matched NOTHING the dashboard listened for, so a Codex tool's approval banner never appeared (and, if it had, never cleared). Conservative dashboard-side alias (deliberately NOT changing the emitted event type — the notification pipeline consumes pilot.permission.pending for Telegram/push; renaming it would risk regressing those): - constants.js: add PERMISSION_PENDING_PILOT / PERMISSION_RESOLVED_PILOT. - sse.js: the PERMISSION_REQUESTED / PERMISSION_RESOLVED branches now also match the two pilot.* types (OR-extension, purely additive — native event strings unchanged). - Extracted the inline normalization into a shared sse/permission-normalize.js used by BOTH native and codex paths. The helpers are byte-equivalent to the original inline code (every field, every ?? fallback, every key preserved — fresh review confirmed via a field-by-field diff), so native rendering is unchanged. Codex payload parity verified: pending carries permissionID/title/ sessionID/permissionType/metadata; `pattern` is absent and degrades safely. All four Codex resolved exit paths (normal/timeout/disconnect) carry permissionID so the clear path works for every outcome. SSE is unnamed (data: only) so onmessage already receives these — no filter gate to widen. +11 tests. bun test 635/0, tsc clean. Independent fresh-context review: APPROVE, no blocking issues (native byte-equivalence proven). The one actionable nit (misleading FAILING: test-name prefixes) is fixed here. Refs #33
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
Resolves the Codex permissions invisible in the dashboard item of #33 (Tier-1; verified by hand).
Native OpenCode permissions reach the dashboard as raw SDK
permission.requested/permission.resolvedevents. The Codex bridge has no SDK passthrough — it emitspilot.permission.pending/pilot.permission.resolved, which matched nothing the dashboard listened for. Result: a Codex tool's approval banner never appeared, and would never clear.Fix — conservative dashboard-side alias
Deliberately not changing the emitted event type: the notification pipeline (Telegram/push) consumes
pilot.permission.pending; renaming it risks regressing those consumers. Fixed purely in the dashboard:constants.js: addPERMISSION_PENDING_PILOT/PERMISSION_RESOLVED_PILOT(named constants — no bare literals).sse.js: thePERMISSION_REQUESTED/PERMISSION_RESOLVEDbranches now also match the twopilot.*types — purely additive OR-extension, native event strings unchanged.sse/permission-normalize.jsused by both native and Codex paths. The fresh review verified the helpers are byte-equivalent to the original inline code via a field-by-field table (every field,??fallback order, and key name preserved) → native rendering is provably unchanged.Verification highlights
permissionID/title/sessionID/permissionType/metadata; missingpatterndegrades safely. All Codex resolved exits (normal/timeout/client-disconnect) carrypermissionID→ clear path works for every outcome.data:only) soonmessagealready receives these events;SSE_EVENTSis not a hard filter (the two types added there anyway for forward-compat)..d.tscompanions for the new JS follow the established in-repo pattern for testing vanilla dashboard JS from TS tests.Testing
pattern-absent safe default)bun test635/0 ·bunx tsc --noEmitcleanFAILING:test-name prefixes) is fixed.Independent off
main, dashboard-only — no overlap with #34–37.Refs #33 (Tier-1, partial — does not close).