Skip to content

Add WARP_PLUGIN_DISABLE_PROJECT env var to skip project field#23

Open
damonjanis wants to merge 1 commit intowarpdotdev:mainfrom
damonjanis:add-disable-project-env-var
Open

Add WARP_PLUGIN_DISABLE_PROJECT env var to skip project field#23
damonjanis wants to merge 1 commit intowarpdotdev:mainfrom
damonjanis:add-disable-project-env-var

Conversation

@damonjanis
Copy link
Copy Markdown

Summary

Adds an opt-in env var, WARP_PLUGIN_DISABLE_PROJECT=1, that causes build-payload.sh to omit the auto-derived project field from the payload sent to Warp.

Motivation

Every hook (prompt_submit, post_tool_use, session_start, stop, notification, permission_request) sends project = basename(cwd) to Warp via OSC 777. Warp uses that value to label the CLI agent's tab.

That's a sensible default, but it fights with users who rename their tab explicitly — for example via a tool that sets the tab title through OSC escapes, or a tmux/terminal title they've set by hand. Because the plugin fires on every prompt, it re-asserts project and clobbers the user's title within a second or two.

There's currently no way to opt out without forking the plugin. An env var gate is the smallest possible change and keeps the default behavior identical for everyone who doesn't set it.

Change

One conditional in plugins/warp/scripts/build-payload.sh. If WARP_PLUGIN_DISABLE_PROJECT is set (to any non-empty value), project stays empty and Warp falls back to whatever title is already on the tab.

Test plan (not yet run — suggested verification)

  • With env var unset: payload still contains project = basename(cwd) (default behavior unchanged).
  • With WARP_PLUGIN_DISABLE_PROJECT=1: payload's project field is empty; a tab title set via other means is no longer overridden on subsequent prompts.

Happy to adjust the env var name, add tests in tests/test-hooks.sh, or add docs if you'd prefer a different convention.

When the 'project' field is included in the payload, Warp uses it to
label the CLI agent's tab. That's useful by default, but it fights with
users who rename their tab explicitly (e.g. via Claude Code's /rename,
or a tmux/window title they've set by hand), because the plugin fires on
every prompt submit and re-sends project = basename(cwd).

Setting WARP_PLUGIN_DISABLE_PROJECT=1 omits the field so Warp falls back
to whatever title is already set. Default behavior is unchanged.
yigitkonur added a commit to yigitkonur/claude-code-warp that referenced this pull request Apr 21, 2026
Covers every hook in the Claude Code lifecycle so the Warp sidebar
reflects real agent state instead of getting stuck on In progress /
Blocked.

State coverage
- PostToolUse now fires for every tool (matcher removed). A `.blocked`
  marker dropped by PermissionRequest gates emission so we don't flood
  Warp with tool_complete on every Read/Glob/Grep — auto-approved tools
  skip emission entirely. Fixes stuck-Blocked without re-introducing the
  200+ GB leak reported in warpdotdev#22.
- New PreToolUse hook emits tool_start for live per-tool sidebar signal.
- SubagentStart/Stop, PermissionDenied, PostToolUseFailure, PreCompact,
  PostCompact, CwdChanged, SessionEnd get dedicated scripts with a
  v3-only event gate (WARP_CLI_AGENT_V3_EVENTS=1). When unset, they emit
  v2-compatible fallbacks so the sidebar state still moves on stable
  Warp builds.

Fresh-tab parity with Gemini/Droid
- on-session-start.sh for source=startup emits nothing. Warp's
  process-detection registers the sidebar row without a state pill,
  matching Gemini CLI and Factory/Droid (neither registers a Warp hook).
  First OSC event fires on UserPromptSubmit. plugin_version moved onto
  prompt_submit so Warp's outdated-plugin banner still has a signal.
- For resume/clear/compact, session_start still emits with enrichment
  since those genuinely change state.

Payload hygiene
- build-payload.sh strips empty-string --arg values so Warp doesn't see
  model:"" / permission_mode:"" as "still initializing".
- Early-exit on empty session_id avoids stray emissions to the wrong row.
- utf8_truncate helper — codepoint-aware, preserves multi-byte integrity.

Reliability
- PPID-walk TTY detection in warp-notify.sh (ports warpdotdev#19). Hook
  subprocesses often lack /dev/tty; walk the parent chain to find one.
- hooks.json quotes ${CLAUDE_PLUGIN_ROOT} (ports warpdotdev#26) — Windows paths
  with spaces no longer break every hook.
- async:true removed from Stop/StopFailure/SubagentStop. Claude Code was
  killing async hooks before they finished emitting in -p mode, causing
  tool_complete / stop emissions to silently drop.
- -p headless mode: on-session-{start,end}.sh skip emission with no tty.

Configurability
- CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 opts out of prompt-as-title
  (ports warpdotdev#24 — users driving tab titles via kitty/tmux/shell hooks).
- WARP_PLUGIN_DISABLE_PROJECT=1 drops the project envelope field
  (ports warpdotdev#23).

Debugging
- New scripts/warp-log.sh logs every hook input and every OSC emit to
  \${TMPDIR:-/tmp}/warp-claude-\${SESSION_ID}.log with sub-second
  timestamps. /tmp/warp-claude-latest.log is a symlink for tail -f.
  WARP_KEEP_LOGS=1 preserves logs past SessionEnd.

Prompt lifecycle
- session_title on prompt_submit labels the sidebar row with the first
  prompt text instead of the generic "Claude Code".
- duration_ms on stop, computed from a t0 timestamp stashed on
  prompt_submit.
yigitkonur added a commit to yigitkonur/claude-code-warp that referenced this pull request Apr 21, 2026
Covers:
  - What the v3 fork changes relative to upstream v2 (table of fixes
    with links to resolved upstream issues warpdotdev#19/warpdotdev#22/warpdotdev#23/warpdotdev#24/warpdotdev#26)
  - Install / uninstall / rollback commands
  - Env-var configuration: WARP_CLI_AGENT_V3_EVENTS, WARP_KEEP_LOGS,
    CLAUDE_CODE_DISABLE_TERMINAL_TITLE, WARP_PLUGIN_DISABLE_PROJECT
  - R5 fallback mapping (v3-only events → v2-compatible shapes)
  - Debugging workflow via `tail -f /tmp/warp-claude-latest.log` with
    a sample event trace from a real session
  - Running the test suite
yigitkonur added a commit to yigitkonur/claude-code-warp that referenced this pull request Apr 21, 2026
3.0.0 → 3.0.5 captures the expanded sidebar state coverage, fresh-tab
zero-emission (Droid/Gemini parity), PostToolUse memory-leak gate, and
five upstream-issue backports: warpdotdev#19 (TTY PPID walk), warpdotdev#22 (leak
mitigation via .blocked marker), warpdotdev#23 (WARP_PLUGIN_DISABLE_PROJECT),
warpdotdev#24 (CLAUDE_CODE_DISABLE_TERMINAL_TITLE), warpdotdev#26 (quote CLAUDE_PLUGIN_ROOT).
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