Skip to content

[codex] Inject LSP diagnostics context#2

Merged
code-yeongyu merged 1 commit into
mainfrom
codex/posttooluse-lsp-hooks
May 16, 2026
Merged

[codex] Inject LSP diagnostics context#2
code-yeongyu merged 1 commit into
mainfrom
codex/posttooluse-lsp-hooks

Conversation

@code-yeongyu
Copy link
Copy Markdown
Owner

@code-yeongyu code-yeongyu commented May 16, 2026

Summary

  • Mirror PostToolUse LSP diagnostic failures into hookSpecificOutput.additionalContext.
  • Keep the existing decision: "block" feedback path so Codex still fixes the edited file immediately.
  • Add hook tests for the modern Codex output shape, multi-file filtering, and failed mutation short-circuit behavior.
  • Update built dist artifacts and README behavior docs.

Why

Codex now records PostToolUse additionalContext into model-visible conversation context. The LSP hook already blocked on diagnostics, but it did not use the context injection path that Codex, omo, and opencode-style post-tool integrations rely on for automatic follow-up behavior.

Validation

  • npm ci
  • npm test -- test/codex-hook.test.ts first failed before implementation, then passed after the fix
  • npm test
  • npm run check
  • bun --install=fallback /Users/yeongyu/.agents/skills/typescript-programmer/scripts/check-no-excuse-rules.ts src/codex-hook.ts test/codex-hook.test.ts
  • LSP diagnostics on changed TypeScript files
  • npm pack --dry-run
  • tmux hook CLI smoke: node dist/cli.js hook post-tool-use < test/fixtures/post-tool-use.json
  • tmux MCP smoke: printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/cli.js mcp

Review

  • External gpt-5.5 xhigh expert review approved the diff with no blocking findings or required missing tests.

Summary by cubic

Inject LSP diagnostics into PostToolUse hook output so Codex sees the same errors it blocks on and can auto-fix edits. Keeps decision: "block" behavior and adds tests for multi-file and failed mutation cases.

  • New Features
    • Mirrors diagnostic failures into hookSpecificOutput.additionalContext with hookEventName: "PostToolUse".
    • Includes only files with errors; skips clean files and unsupported extensions.
    • Short-circuits when a mutation tool fails (no diagnostics run). Tests cover new output shape, multi-file filtering, and failure short-circuit; README updated.

Written for commit a6e63cb. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@code-yeongyu code-yeongyu merged commit a4ddb31 into main May 16, 2026
6 checks passed
@code-yeongyu code-yeongyu deleted the codex/posttooluse-lsp-hooks branch May 16, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant