Skip to content

[pi] Name workspaces after the first prompt - #8866

Open
mrohan-sq wants to merge 9 commits into
manaflow-ai:mainfrom
mrohan-sq:mrohan/auto-name-first-prompt
Open

mrohan-sq wants to merge 9 commits into
manaflow-ai:mainfrom
mrohan-sq:mrohan/auto-name-first-prompt

Conversation

@mrohan-sq

@mrohan-sq mrohan-sq commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Context

Amp updates its workspace title when the first prompt starts. Pi should match that timing while generating its semantic title asynchronously, so prompt processing never waits. Pi workspaces can otherwise retain directory-derived titles because detached naming does not reliably start.

Summary

  • Trigger message-backed auto-naming on prompt submission.
  • Launch naming workers independently of hook lifetime.
  • Preserve live-setting and manual-title guards.
  • Cover first-prompt scheduling through delayed title application.

Dependencies

None.

Summary by CodeRabbit

  • New Features
    • Workspace auto-naming now starts earlier for supported message-backed agents.
    • Detached auto-naming can trigger automatically when supported, with safeguards for missing session or source context.
  • Bug Fixes
    • Auto-naming throttling now enforces a minimum transcript threshold.
    • Empty transcripts no longer trigger naming attempts.
    • Improved detached worker startup and executable resolution.
  • Tests
    • Updated coverage for initial prompts and empty inputs.
    • Added regression coverage for prompt-submit workspace naming.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Auto-naming now enforces transcript thresholds, launches detached workers directly, and triggers supported naming during message processing and turn completion. Integration coverage verifies that a Pi prompt applies the expected workspace title.

Changes

Auto-naming workflow

Layer / File(s) Summary
Transcript eligibility and throttle floor
CLI/CMUXCLI+AutoNaming.swift, cmuxTests/AutoNamingHookPayloadAdapterTests.swift
Empty caches return zero. Non-empty caches use the configured minimum transcript-line floor. Tests cover both cases.
Supported detached worker launch
CLI/CMUXCLI+AutoNamingGenericHooks.swift, CLI/CMUXCLI+AutoNamingHooks.swift
Supported sessions use a guarded entry point and direct Process execution. Executable paths are validated, and hook arguments bypass a shell wrapper.
Message and turn-end integration
CLI/cmux.swift, cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
Message and turn-end paths invoke detached auto-naming. Mock-server support and Pi integration coverage verify workspace.set_auto_title.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PiPromptSubmit
  participant CMUXCLI
  participant DetachedWorker
  participant AgentHookMockServer
  PiPromptSubmit->>CMUXCLI: submit prompt
  CMUXCLI->>DetachedWorker: start supported auto-naming pass
  DetachedWorker->>AgentHookMockServer: send workspace.set_auto_title
  AgentHookMockServer-->>DetachedWorker: return configured title result
Loading

Possibly related PRs

