Repository navigation
Restore automatic names for new Codex sessions - #213
Merged
webdevcody merged 2 commits intoNov 10, 2026
Merged
Conversation
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.
Contents: 🐛 Symptom · 🔍 Cause · ✅ Fix · 📸 Before / After · 🔁 State · 🧪 Proof ·⚠️ Risk · 🔧 Technical overview · 📝 Notes
New Codex sessions can now receive Nebula's first-prompt naming instruction when a Codex background server already exists. This keeps their hooks and tool commands attached to the session that launched them.
🐛 Symptom
New Codex sessions kept names such as
agent-1after receiving a task. Two recent affected local rows still had a pending automatic title and had never recorded a Codex session ID or prompt history, pointing to the hook delivery path before the rename operation.🔍 Cause
Codex can attach its TUI to an existing shared background server. Nebula supplied the session identity, callback URL and per-boot token to the new TUI process, while hooks ran in the shared server's older environment. With those variables absent, Nebula's hook guard exits before contacting the DAEMON, so the model never receives the naming instruction. A server inherited from another session can instead carry stale identity or authentication.
The installed home hooks still matched their persisted trust hashes when checked in an isolated copy. A live Codex 0.166.0 reproduction with a prestarted private server then confirmed the missing environment, and the same reproduction received all three variables with the fix.
✅ Fix
--no-daemonfor both new conversations and resumes.nebula renameflow stay in place.📸 Before / After
This changes DAEMON launch behavior, with no TUI layout change. Terminal output from an isolated live Codex probe provides the evidence instead of a PNG. It used a disposable Codex home, a synthetic trusted hook, a private tmux server, a prestarted private Codex server with no Nebula variables, and an invalid test key with the model endpoint directed to localhost. No real user session was resumed or changed.
The probe verified real CLI hook execution and environment inheritance, without a successful model completion. The final model-chosen title is covered by the manual checks below, not claimed as part of this probe.
🔁 State
flowchart TD A["TUI creates agent-N with automatic title pending"] --> B["DAEMON launches Codex with session environment"] B --> C["Before: TUI reuses shared Codex server"] C --> D["Hooks inherit older server environment"] D --> E["Hook guard exits; title stays pending"] B --> F["After: --no-daemon selects embedded server"] F --> G["UserPromptSubmit reaches HOOK RECEIVER"] G --> H["Reply injects nebula rename instruction"] H --> I["Model runs nebula rename"] I --> J["DAEMON persists title and broadcasts row"]🧪 Proof
--yolo, expected--no-daemon.cargo fmt --all -- --checkpassed.cargo clippy --workspace --all-targets --locked -- -D warningspassed.cargo test --workspace --locked -- --test-threads=1passed: 1,932 tests, 8 ignored. All 36 branch-switch tests also passed in isolation with one test thread.cargo build --workspace --lockedpassed.Verdict: 🟡 Merge with care — Codex now runs a server per Nebula session and needs a CLI supporting
--no-daemon.Rollback: Revert these commits to restore shared-server launch behavior and remove the launch-options field. There is no database migration or protocol-version change; titles already saved remain saved, and existing processes need a restart to change behavior.
🔧 Technical overview
crates/nebula-tui/src/event_loop/selection.rsassigns the temporary name andauto_title: truefor an unnamed session.crates/nebula-daemon/src/registry/spawn.rspersists that state before launching the PTY and setsNEBULA_AGENT_ID,NEBULA_API_URLandNEBULA_API_TOKEN. The managedUserPromptSubmitcurl forwards the HOOK RECEIVER'shookSpecificOutput.additionalContext; the model'snebula renamesendsAutoRenameAgent, which conditionally saves the sanitized title and broadcasts it. This flow remains unchanged.crates/nebula-core/src/harness.rsadds a defaultedlaunch_argslist, with["--no-daemon"]on built-in Codex and a replaceable override.crates/nebula-daemon/src/registry.rsplaces those arguments before resume subcommands and per-session flags. The command-override early return still bypasses them.docs/configuration.mddocumentsharnesses.codex.launch_args, the compatibility override, and the missing/misdirected-hook risk if isolation is removed.📝 Notes
The first default-parallel
cargo test --workspace --lockedrun passed all core/daemon/CLI/e2e tests, but failed two unmodified TUI branch-switch tests (discard_needs_a_second_pressandthe_cursor_opens_on_the_newest_branch_it_can_switch_to_and_the_filter_narrows). One could not spawngit(ENOENT); another test in the same process temporarily replacesPATH. PATH interference is the suspected cause. All 36 branch-switch tests and the full workspace passed with one test thread. Those unrelated files are unchanged; this was reported to the Captain for separate follow-up.To test locally:
make dev SEED=0). Add a test checkout there. Existing live sessions keep their old process environment until relaunched.agent-Nname to become a short descriptive title; session ID and prompt history should also be captured.Prepared using the repository's PR description skill, bug-fix template. Not merged; ready for Cody's review.
🤖 Generated with Codex