Skip to content

feat: send task-derived agent name as session/new _meta.sessionTitle for codex - #1392

Merged
panghy merged 4 commits into
mainfrom
feat/3151-codex-session-title
Aug 22, 2026
Merged

panghy merged 4 commits into
mainfrom
feat/3151-codex-session-title

Conversation

@panghy

@panghy panghy commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Delegated Codex threads appear in the Codex app titled from the prepended system prompt ("Delegating Tasks Before delegating, list the tasks…"), because Intent delivers the assembled Codex system prompt through a first-turn prepend (the pinned codex-acp adapter ignores _meta.developerInstructions, #479) and Codex title derivation sees that common heading first.

Change

Send the existing task-derived Intent agent name out of band as session/new _meta.sessionTitle for the codex provider:

  • build_session_meta gains a session_title parameter; for codex it emits { "sessionTitle": "<agent name>" } (trimmed, only when non-blank) and nothing else — the system prompt stays on the first-turn prepend and is never moved into _meta.
  • Both session/new paths carry the title: open_acp_session (initial create) and recreate_acp_session (the resume-impossible fallback), sourced from the stored agent session's name.
  • The resume path (load_acp_session → session/load) passes None — durable resume behavior is unchanged.
  • Other providers are unchanged (claude-code _meta shape untouched; all other providers still build no _meta).

Backward compatible: older codex-acp adapters ignore unknown _meta fields. Upstream adapter support is proposed in agentclientprotocol/codex-acp#338; the end-to-end fix requires a released adapter containing it.

Tests

  • tests_meta.rs: codex _meta carries only sessionTitle regardless of prompt; title trimming; no _meta without a usable title (resume/blank-name cases); other-provider tests updated for the new signature.
  • tests.rs: wire-level tests via a recording mock agent asserting the exact session/new params._meta on the create and recreate paths, and that codex session/load carries no _meta.

Verification

  • cargo fmt --check — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test — green except 2 pre-existing environmental failures in intent-git auth::tests (daemon_helper_env_builds_parseable_helper, scoped_credential_env_builds_parseable_helper_without_token_bytes) that also fail on this branch with the change stashed and pass under a hermetic HOME/GIT_CONFIG_NOSYSTEM=1 — caused by the host's injected GIT_CONFIG_PARAMETERS credential-helper entries, unrelated to this change.

Fixes intent-hq/intent#3151

…for codex

Delegated Codex threads titled themselves from the prepended system
prompt because the system prompt travels via the first-turn prepend
fallback. Send the task-derived Intent agent name out of band as
session/new _meta.sessionTitle for the codex provider, on both the
create and recreate paths. The resume (session/load) path is unchanged,
the system prompt is never moved into _meta, other providers are
unchanged, and older adapters ignore the unknown field (backward
compatible; upstream support in agentclientprotocol/codex-acp#338).

Fixes intent-hq/intent#3151
@augmentcode

augmentcode Bot commented Aug 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary:

  • Adds Codex-specific ACP metadata for durable session titles.
  • Uses the stored agent name as `_meta.sessionTitle` on `session/new`.
  • Trims titles and omits metadata when the name is blank.
  • Keeps Codex system-prompt delivery on the existing first-turn prepend path.
  • Leaves Claude Code metadata behavior unchanged.
  • Leaves non-Codex providers without new metadata.
  • Applies the title on both initial session creation and recreate fallback.
  • Deliberately sends no title metadata on `session/load` resume.
  • Adds direct metadata unit tests for title-only shape and blank values.
  • Adds recording-mock tests for create, recreate, and resume request frames.
  • The change targets Codex thread titles that otherwise derive from the shared system prompt.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode 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.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@augmentcode augmentcode 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.

Deep Code Review Agent🐛

Review completed with 0 suggestions.

Reviewed commit: b150273

@panghy panghy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed for correctness, scope, test coverage, and doc accuracy. The change looks correct and well-scoped:

  • Correctness: the codex arm of build_session_meta emits { "sessionTitle": ... } only for a non-blank trimmed title; open_acp_session and recreate_acp_session (the two session/new paths) pass Some(&stored.name), and the session/load resume path passes None, so durable-resume behavior is unchanged. The system prompt stays on the first-turn prepend and is never moved into _meta.
  • Scope: claude-code ignores the new parameter (its _meta shape is byte-identical), all other providers still build no _meta, and no non-codex behavior changes.
  • Tests: tests_meta.rs covers the title-only shape (regardless of prompt), trimming, and the no-title/no-_meta cases; the wire-level tests in tests.rs assert the exact params._meta on create and recreate and the absence of _meta on session/load. I ran the suite locally in the worktree — all 30 codex/session-title tests (and the full agent_session module) pass. The recording mock follows the existing spawn_mock_agent_with_session_result pattern.

One doc gap outside the diff, flagging here since the file isn't part of this PR:

crates/intent-providers/ADDING_A_PROVIDER.md — the §2 SessionMeta mechanism row says build_session_meta "builds a provider-shaped _meta sent on session/new and session/load" and lists claude-code as the only provider. After this PR, codex also receives _meta (the sessionTitle shape) — but only on session/new/recreate, not session/load. The row is still technically correct as a system-prompt delivery table (codex's prompt still travels via FirstTurnPrepend), but build_session_meta is no longer claude-code-only and its _meta is no longer uniformly sent on both methods, so a future provider author following that table would get an incomplete picture. Suggest a small follow-up (or an amendment in this PR) noting the codex sessionTitle shape and that it is session/new-only.

Not approving per instructions; leaving as comments only.

Codex session titles added 2 commits August 22, 2026 00:08
…eate)

Address review: the sessionTitle path lacked coverage through the real
WSS transport. The mock fixture's MOCK_AGENT_SESSION_LOG seam now records
each session/new / session/load with the request's _meta verbatim, and a
new e2e drives a codex agent (hermetic providers.paths wrapper over the
mock fixture) over WSS asserting session/new carries exactly
{ sessionTitle: <agent name> } on the initial create and again on the
resume-impossible recreate after the idle child is SIGKILLed.
@panghy

panghy commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Review addressed:

  • ADDING_A_PROVIDER.md §2 SessionMeta row (review body): updated in 1482d62 — the row now covers both claude-code (system prompt, session/new + session/load) and codex (sessionTitle only, session/new only, system prompt still via FirstTurnPrepend).
  • Doc-comment wording nit: fixed in 1482d62.
  • WSS e2e coverage: added in 9415a85 — e2e_wss_codex_session_title.rs proves the sessionTitle _meta on the wire through the real WSS transport on both the create and recreate paths.

@panghy
panghy enabled auto-merge (squash) August 22, 2026 05:39
@panghy
panghy merged commit a15664a into main Aug 22, 2026
18 checks passed
@panghy
panghy deleted the feat/3151-codex-session-title branch August 22, 2026 05:41
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.

intentd: give delegated Codex ACP sessions task-derived titles

1 participant