🤖 refactor: collapse PTC to exclusive-only (single PTC experiment, RLM sub-experiment) - #3963
🤖 refactor: collapse PTC to exclusive-only (single PTC experiment, RLM sub-experiment)#3963ThomasK33 wants to merge 19 commits into
Conversation
…iment Past evals showed supplement-mode PTC (code_execution alongside normal tools) measured ~2x tokens/cost vs both PTC-off and exclusive. Remove supplement mode entirely: - The programmatic-tool-calling experiment now always activates the exclusive posture (bridgeable tools hidden; code_execution + non-bridgeable tools + mcp_prompt_get model-visible). - Delete the programmatic-tool-calling-exclusive experiment ID and the programmaticToolCallingExclusive flag everywhere (schemas, IPC types, frontend subscriptions, CLI experiment builders, eval scenarios). - RLM gating simplifies to rlm && ptc via the central predicates (isRlmModeEnabled, resolveSlashCommandExperimentValue); RLM alone stays fully inert. - Delete rebuildCodeExecutionAfterAssembleHook and the retarget/ reconcile helper chain: they existed solely for supplement mode where hook-visible tools and the bridge coexisted. Exclusive mode keeps bridgeable tools out of the hook-visible record by design. - Stale persisted payloads (feature_flags.json overrides, sendOptions/ taskExperiments) are ignored, never rejected; covered by new stale-payload tests.
|
@codex review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd9ffb14e9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Fail closed when PTC exclusive assembly fails (no silent flat fallback) - Honor disable-all tool policies: skip code_execution synthesis when the policy leaves no tools (auto-compaction contract) - Keep policy-required tools model-visible so stop-when conditions can observe their top-level toolResults - Make memory/advisor (context-coupled) and attach_file/desktop_screenshot (media-producing) non-bridgeable so system-prompt context and media extraction keep working under the exclusive posture - Elide base64 media payloads from bridged (MCP) content-container results - Extract nested file_edit_* diffs/paths and agent_skill_read snapshots from code_execution records for compaction persistence - Alias the legacy programmatic-tool-calling-exclusive override onto PTC on read and mirror it back on write (upgrade keeps the posture; downgrade runs exclusive instead of 2x supplement)
|
Addressed all 7 review findings in acac952:
|
|
@codex review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acac9526a0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ases, nested media extraction, newest-first nested edit paths
|
@codex review Round 2 findings addressed in 4d90398:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d903985f2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…irror, kernel persistence records, outer-result media, bridge dedup
|
@codex review Round 3 findings addressed in 62cd5fd:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62cd5fd830
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ernel capture bounding, newest-first part traversal
|
@codex review Round 4 findings addressed in 96503f6:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96503f67f8
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: 96503f67f8
Only the user who started this review can view the report in Codex.
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…safe nested edit records, extractable-only media exemption
|
@codex review Round 5 findings addressed in 0918101:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0918101860
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…e_execution allowlist probe, CLI experiment alias, console media redaction
|
@codex review Round 6 findings addressed in c862f0e + afa7f45:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afa7f45d72
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: afa7f45d72
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…ure-bounded persistence shapes, aggregate media budget
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: 17c41950cc
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…dAttachmentMediaType; bound metadata labels in provider placeholders
|
Round 11 finding addressed in fde549e:
Validation: new unit tests — junk-MIME parts rejected at validation with bounded placeholder labels; serialized-charge backstop re-verified through well-formed parts hiding megabytes in |
|
@codex review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fde549ec3f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…e-bounded markers normally (preserve path attribution + failed-edit success bit)
|
Round 12 findings addressed in 60f9bbf:
Validation: extended the execution-budget integration test with post-overflow successful and failed edits (asserting |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60f9bbf4a9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…aceholder in provider requests
|
Round 13 finding addressed in b1c0ae2:
Validation: updated the deep-recursion test to bury a media payload at the leaf of a 50,000-deep chain and assert the provider copy contains the placeholder and not the payload; |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1c0ae24b0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…cords + direct parts)
|
Round 14 finding addressed in 8925af2:
Validation: new test covering both paths (nested array diff + direct object diff): paths still tracked, corrupt diffs dropped, no throw, and the well-formed sibling diff still combines. |
|
@codex review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8925af27a3
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…n (wrapped outer results and console args)
|
Round 15 finding addressed in ef0e7e0:
Validation: new test with the container wrapped in the outer result AND a console arg alongside the nested record — all three copies rewritten, one deduped attachment, sibling fields intact; deep-recursion and prior extraction tests unaffected; |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef0e7e07e2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: ef0e7e07e2
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
…e positive success bit for result-less edit/read records
|
Round 16 findings addressed in edef2b8:
Validation: new tests for the malformed edit record, the malformed read record, and untouched deep JSON; |
|
@codex review |
|
Round 16 security straggler addressed in 5472882:
Validation: the wrapped-media test now includes a sibling field beside the toolCalls structure (all four copies rewritten, one deduped attachment, non-media fields intact); |
|
@codex review |
Summary
Collapses PTC to exclusive-only: the single
programmatic-tool-callingexperiment now always replaces the standard toolset with a sandboxedcode_executiontool (bridgeable tools hidden; non-bridgeable tools andmcp_prompt_getstay model-visible). Theprogrammatic-tool-calling-exclusiveexperiment ID and theprogrammaticToolCallingExclusiveflag are deleted everywhere, and RLM remains a sub-experiment gated simply onrlm && ptc.Background
Past evals showed supplement-mode PTC (
code_executionalongside the flat tools) measured ~2x tokens/cost versus both PTC-off and PTC-exclusive: flat schemas plus bridge type definitions shipped on every request while models still took the flat path. With supplement mode removed there is no reason for two experiments, so the existingprogrammatic-tool-callingID keeps its meaning as "PTC on" and users who had it enabled seamlessly upgrade to the (better-measuring) exclusive posture.Implementation
toolAssembly.ts: the PTC branch is unconditionally exclusive; the supplementelsebranch and theexclusiveActivepredicate are gone. RLM stays parent-gated by construction (the flag is only read inside the PTC branch).aiService.ts: deletedrebuildCodeExecutionAfterAssembleHookplus both call sites. It existed solely for supplement mode, whererequest.assemblemiddleware could edit hook-visible bridgeable tools out from under the pre-hookcode_executionbridge; in exclusive mode bridgeable tools are never in the hook-visible record. The now-orphaned retarget/reconcile helper chain (retargetCodeExecution,reconcileHookReplacedCodeExecution,retargetCodeExecutionTool+ the late-bound retarget WeakMap incode_execution.ts) is removed with it.isRlmModeEnabled,resolveSlashCommandExperimentValue) — a prior audit found zero raw RLM activation sites outside them and the PTC-gated assembly branch, so every RLM surface (task-family messaging, compaction keep-recent floor,/refine, branch summaries, persistent mounts,refinement_rollback) inherits therlm && ptcgate.feature_flags.json, renderer localStorage, and persistedtaskExperimentsall read a legacy exclusivetrueas merged PTC and mirror PTC back onto the legacy key on write, so upgrade preserves the exclusive posture and downgrade never falls back to ~2x supplement mode (see review rounds below). In-sync IPC schemas still just strip the unknown key.Validation
{ ptc: true, rlm: false },devtools.jsonlshows the provider request toolsettodo_read, todo_write, web_fetch, web_search, code_execution—bash/file_read/file_edit_*absent from the model-visible set but declared as bridgedxum.*functions; no kernel surfaces.rlm: truesurfacesrefinement_rollbackand the kernel-first description preamble."programmatic-tool-calling-exclusive": trueintofeature_flags.jsonand restarted: clean boot, key ignored and self-healed out on the next write, surviving flags intact.taskService/workspaceServicereproduce identically on a clean-HEAD probe worktree (known local-Bun-version issues, unrelated).Review round 1 (Codex) — hardening additions
.*disable rule), code_execution is no longer synthesized.requirerules gate run completion on top-level toolResults, so required tools are retained in the model-visible set instead of being bridged away.extractEditedFileDiffs/extractEditedFilePathsandextractLoadedSkillSnapshotsFromMessagesnow consume successful nested PTC records (mirroringextractReadFiles).programmatic-tool-calling-exclusive: truenow maps onto PTC at read time (upgrade keeps the posture), and an enabled PTC mirrors the legacy key on write (downgrade runs the old exclusive posture instead of ~2x supplement mode).Review round 2 (Codex) — compatibility + media hardening
taskExperimentslegacy alias: persisted workspace configs parseprogrammaticToolCallingExclusive: trueontoprogrammaticToolCalling(schema preprocess), so tasks stamped by older builds keep exclusive PTC — and theirrlmflag stays effective — on restart-safe resumption.experiment:programmatic-tool-calling-exclusivekey (a downgraded renderer treats it as an explicit override that beats the mirrored backend value), and renderer reads alias a stored legacytrueonto PTC, matching the backend alias semantics.extractAttachmentsFromToolOutputnow traverses code_executiontoolCallsrecords at request time, turning nested bridged-MCP media into placeholder + synthetic user file parts exactly like top-level tool media (shared by the main, mid-stream, and replay request builders). Kernel-compacted records drop result contents by design; the guest still holds the data.extractEditedFilePathstraverses nested batches in reverse so a large batch keeps its latest edits underMAX_EDITED_FILES.Review round 3 (Codex) — runtime paths + duplication hardening
normalizePersistedWorkspace(the actualloadConfigOrDefaultpath, which never runs the Zod preprocess) aliases a persisted legacy exclusive flag ontoprogrammaticToolCalling, retaining the legacy key for downgrade.updatePersistedState/readPersistedState, joining the shared write-listener/subscriber notification path.agent_skill_readandfile_edit_*records (result kept, args/error bounded likemux.loadrecords) so loaded-skill snapshots and edited-file diffs survive compaction under PTC+RLM; legacy result-less records still degrade to path-only tracking.mcp_prompt_get) are excluded from the ToolBridge, sorequest.assemblehooks always see the only dispatch path — preserving the premise that justified deleting the assemble-hook rebuild machinery.Review round 4 (Codex) — kernel capture bounding + ordering
KernelRecordBounds.resultExempt(shared predicateisKernelRecordResultExempt) exempts persistence-critical results at record capture, closing the gap where >16KBfile_edit_*diffs /agent_skill_readsnapshots were__kernelBoundedbefore the compaction exemption could see them.extractEditedFilePathswalks a message's parts backward (mirroringextractReadFilePaths) so later executions' edits win theMAX_EDITED_FILEScap.Review round 5 (Codex) — downgrade snapshots + media scope
toPersistedTaskExperimentsstamps the legacy exclusive flag alongside enabled PTC in persistedtaskExperiments(schema now declares the field), so downgraded builds resume tasks in exclusive posture.collectNestedEditRecordsskips malformed (null/primitive) nested results instead of throwing — one corrupt history row can no longer wedge compaction flows.Review round 6 (Codex) — capture sanitizer + policy/CLI compat
KernelRecordBounds.captureRetained): mixed containers keep extractable images/PDFs but unsupported parts (audio/blobs) are replaced with bounded placeholders before the record is retained/persisted.code_executionname (applyToolPolicyToNames), so[disable .*, enable code_execution]allowlists keep the exclusive entry point.xum run/workflow -e programmatic-tool-calling-exclusivemaps onto the merged PTC flag instead of erroring.consoleOutputargs (theconsole.log(image)debugging path), deduped into a single attachment.Review round 7 (Codex) — retry snapshots + capture budgets
aliasLegacyPtcExclusive/withLegacyPtcExclusiveMirrorhelpers now cover retry/preserved send options too (schema preprocess + declared mirror field + raw-JSON read-site alias + write mirrors), so interrupted turns resume in the exclusive posture across upgrades and downgrades.Review round 8 (Codex) — capture-bounding hardening
file_edit_*record's args with a__kernelBoundedmarker (>2 KiB inserts), the validatedpathis merged back onto the marker so post-compaction diff preservation and edited-file tracking still attribute the edit.mimeType-stuffing with empty data no longer rides free), caps part count, and bounds placeholder labels.agent_skill_readpackages keep a schema-valid skill with a truncated body (mirroringcreateLoadedSkillSnapshot) instead of being dropped to a marker.diffTruncatedflag propagated toFileEditDiff.truncated, so combined diffs stay composable and honest.Review round 9 (Codex) — persisted-copy hardening
return xum.<mediaTool>()can no longer write an unbudgeted multi-image row); console args are sanitized at capture in both modes so streamed event copies are bounded too. Kernel mode's outer result is deliberately excluded (vars-handle offloading stores full fidelity for the guest).MAX_FILE_CONTENT_SIZEsemantics repo-wide.Review round 10 (Codex)
dispatchPendingFollowUpreads preserved experiments throughaliasLegacyPtcExclusive, matching the startup-retry path, so pre-rename persisted follow-ups keep PTC enabled.Review round 11 (Codex)
isSupportedAttachmentMediaTyperequires a well-formedtype/subtypewithin a 100-char bound (not just animage/prefix), so junk MIME strings fail validation at capture retention, request extraction, and provider output sanitization alike; placeholder builders additionally bound interpolated media-type/filename labels for history persisted by earlier builds.Review round 16 (Codex)
ok === true; malformed rows can no longer advertise never-applied edits or never-read paths in crash-safe tracking.Review round 15 (Codex)
Review round 14 (Codex)
diffvalues from persisted history only when they are strings (nested records and direct parts alike), so corrupt rows degrade to path-only tracking instead of throwing inparsePatchon every compaction/recovery pass.Review round 13 (Codex)
Review round 12 (Codex)
__kernelBoundedresults compact to the normal{ok, bytes}summary (keeping edit path attribution), and a booleansuccessbit is preserved through the marker so failed edits never misreportok:true.Risks
Low-to-moderate, contained to the opt-in PTC experiment (off by default). The main behavior change is intentional: users with PTC (supplement) enabled now get the exclusive toolset. The deleted assemble-hook rebuild only ever ran in supplement mode, so middleware/tool-policy interactions in exclusive mode are unchanged. Users who had only the exclusive toggle enabled keep their posture via the read-side aliases (backend, renderer, and taskExperiments), so no re-enable step remains.
📋 Implementation Plan
Collapse PTC to exclusive-only: single PTC experiment + RLM sub-experiment
Goal
Past evals show supplement-mode PTC (code_execution alongside normal tools) performs worse than both PTC-off and PTC-exclusive. Remove supplement mode entirely:
programmatic-tool-calling) that always activates today's exclusive posture (bridgeable tools hidden;code_execution+ non-bridgeable tools +mcp_prompt_getmodel-visible).programmatic-tool-calling-exclusiveexperiment ID and theprogrammaticToolCallingExclusiveflag everywhere.rlm && ptc).Acceptance criteria
{ programmaticToolCalling: true, rlm: false }yields exclusive tool visibility:code_executionpresent; bridgeable tools (bash,file_read,file_edit_*,task, …) absent from the model-visible set; non-bridgeable tools (todo_write,ask_user_question, …) andmcp_prompt_getremain.{ rlm: true }with PTC off is completely inert — no RLM-only surface activates: task-family messaging (task_message_parent/task_message_sibling), compaction keep-recent floor,/refine(visibility AND backendRefineService), abandoned-branch summaries, persistent sandbox mounts, kernel preambles/xum.load, andrefinement_rollbackall stay off.{ programmaticToolCalling: true, rlm: true }enables kernel/RLM surfaces (persistent mount,refinement_rollback,/refine).programmaticToolCallingExclusive/PROGRAMMATIC_TOOL_CALLING_EXCLUSIVE/programmatic-tool-calling-exclusiveremain (grep gate below).readOverridesFileskips keys notin EXPERIMENTS;ExperimentsSchemaandtaskExperimentsare plainz.object— Zod strips unknown keys, no.strict()anywhere in those schemas).Key decisions (assumptions)
programmatic-tool-callingID. Users who had PTC (supplement) enabled seamlessly upgrade to exclusive — exactly the desired behavior.readOverridesFileinsrc/node/services/experimentsService.tsfilters againstEXPERIMENTS; Zod strips unknownsendOptions.experimentskeys since the schemas are non-strict), so staleprogrammatic-tool-calling-exclusiveentries in~/.xum/feature_flags.json/ localStorage are inert. A user who had only the exclusive toggle on re-enables PTC once in Settings. Per AGENTS.md, migrations are skipped when breakage is tightly scoped — this is an opt-in experiment, off by default.programmatic-tool-calling: trueand run supplement mode (their own valid behavior).rebuildCodeExecutionAfterAssembleHookbehind the exclusive path. It exists solely for supplement mode where hook-visible tools and the bridge coexist; exclusive mode already skips it today, so deletion does not change exclusive semantics (advisor-confirmed).Changes
1. Experiment definitions —
src/common/constants/experiments.tsEXPERIMENT_IDS.PROGRAMMATIC_TOOL_CALLING_EXCLUSIVE(line 10) and itsEXPERIMENTSentry (lines 62–68).2. Tool assembly —
src/node/services/toolAssembly.tsresolveBackendGatedPtcExperiments(lines ~186–188): drop the exclusive field/backfill; keepprogrammaticToolCalling+rlm.if (experiments?.programmaticToolCalling)— RLM alone still does nothing (parent-gated, unchanged).exclusiveActive; the branch is always exclusive now. Delete the supplementelsebranch (applyToolPolicy({ ...policyFilteredTools, code_execution }, ...)).3. AI service —
src/node/services/aiService.tsrebuildCodeExecutionAfterAssembleHook(method + doc comment, ~lines 1080–1240) — it exists solely because supplement mode exposed a pre-hook bridge alongside hook-visible tools. Exclusive mode is unaffected by design (bridgeable tools aren't in the hook-visible record).ptcEnabledpredicate (line ~2923–2925) toexperiments?.programmaticToolCalling === true.4. RLM gating (full parent-gating audit completed)
An exhaustive audit of every runtime consumer of the RLM flag (
experiments?.rlm,EXPERIMENT_IDS.RLM,isRlmModeEnabled,rlmActive) found zero raw sites: every RLM surface is parent-gated either through the two central predicates below or by being lexically insidetoolAssembly.ts's PTC-gated branch (line 242). Audited surfaces: task-family messaging (aiService.ts:2739viaisRlmModeEnabled(taskExperiments)), compaction keep-recent floor (agentSession.ts:4202viaisRlmModeEnabled),RefineService.enabled()(refineService.ts:345), abandoned-branch summaries (branchSummary.ts:702), persistent mounts + kernel preambles +refinement_rollback(all inside the PTC branch oftoolAssembly.ts),sandboxHostService(no experiment checks at all — pure mechanism invoked only from the gated branch), task/workflow experiment inheritance (transport-only; evaluated viaisRlmModeEnabledat consumption), CLI builders (don't exposerlmat all).Therefore only the two central predicates need changing — every other surface inherits:
src/node/services/branchSummary.ts: dropprogrammaticToolCallingExclusivefromRlmExperimentFlags;isRlmModeEnabled→rlm && ptc.src/browser/utils/slashCommands/experimentVisibility.ts: snapshot type + RLM case →snapshot.rlm === true && snapshot.programmaticToolCalling === true.Existing parent-gating tests that must stay green (with exclusive permutations removed, no coverage loss):
branchSummary.test.tsisRlmModeEnabledcases,suggestions.test.ts"requires a PTC parent flag for rlm-mode",refineService.test.ts"refuses when RLM is on but no PTC parent flag" (line ~327),toolAssembly.test.ts"refinement_rollback is exposed only with rlm on" (ptcOffcase assertsrlm: truealone yields nocode_execution/refinement_rollback),agentSession.autoCompaction.test.ts"stamps ... keep-recent tail only when RLM is on" (rlm-without-PTC → no stamp).5. Schemas / shared types (frontend↔backend IPC is always in sync — remove outright)
src/common/orpc/schemas/stream.tsExperimentsSchema(line 743)src/common/schemas/project.tstaskExperiments(line 183)src/common/utils/tools/tools.tsToolConfiguration.experiments(line 283)src/node/services/taskService.tsTaskOptions.experiments(line 307)src/node/services/workflows/WorkflowTaskServiceAdapter.ts(line 33)src/browser/utils/messages/buildSendMessageOptions.tsExperimentValues(line 8)6. Frontend surfaces
ExperimentsSection.tsx: removeptcExclusiveEnabledsubscription (lines 698–700) and the second RLM nesting block + its dedup comment (lines ~811–820). Single PTC row keepsPTC_SUB_EXPERIMENT_IDS = [RLM]nested when enabled.ChatInput/index.tsx(lines 330, 1755, 1810),CommandPalette.tsx(lines 73, 309),useSendMessageOptions.ts(lines 58–59, 83),sendOptions.ts(lines 96–97): remove the exclusive subscription/field pass-through.7. CLI + eval script
src/cli/run.ts(line 290),src/cli/workflow.ts(lines 230–231): drop the exclusive entry frombuildExperimentsObject. Unknown--experimentvalues are already ignored by theincludespattern — no extra validation needed.scripts/rlm-eval/scenarios.ts: drop the optionalprogrammaticToolCallingExclusivefield (line 32); re-describe scenarios so future evals don't imply supplement PTC still exists: theptc-onlyconfig ({ programmaticToolCalling: true, rlm: false }) now measures exclusive PTC without the kernel — note that in its comment; trim the stale "explicit exclusive flag is redundant but harmless" comment aboverlm-excl(lines 243–245).flat-bashbaseline is unaffected.8. Comment hygiene (small, optional but cheap)
Reword "supplement-mode contract"/"byte-identical supplement contract" mentions to "non-RLM inline-results contract" so the term doesn't dangle:
src/node/services/ptc/types.ts:61,ptc/toolBridge.ts:215,ptc/runtime.ts:91,src/common/utils/messages/extractReadFiles.ts:23.9. Tests
src/node/services/toolAssembly.test.ts: replace "PTC only: supplement set, no kernel surfaces" with "PTC only: exclusive narrowed set, no kernel surfaces"; rewrite exclusive-flag tests (mcp_prompt_getvisibility, grants ceiling, kernel permutations) to useprogrammaticToolCalling; updateresolveBackendGatedPtcExperimentstests.src/node/services/branchSummary.test.ts: drop exclusive-flag permutations fromisRlmModeEnabledtests.src/browser/utils/slashCommands/suggestions.test.ts: "requires a PTC parent flag for rlm-mode" → single-parent form.src/node/services/refinement/refineService.test.ts: update flag payloads that set exclusive.workspaceService.test.ts,agentSession.*.test.ts,taskService.test.ts,stream.test.ts) — most already use{ programmaticToolCalling: true, rlm: true }and need no change; typecheck flags any stragglers.ExperimentsSection.test.tsx/.stories.tsx: nesting-under-PTC assertions should pass unchanged; verify.Net LoC estimate (product code only)
≈ −230 LoC (deletions dominate: ~−170 in
aiService.ts, ~−15toolAssembly.ts, ~−10 experiment definition, ~−25 frontend, ~−10 schemas/types/CLI; +~10 reworded copy/comments). Tests shrink additionally.Validation
make typecheckfirst — deleting the field from shared types drives an exhaustive compile-error sweep of any missed references.bun test src/node/services/toolAssembly.test.ts src/node/services/branchSummary.test.ts src/browser/utils/slashCommands/suggestions.test.ts src/node/services/refinement/refineService.test.ts src/node/services/agentSession.autoCompaction.test.ts src/node/services/experimentsService.test.ts src/browser/features/Settings/Sections/ExperimentsSection.test.tsxplus wherever the schema parse/strip tests from step 3 land (e.g. the stream/project schema test files).feature_flags.jsonoverrides map containing"programmatic-tool-calling-exclusive": trueis ignored byreadOverridesFile(experimentsService.test.ts already covers unknown-key filtering — extend only if no such case exists), and (b)ExperimentsSchema.parse/taskExperimentsparse of a payload containingprogrammaticToolCallingExclusivesucceeds and strips the key.grep -rn "programmaticToolCallingExclusive\|PROGRAMMATIC_TOOL_CALLING_EXCLUSIVE\|programmatic-tool-calling-exclusive" src scripts testsreturns nothing except the intentional stale-payload legacy tests from step 3 (raw string literals only, no symbol references).grep -rn "experiments?.rlm\|EXPERIMENT_IDS.RLM\|rlmActive" src— every hit must be one of: (a) the central predicates (isRlmModeEnabled/resolveSlashCommandExperimentValue) or callers passing flags into them, (b) inside toolAssembly's PTC-gated branch, (c) transport/schema packaging (sendOptions/taskExperiments/ExperimentsSchema fields), (d) the experiment definition inexperiments.ts, (e) Settings nesting / UI subscriptions that only feed the central resolver (ExperimentsSection, ChatInput, CommandPalette), or (f) tests. Any new raw activation site fails review.make static-check(useMUX_ESLINT_CONCURRENCY=1if memory-constrained).Dogfooding (quality gate before declaring done)
Using the
dev-server-sandboxskill (isolatedXUM_ROOT+ free port) +agent-browser:attach_filethem.agent-browserset viewport) — screenshot to confirm the experiment rows don't overflow (AGENTS.md mobile-width rule).agent-browservideo recording) covering the Settings toggle + one scratch-workspace message send, andattach_filethe recording.<XUM_ROOT>/sessions/<workspace>/devtools.jsonland assert the provider request's tool list containscode_executionbut nobash/file_read/file_edit_*(non-bridgeable tools liketodo_writemay remain).refinement_rollbackpresent / kernel preamble) indevtools.jsonl."programmatic-tool-calling-exclusive": trueinto the sandbox'sfeature_flags.jsonoverrides, restart the dev server, confirm the app loads cleanly and the key is ignored (no crash, PTC off unless the surviving flag is on).Attach screenshots (steps 1–2), the video (step 3), and include the devtools.jsonl tool-list evidence in the summary.
Generated with
xum• Model:anthropic:claude-fable-5• Thinking:xhigh• Cost:$175.92