app-server: forwarded core events are cloned before bespoke handling
What variant of Codex are you using?
App Server
What feature would you like to see?
I found a potential performance concern in current app-server source rather than a confirmed user-visible bug. Please consider letting the bespoke event handler take ownership of the already-tracked forwarded core event instead of cloning it at the listener call site, while preserving event ordering and notification behavior.
Additional information
Evidence
- Source-proven:
thread_lifecycle.rs:309-354obtains each core event, tracks it through shared references, then passesevent.clone()toapply_bespoke_event_handling. - Source-proven:
bespoke_event_handling.rs:145-160acceptsEventby value and immediately destructures it; the listener has no later use of the original event. - Historical context only: closed, unmerged PR #29545 included this move in a larger throughput patch. Its bundled benchmark claims are not measurement for this report, and the audited current source retains the clone.
Impact
Not measured. Allocation throughput and listener latency have not been measured. The listener clones once for every core event that reaches bespoke handling, so the work may duplicate event-owned payload data and grow with event rate and payload size. No production impact has been observed.
Question
Would it make sense to move the event into apply_bespoke_event_handling after tracking and filtering, while retaining the current ordering and notification behavior?
I checked all relevant issues, comments, pull requests, discussions, and release notes; this report is not a duplicate.
I am reporting this finding only and am not proposing a pull request unless a maintainer invites one.
Disclosure
Investigated thoroughly with GPT-5.6 Sol (runtime-default reasoning effort), using Oh My Pi as the agent framework.
This report is not generic or unreviewed AI-generated output. Its claims were checked against the cited evidence, and it includes the relevant detail intended to help maintainers resolve the issue.
If reports like this are not useful to the project, please let me know and I will refrain from submitting similar ones. My intent is to help without wasting maintainer time or energy or discouraging their work.
Thank you for your work.