Skip to content

fix(codex): shrink the SessionStart gateway banner to one line - #8

Open
johnnyfish wants to merge 1 commit into
mainfrom
fix/codex-terse-session-banner
Open

fix(codex): shrink the SessionStart gateway banner to one line#8
johnnyfish wants to merge 1 commit into
mainfrom
fix/codex-terse-session-banner

Conversation

@johnnyfish

Copy link
Copy Markdown
Contributor

What

The Codex SessionStart hook printed a 4-line OneCLI gateway briefing into the thread on every session start:

• SessionStart hook (completed)
  hook context: OneCLI Gateway active. Call external APIs directly (plain curl/gh); requests are
  routed through the gateway and credentials are injected automatically. Never add Authorization headers.
    On errors: connect_url → ... blocked_by_policy → ... rate_limited → ... Details: onecli-gateway skill.

Intrusive: it's model-facing instruction leaking into the human's view, every session.

Why it can't just be hidden

Claude's SessionStart hook has two channels — systemMessage (user-visible one-liner) and hookSpecificOutput.additionalContext (model-only, invisible). Codex has no silent channel: it renders all hook output in the transcript, including additionalContext (confirmed — even our structured-envelope UserPromptSubmit hook shows as "hook context" in Codex). So the message is unavoidably user-visible.

Change

Collapse the banner to one terse line that still does its two real jobs:

  • signals the gateway is active, and
  • cues the onecli-gateway skill — whose own description says it loads on this prompt.

The detailed rules (no auth headers, curl-not-MCP, connect_url / blocked_by_policy / rate_limited error shapes) already live in that skill, so printing them in the transcript was pure duplication. New line:

OneCLI Gateway active — call external APIs directly with plain curl/gh (no auth headers); load the onecli-gateway skill for details.

Verification

  • npm run build (regenerated plugins/codex/hooks/session-start.mjs), npm run typecheck, npm run test — all green (12 workflow groups incl. codex_setup_status_cleanup, gateway_workflow_guidance).
  • Ran the built hook directly: emits exactly one line.

Companion

Pairs with onecli-cli #110, which removed the other (UserPromptSubmit) gateway block from Codex. Together they take Codex from two multi-line blocks per prompt down to one line per session.

Review

Fast path (one-line runtime-string change + rebuild). Self-reviewed for: behavior preservation (skill still cued; PreToolUse auto-source path untouched), scope (only printActiveMessage; setup/error messages unchanged), and build integrity (regenerated the committed .mjs artifact, not hand-edited). Full suite + typecheck green.

Codex renders hook output verbatim in the thread and has no silent
model-only channel (unlike Claude's additionalContext / systemMessage
split), so the SessionStart gateway message is unavoidably user-visible.
It was a 4-line briefing printed on every session start — intrusive.

Collapse it to a single terse line that still does its two jobs: signal
the gateway is active and cue the onecli-gateway skill (which the skill's
own description says loads on this prompt). The detailed rules (no auth
headers, curl-not-MCP, connect_url/blocked_by_policy/rate_limited error
shapes) already live in that skill, so restating them in the transcript
was pure duplication.

Verified: npm run build + typecheck + full test suite green; the built
hook now emits one line.
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