Summary
I am seeing a large session-specific delay before the first text event when running the same Codex prompt via ACPX session transport versus exec.
The issue reproduces both:
- inside a local wrapper (Idea OS) with an external 180s timeout
- outside the wrapper with direct ACPX benchmark commands and a 240s timeout
The dominant extra latency is before the first streamed event, not in session close.
Environment
acpx: 0.3.1
node: v22.22.1
- OS:
Linux ubuntu-8gb-nbg1-1 6.8.0-106-generic x86_64
Prompt characteristics
This is a real production-style prompt used as a text-generation-only engineer task:
system_prompt_len=3096
user_message_len=6712
text_only_prompt_len=10094
- source run id:
2026-03-21-web-agentic-009
Reproduction
Exec path
npx --yes acpx@latest \
--approve-reads \
--format quiet \
--timeout 240 \
codex exec "<same 10094-char prompt>"
Session path
npx --yes acpx@latest \
--format json \
--json-strict \
--cwd /opt/idea-os \
codex sessions ensure --name bench-65c98fac8228
npx --yes acpx@latest \
--approve-reads \
--format json \
--json-strict \
--cwd /opt/idea-os \
codex prompt --session bench-65c98fac8228 --file -
npx --yes acpx@latest \
--format json \
--json-strict \
--cwd /opt/idea-os \
codex sessions close bench-65c98fac8228
Observed results
Direct ACPX benchmark outside wrapper, timeout 240s
exec: completed in 208239ms
session: completed in 216148ms
session.ensure_duration_ms=8096
session.first_event_ms=190740
session.final_event_ms=216148
session.close_duration_ms=1222
session.poll_count=3321
session.first_event_type=text
session.final_event_type=done
JSON excerpt:
{
"metadata": {
"source_run_id": "2026-03-21-web-agentic-009",
"measure_timeout_seconds": 240,
"system_prompt_len": 3096,
"user_message_len": 6712,
"text_only_prompt_len": 10094
},
"exec": {
"transport": "exec",
"status": "completed",
"duration_ms": 208239
},
"session": {
"transport": "session",
"status": "completed",
"ensure_duration_ms": 8096,
"first_event_type": "text",
"final_event_type": "done",
"first_event_ms": 190740,
"final_event_ms": 216148,
"close_duration_ms": 1222,
"poll_count": 3321,
"timed_out": false
}
}
Same prompt inside wrapper with external timeout 180s
exec: external timeout at about 180.158s
session: external timeout at about 180.857s
- despite the outer timeout, the session runtime snapshot still shows:
start_session=10132ms
send_input=21ms
first_event=143870ms
final_event=169349ms
close_session=1049ms
poll_count=1692
first_event_type=text
final_event_type=done
Relevant snapshot excerpt:
{
"status": "failed",
"agent_runtime_summary": {
"latest": {
"provider": "acpx",
"transport": "session",
"final_status": "completed",
"first_event_type": "text",
"final_event_type": "done",
"poll_count": 1692,
"timed_out": false,
"session_phase_timings_ms": {
"start_session": 10132,
"send_input": 21,
"first_event": 143870,
"final_event": 169349,
"close_session": 1049
}
}
}
}
Interpretation
- the dominant session overhead is before the first event
close_session is small and does not explain the gap
- after the first text event, the session run finishes in about
25.4s
- the same pattern reproduces outside my wrapper, so this does not look like a local instrumentation bug
Expected behavior
For the same prompt, codex prompt --session should not spend ~190s before the first text event while codex exec completes in ~208s overall.
Question
Is there a known bottleneck in the ACPX Codex session path before first streamed output, or anything obvious I should inspect around session dispatch / load / stream initialization?
Summary
I am seeing a large session-specific delay before the first text event when running the same Codex prompt via ACPX session transport versus exec.
The issue reproduces both:
The dominant extra latency is before the first streamed event, not in session close.
Environment
acpx:0.3.1node:v22.22.1Linux ubuntu-8gb-nbg1-1 6.8.0-106-generic x86_64Prompt characteristics
This is a real production-style prompt used as a text-generation-only engineer task:
system_prompt_len=3096user_message_len=6712text_only_prompt_len=100942026-03-21-web-agentic-009Reproduction
Exec path
Session path
Observed results
Direct ACPX benchmark outside wrapper, timeout 240s
exec: completed in208239mssession: completed in216148mssession.ensure_duration_ms=8096session.first_event_ms=190740session.final_event_ms=216148session.close_duration_ms=1222session.poll_count=3321session.first_event_type=textsession.final_event_type=doneJSON excerpt:
{ "metadata": { "source_run_id": "2026-03-21-web-agentic-009", "measure_timeout_seconds": 240, "system_prompt_len": 3096, "user_message_len": 6712, "text_only_prompt_len": 10094 }, "exec": { "transport": "exec", "status": "completed", "duration_ms": 208239 }, "session": { "transport": "session", "status": "completed", "ensure_duration_ms": 8096, "first_event_type": "text", "final_event_type": "done", "first_event_ms": 190740, "final_event_ms": 216148, "close_duration_ms": 1222, "poll_count": 3321, "timed_out": false } }Same prompt inside wrapper with external timeout 180s
exec: external timeout at about180.158ssession: external timeout at about180.857sstart_session=10132mssend_input=21msfirst_event=143870msfinal_event=169349msclose_session=1049mspoll_count=1692first_event_type=textfinal_event_type=doneRelevant snapshot excerpt:
{ "status": "failed", "agent_runtime_summary": { "latest": { "provider": "acpx", "transport": "session", "final_status": "completed", "first_event_type": "text", "final_event_type": "done", "poll_count": 1692, "timed_out": false, "session_phase_timings_ms": { "start_session": 10132, "send_input": 21, "first_event": 143870, "final_event": 169349, "close_session": 1049 } } } }Interpretation
close_sessionis small and does not explain the gap25.4sExpected behavior
For the same prompt,
codex prompt --sessionshould not spend ~190s before the first text event whilecodex execcompletes in ~208s overall.Question
Is there a known bottleneck in the ACPX Codex session path before first streamed output, or anything obvious I should inspect around session dispatch / load / stream initialization?