Suggested reviewers: austinywang, azooz2003-bit


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Cmux User-Facing Error Privacy ❌ Error The PR exposes internal agent names ('claude', 'codex', 'pi', 'grok', 'omp') to users via the workspace.set_auto_title API in reportAutoNamingProblem, violating the rule against exposing internal p... Remove agent names from user-facing API calls, or sanitize them to generic terms like "summarizer". Pass provider details only in internal telemetry or sanitized logs.
Description check ⚠️ Warning The description explains the context and changes but omits the required Testing, Demo Video, Review Trigger, and Checklist sections. Add the required Testing, Demo Video, Review Trigger, and Checklist sections, and complete each applicable item.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Cmux Swiftui State Layout ❓ Inconclusive Custom check execution failed before a final verdict was produced. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (21 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: naming Pi workspaces after the first prompt.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed Production changes add no actor, async, Sendable reference, UI-store, or protocol declarations; CMUXCLI remains a synchronous Swift 5 CLI type, and tests are excluded.
Cmux Swift Blocking Runtime ✅ Passed Production code introduces no blocking synchronization. Changes remove blocking process management (process.terminate, kill, waitForProcessExit) from spawnDetachedAgentAutoName. Test code properly...
Cmux Browser Automation Off-Main ✅ Passed The PR changes only CLI auto-naming and related tests; rule-scoped TerminalController, socket policy, and policy tests are unchanged, with no new browser automation tokens.
Cmux Expensive Synchronous Load ✅ Passed The prompt-submit diff only validates support and launches a separate cmux hooks ... auto-name process; session-store and transcript parsing remain in that worker, with no new synchronous history...
Cmux Cache Substitution Correctness ✅ Passed The PR does not violate cache-substitution-correctness rules. The changes properly handle both cold (never-loaded) and stale (older-than-source) caches through multiple safeguards: (1) at line 125...
Cmux No Hacky Sleeps ✅ Passed All six changed files are Swift, so the non-Swift rule is out of scope. The only added waits are 5-second conditions in an XCTest, which the rule allows as test scaffolding.
Cmux Algorithmic Complexity ✅ Passed Changes use only O(1) operations and bounded collections (max 24 auto-name messages). No nested full-collection scans, per-target rescans, or unbounded algorithms in hot paths detected.
Cmux Swift Concurrency ✅ Passed The production diff adds no DispatchQueue, Combine, completion-handler, or fire-and-forget Task patterns; it launches the required independent worker with Process.
Cmux Swift @Concurrent ✅ Passed The Swift diff adds only synchronous auto-naming functions. It adds no async, nonisolated, @concurrent, or actor-isolated code; Process.run launches the worker without blocking.
Cmux Swift Package Boundaries ✅ Passed The diff adds CLI hook/process orchestration and a small throttle fix; AutoNamingEngine predates the diff, and test changes are allowed, so no new reusable domain logic remains in the app target.
Cmux Swiftpm Lockfiles ✅ Passed The cumulative PR diff changes only six Swift source/test files and includes no Package.swift, Package.resolved, .gitignore, workflow, or Xcode project dependency changes.
Cmux Swift Logging ✅ Passed The PR adds no production print, debugPrint, dump, NSLog, Logger, or diagnostic file/stdout logging; new printf and stderr references are test harness code.
Cmux Full Internationalization ✅ Passed Production changes add no user-facing copy; added literals are CLI/protocol tokens, and only tests add display text. No catalog, locale, or web message files changed.
Cmux Architecture Rethink ✅ Passed Production changes use a shared detached helper, direct Process launch, and session-store/socket guards; no new timing workaround, lock, observer, side channel, or UI owner was added. FIFO sync is...
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS: The PR changes only CLI auto-naming and test code. No standalone NSWindow, NSPanel, Window, WindowGroup, or close-shortcut routing is added or materially changed.
Cmux Source Artifacts ✅ Passed The PR changes only six intentional Swift source and test files; no artifact directories, logs, caches, build output, screenshots, or generated files enter the diff.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The PR changes only CLI/ and cmuxTests/ Swift files; no changed Swift file is under a production /Sources/ path, and no test/debug seam was added there.
Cmux No Ambient Global State ✅ Passed Production additions are CMUXCLI instance methods or a private instance helper; the existing AutoNamingEngine method was only modified, with no new global mutable state, static namespace, or single...
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mrohan-sq mrohan-sq changed the title Name workspaces after the first prompt [pi] Name workspaces after the first prompt Jul 24, 2026
@mrohan-sq
mrohan-sq marked this pull request as ready for review July 24, 2026 15:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLI/CMUXCLI`+AutoNamingHooks.swift:
- Around line 121-132: Update the executable-path selection logic around
ProcessInfo.arguments.first and
normalizedHookValue(env["CMUX_BUNDLED_CLI_PATH"]) to require each resolved path
to be a non-directory regular file in addition to passing the executable check.
Preserve the existing priority order, and fall back to cmux when neither
candidate qualifies.

In `@cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift`:
- Around line 80-116: Make the async regression test around runAgentHook
deterministic and verify non-blocking behavior: replace the pi mock’s fixed
sleep with a test-controlled release signal, invoke the hook, and assert it
returns before releasing the signal. Then release the mock summarizer and retain
the existing wait for workspace.set_auto_title, using the repository’s
established Swift completion-signal utilities instead of wall-clock sleeps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5066aa8f-68b3-431e-b476-98888a3a0701

📥 Commits

Reviewing files that changed from the base of the PR and between 69b2c55 and 7632368.

📒 Files selected for processing (6)
  • CLI/CMUXCLI+AutoNaming.swift
  • CLI/CMUXCLI+AutoNamingGenericHooks.swift
  • CLI/CMUXCLI+AutoNamingHooks.swift
  • CLI/cmux.swift
  • cmuxTests/AutoNamingHookPayloadAdapterTests.swift
  • cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift

Comment thread CLI/CMUXCLI+AutoNamingHooks.swift
Comment thread cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift Outdated
@greptile-apps

greptile-apps Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR advances workspace auto-naming for Pi (and similar message-backed agents) to trigger on prompt submission rather than waiting for the agent to stop, matching Amp's existing behavior. It also hardens the detached-worker spawn path by replacing the shell-mediated &-backgrounding approach with a direct Process.run() call and a more robust executable-path resolution that handles relative paths and symlinks.

  • Prompt-submit auto-naming: A new usesHookMessageCacheForAutoNaming guard on the prompt-submit hook path immediately spawns a detached naming worker for message-backed agents; the worker blocks internally on the Pi summarizer while the hook returns, keeping the interactive path unblocked.
  • Simplified stop path: The pre-spawn socket probe (workspace.set_auto_title with probe: true) is removed from the outer .stop guard; live-setting and user-owned checks are now delegated entirely to the spawned worker's own probe, which means a short-lived worker process is always created on turn-end for supported agents regardless of whether the setting is enabled.
  • Line-equivalent floor fix: hookMessageLineEquivalentCount now returns max(minTranscriptLines, count * minLineGrowth) for non-empty inputs, so a single first-prompt message satisfies the shared throttle floor and triggers naming immediately.

Confidence Score: 5/5

Safe to merge; the new prompt-submit naming path is well-guarded and the regression test reliably verifies end-to-end behavior through the Pi summarizer gate.

The core behavior change — triggering workspace naming on prompt submission for message-backed agents — is correctly implemented and covered by a solid FIFO-gated integration test. The direct Process.run() approach is more robust than the previous shell-mediated backgrounding, and Foundation's NSTask retains the child internally until exit. The two design trade-offs carried forward from the prior round (unnecessary worker spawns when auto-naming is disabled, and the 1-message/2-message line-equivalent floor collision) were already flagged and are both cosmetic/minor in practice.

No files require special attention beyond the design trade-offs noted in prior review rounds.

Important Files Changed

Filename Overview
CLI/CMUXCLI+AutoNaming.swift Adds a zero-return guard for empty message caches and floors the line-equivalent at minTranscriptLines, making a single first-prompt message sufficient to pass the throttle; count=1 and count=2 now both map to the same floor (12), so the assistant's first response is never incorporated until a third message arrives.
CLI/CMUXCLI+AutoNamingGenericHooks.swift Adds spawnDetachedAgentAutoNameIfSupported as a thin guard wrapper around spawnDetachedAgentAutoName; correctly checks autoNamingSource and sessionId before spawning, and documents that live-setting and ownership checks are delegated to the worker.
CLI/CMUXCLI+AutoNamingHooks.swift Replaces shell-mediated background spawning (bin/sh -c "... &") with direct Process.run(); adds relative-path resolution for argv[0] and a symlink-aware isExecutableRegularFile helper; removes the old waitForProcessExit/SIGKILL lifecycle management, relying on Foundation's internal NSTask monitoring to avoid zombies.
CLI/cmux.swift Adds prompt-submit auto-naming for message-backed agents and simplifies the stop path by removing the pre-spawn socket probe; the live-setting check moves fully into the worker, which means a worker process is always spawned on turn-end for supported agents even when auto-naming is disabled by the user.
cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift Adds testPiPromptSubmitStartsWorkspaceAutoNaming, a well-structured regression test that uses a named FIFO to gate the Pi summarizer and verifies both that the hook returns before naming completes and that the correct title is applied after release; also extends the mock server to handle workspace.set_auto_title per-test.
cmuxTests/AutoNamingHookPayloadAdapterTests.swift Updates the existing throttle-floor test to cover a single-message input (confirming it reaches minTranscriptLines) and adds an assertion that an empty slice returns 0; clean and correct.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant H as Hook Process
    participant W1 as AutoName Worker (prompt)
    participant W2 as AutoName Worker (stop)
    participant Pi as Pi Summarizer
    participant S as cmux Socket

    U->>H: prompt-submit hook (Pi agent)
    H->>H: usesHookMessageCacheForAutoNaming?
    H->>W1: spawnDetachedAgentAutoNameIfSupported()
    Note over H,W1: process.run() — non-blocking
    H-->>U: hook returns immediately

    W1->>S: workspace.set_auto_title probe
    S-->>W1: "enabled=true, user_owned=false"
    W1->>Pi: invoke Pi summarizer
    Pi-->>W1: Java Workspace
    W1->>S: workspace.set_auto_title (title)

    U->>H: stop hook (turn complete)
    H->>W2: spawnDetachedAgentAutoNameIfSupported()
    Note over H,W2: process.run() — non-blocking
    H-->>U: hook returns immediately

    W2->>S: workspace.set_auto_title probe
    S-->>W2: "enabled=true, user_owned=false"
    W2->>Pi: invoke Pi summarizer (full transcript)
    Pi-->>W2: refined title
    W2->>S: workspace.set_auto_title (refined title)
Loading

Reviews (2): Last reviewed commit: "fixup! Add first-prompt auto-naming regr..." | Re-trigger Greptile

@mrohan-sq
mrohan-sq force-pushed the mrohan/auto-name-first-prompt branch from 84543e7 to 3f9588a Compare August 5, 2026 16:30
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLI/CMUXCLI`+AutoNamingHooks.swift:
- Around line 153-155: Update the detached worker launch in
spawnDetachedAgentAutoName to enforce a whole-worker deadline, owner/lifetime
handling, and termination escalation through SIGKILL cleanup. Keep direct
process execution, but reuse runProcess if it already provides this timeout and
cleanup behavior, ensuring stalls before the child’s llmTimeout cannot leave the
auto-name process running indefinitely.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e38e6aee-4a8e-443c-8b68-ede305a5e018

📥 Commits

Reviewing files that changed from the base of the PR and between 2d9ba4b and 3f9588a.

📒 Files selected for processing (6)
  • CLI/CMUXCLI+AutoNaming.swift
  • CLI/CMUXCLI+AutoNamingGenericHooks.swift
  • CLI/CMUXCLI+AutoNamingHooks.swift
  • CLI/cmux.swift
  • cmuxTests/AutoNamingHookPayloadAdapterTests.swift
  • cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift

Comment on lines 153 to 155
do {
// Launch the bounded worker directly; the short-lived hook process must not own its lifetime.
try process.run()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files | rg '(^|/)CLI/CMUXCLI\+AutoNamingHooks\.swift$|AutoNaming|auto-name|llmTimeout|summarize' || true

echo
echo "Target file outline:"
ast-grep outline CLI/CMUXCLI+AutoNamingHooks.swift --view expanded || true

echo
echo "Target file around relevant lines:"
if [ -f CLI/CMUXCLI+AutoNamingHooks.swift ]; then
  nl -ba CLI/CMUXCLI+AutoNamingHooks.swift | sed -n '1,240p'
fi

echo
echo "Search timeout/termination wrapper refs:"
rg -n "llmTimeout|summarize|auto-name|die|SIGKILL|process\.run|Process|run\(\)" CLI CodeRabbit Inc . --glob '!*.{png,jpg,jpeg,webp,gif,svg,aar,swiftinterface,xcstrings}' | head -n 250

Repository: manaflow-ai/cmux

Length of output: 1212


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Install available line-number alternatives and inspect file:"
for f in CLI/CMUXCLI+AutoNamingHooks.swift CLI/CMUXCLI+.AutoNamingHooks.swift; do
  [ ${f%% *:-.} = "$f" ] || continue
done
wc -l CLI/CMUXCLI+AutoNamingHooks.swift
awk '{printf "%6d\t%s\n", NR, $0}' CLI/CMUXCLI+AutoNamingHooks.swift | sed -n '1,260p'

echo
echo "Search timeout/termination references:"
rg -n "llmTimeout|summarize|auto-name|SIGKILL|terminate\(|die|process\.run\(\)|Process\.init|run\(\)" -S . --glob '!*.{png,jpg,jpeg,webp,gif,svg,aar,swiftinterface,xcstrings}' || true

echo
echo "Diff around changed file if present:"
git diff -- CLI/CMUXCLI+AutoNamingHooks.swift | sed -n '1,240p' || true

Repository: manaflow-ai/cmux

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Limited source inspection for AutoNamingHooks and related auto-name files:"
for f in CLI/CMUXCLI+AutoNamingHooks.swift CLI/CMUXCLI+AutoNamingDispatch.swift CLI/CMUXCLI+AutoNamingGenericHooks.swift CLI/CMUXCLI+AutoNamingSummarizers.swift CLI/CMUXCLI+AutoNaming.swift; do
  if [ -f "$f" ]; then
    echo "===== $f: $(wc -l < "$f") lines ====="
  fi
done

echo "===== CLI/CMUXCLI+AutoNamingHooks.swift lines 1-240 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+AutoNamingHooks.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 1 <= i <= 240:
            print(f"{i:5d}\t{line}")
PY

echo "===== CLI/CMUXCLI+AutoNamingDispatch.swift lines 1-260 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+AutoNamingDispatch.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 1 <= i <= 260:
            print(f"{i:5d}\t{line}")
PY

echo "===== Search timeout/termination/cleanup refs excluding broad file types ====="
rg -n "llmTimeout|summarize|\.run\(\)|Process|SIGKILL|SIGTERM|terminate\(|kill|timeout|AutoNamingHooks|spawnDetachedAgentAutoName|runClaudeAutoNameHook|runCodexAutoNameHook" CLI --glob '*.swift' || true

echo "===== Git diff stats and hunks for renamed/deleted hook files ====="
git diff --stat -- '*AutoNamingHook*' '*AutoNamingDispatch*' || true
git diff -- '*AutoNamingHook*' '*AutoNamingDispatch*' | sed -n '1,260p' || true

Repository: manaflow-ai/cmux

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "===== CLI/CMUXCLI+AutoNamingGenericHooks.swift lines 1-220 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+AutoNamingGenericHooks.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 1 <= i <= 220:
            print(f"{i:5d}\t{line}")
PY

echo "===== CLI/CMUXCLI+AutoNamingSummarizers.swift lines 1-220 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+AutoNamingSummarizers.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 1 <= i <= 220:
            print(f"{i:5d}\t{line}")
PY

echo "===== CLI/CMUXCLI+AutoNaming.swift lines 1-260 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+AutoNaming.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 1 <= i <= 260:
            print(f"{i:5d}\t{line}")
PY

echo "===== CLI/CMUXCLI+Process.swift lines 290-500 ====="
python3 - <<'PY'
from pathlib import Path
p=Path('CLI/CMUXCLI+Process.swift')
if p.exists():
    for i,line in enumerate(p.read_text().splitlines(), 1):
        if 290 <= i <= 500:
            print(f"{i:5d}\t{line}")
PY

echo "===== Direct invocation helper usages ====="
rg -n "runAutoNamingSummarizer|runProcessData|runProcess\\(|cliRunProcess\\(|timeout:|process\\.run\\(|spawnDetachedAgentAutoName\\(|AgentHook|auto-name" CLI --glob '*.swift' | sed -n '1,220p'

Repository: manaflow-ai/cmux

Length of output: 50372


Add a process owner/deadline to the detached worker or apply runProcess with an existing timeout.

process.run() leaves spawnDetachedAgentAutoName with no owner or deadline. llmTimeout only covers the summary step inside the child; if the socket read, session-store check, or title apply stalls before then, the hook can leave an unbounded auto-name process. Keep direct execution, but preserve a whole-worker deadline, termination sequence, and SIGKILL cleanup in one of these entry points.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CLI/CMUXCLI`+AutoNamingHooks.swift around lines 153 - 155, Update the
detached worker launch in spawnDetachedAgentAutoName to enforce a whole-worker
deadline, owner/lifetime handling, and termination escalation through SIGKILL
cleanup. Keep direct process execution, but reuse runProcess if it already
provides this timeout and cleanup behavior, ensuring stalls before the child’s
llmTimeout cannot leave the auto-name process running indefinitely.

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Thank you for this, @mrohan-sq! Naming Pi workspaces after the first prompt is a great idea. One thing: this drops the cheap "is auto-naming on?" check, so every prompt and turn end now starts a naming worker even when auto-naming is off. Keeping that check up front and it's in good shape :)

@teamleaderleo teamleaderleo added enhancement New feature or request area: agents Agent integrations (Claude Code, Codex, ACP), agent chat, hooks, status S3: minor Wrong behavior with a workaround labels Sep 30, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator

Thanks for this! Before we can land it, please comment I have read the CLA Document v2.2 and I hereby sign the CLA :)

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document v2.2 and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@teamleaderleo teamleaderleo removed the S3: minor Wrong behavior with a workaround label Sep 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent integrations (Claude Code, Codex, ACP), agent chat, hooks, status enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants