feat(context-engine): pass incoming prompt to assemble#50848
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5f8578161
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR adds an optional Key observations:
Confidence Score: 3/5
|
f5f8578 to
7eeb826
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7eeb826a5c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7eeb826 to
0977e91
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0977e912c1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if ( | ||
| isLegacy && | ||
| allowedKeys.some((key) => rejectedKeys.has(key) && hasOwnLegacyCompatKey(params, key)) | ||
| ) { | ||
| return method(withoutLegacyCompatKeys(params, rejectedKeys)); |
There was a problem hiding this comment.
Keep assemble retries active after sessionKey detection
If a strict legacy engine first rejects sessionKey in bootstrap(), compact(), or another earlier method, isLegacy becomes true with rejectedKeys = {"sessionKey"}. The fast path here then strips only sessionKey and calls assemble() directly, so a legacy engine that also rejects the new prompt field never reaches invokeWithLegacyCompat() and still throws. In the normal run path, runEmbeddedAttempt() calls contextEngine.bootstrap() before assemble() for resumed sessions, so prompt compatibility is still broken on existing session files.
Useful? React with 👍 / 👎.
0977e91 to
86d6fc3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86d6fc3e43
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| /\bmust not have additional propert(?:y|ies)\b.*['"`]prompt['"`]/i, | ||
| /\b(?:unexpected|extraneous)\s+(?:property|properties|field|fields|key|keys)\b.*['"`]prompt['"`]/i, | ||
| /\b(?:unknown|invalid)\s+(?:property|properties|field|fields|key|keys)\b.*['"`]prompt['"`]/i, | ||
| /['"`]prompt['"`].*\b(?:was|is)\s+not allowed\b/i, |
There was a problem hiding this comment.
Restrict prompt fallback to true unknown-field validation errors
For prompt-aware engines that reject a supplied prompt for semantic reasons, this new pattern is too broad: messages like 'prompt' is not allowed when search mode is disabled also match here, so invokeWithLegacyCompat() will classify the failure as legacy-schema incompatibility, strip prompt, and silently retry without retrieval instead of surfacing the real error. Because run.ts reuses the resolved engine across retries, one misclassified failure suppresses prompt-based assembly for the rest of that run.
Useful? React with 👍 / 👎.
86d6fc3 to
a551314
Compare
716cda3 to
b1745a1
Compare
Add optional `prompt` parameter to the ContextEngine.assemble() interface so retrieval-oriented context engines can use the user's query for relevance-based assembly. Uses conditional spread at the call site to ensure the key is truly absent when no prompt is provided. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b1745a1 to
282dc92
Compare
Add optional
promptparameter to the ContextEngine.assemble() interface so retrieval-oriented context engines can use the user's query for relevance-based assembly.Summary
ContextEngine.assemble()interface has no access to the current user prompt, so retrieval-oriented engines cannot use it for relevance-based context assembly.prompt?: stringto theassemble()params in the interface and forwardedparams.promptat the call site inattempt.ts. Added 2 tests.LegacyContextEngineis untouched — it doesn't use prompt and remains a pass-through. No behavioral change for existing engines.Change Type
Scope
Linked Issue/PR
None
User-visible / Behavior Changes
None — additive optional parameter on an internal interface.
Security Impact (required)
Repro + Verification
Steps
params.promptinassemble()promptis forwarded to the engine'sassemble()callExpected
params.promptcontains the user's message textActual
Evidence
forwards prompt to the underlying engineandomits prompt when not provided— both passCompatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
None — additive optional field with no behavioral change for existing code paths.