Skip to content

fix(grok): request native input echoes for attribution - #351

Merged
lukemaj merged 2 commits into
mainfrom
fix/344-grok-root-prompt-index
Oct 15, 2026
Merged

lukemaj merged 2 commits into
mainfrom
fix/344-grok-root-prompt-index

Conversation

@lukemaj

@lukemaj lukemaj commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What: Grok turns retain the authoritative root input's promptIndex in normal and bare launches.
Why: Grok persists user chunks locally but suppresses their live broadcast unless the client requests x.ai/userMessageEcho; the adapter never requested it.
So what: Merged at a123886 after both independent reviews and green CI; planner owns deployment and Observer95 runtime acceptance.

Refs #344 and toolboxmd/agent-observer#95. This advances trustworthy evidence for Drafter work and judged Spectrum tests.

The shared Grok runtime now declares the live user echo capability during initialization. The existing root-session extractor and native-ref persistence from #346 then work unchanged. Bare isolated homes use the same runtime; file discovery was a separate observation, not the losing adapter boundary. No ordinal inference, transcript lookup, backfill, contract change, version bump or deployment.

Evidence: read-only bestia diagnosis, deployed failure, Observer proof. Grok source declares the opt-in and persists before suppressing broadcast. Current T3 upstream e536bfd also lacks the capability; no matching upstream repair found.

Proof

Base 6408f92bb2af98199567df08c904842733ad28ed; candidate 1daaffec10.

  • New wire regression uses the real observed root chunk shape with promptIndex: 0, event metadata and no message id. The peer implements Grok's capability gate. Both normal/user and bare/agent cases fail before the fix with weak native-root:turn:23, then pass with strong prompt:0 and unchanged internal turn identity. Child, hidden and synthetic chunks precede the valid echo.
  • TMPDIR=/home/luke/tmp node_modules/.bin/vp test run apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t 'capability-gated root echo|native promptIndex': 5 passed, 123 skipped.
  • Targeted lint: passed, only five existing warnings in the test file.
  • Complete selected ACP adapter and Grok server suites: 258 passed, 4 skipped across 9 files.
  • Grok package and server package typechecks passed. Server typecheck first caught a test-only branded driver assertion, corrected in the final head; focused regressions re-ran successfully. CI owns repository-wide checks.
  • Self-review and git diff --check passed.
  • Complete exact-head CI run 38680882550 passed: all workspace tests, web, all six server shards, Rust, lint, typecheck, build, release smoke and final Check. Inspected actual logs, including the complete 128-test ACP adapter suite.
  • Independent Sol review passed, with final-head red/green regression reruns and both package typechecks. Independent Grok review passed; both required statuses are success on the exact head.

This is adapter wire proof, not deployed acceptance. The two Observer95 proof threads were read-only and remain available for the user's inputs. No UI, transport contract or other harness changes; all clients, agent submissions and scheduled runs share this runtime. No existing feature-map part or user guidance changes. Website and SEO impact: none, backend attribution only.

Elon record

Requirements and who asked: User requests authoritative Grok root input refs for #344, real-shape failing-first proof, independent exact-head Sol/Grok reviews, CI and delegated merge; no deployment.
Deleted: File-history scraping, ordinal guessing, Observer join changes, historical backfill, new component, version bump and deployment.
Bottleneck: The client omitted Grok's live input echo opt-in, so the valid native identity never reached #346's extractor.
Checked myself: Live read-only native event and persisted provider turn, bare runtime wiring, transport decoder, old callback-only test gap, upstream Grok broadcast gate, installed binary capability strings and failing/passing wire regressions.

Implemented by gpt-6.1-sol through the Codex harness in T3 Code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS labels Oct 15, 2026
@lukemaj

lukemaj commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

What: The Grok runtime never opts in to live user echoes, so #346's extractor receives no root input identity.
Why: Grok persists user_message_chunk before gating its live broadcast on initialize.clientCapabilities._meta["x.ai/userMessageEcho"].
So what: Enable that capability in the existing Grok runtime and prove the adapter through a capability-gated wire peer; deployment and real-human acceptance remain with the planner.

Read-only bestia evidence on 6408f92: dedicated proof thread completed, durable provider turn stays weak session:turn:1; its isolated native updates.jsonl has root promptIndex 0 with no hidden/synthetic flags. Native archives are not proof of a live wire echo. Bare flavor spreads the normal extractor and uses the same makeGrokAcpRuntime. The transport decoder preserves the actual chunk metadata. The prior three native-promptIndex tests pass because they invoke the adapter callback directly, bypassing initialize negotiation.

Grok source 2bdd1d6a6369de0e8c68132ea4539e9abd9e14a8: session/user_echo.rs declares opt-in; agent/mvp_agent/agent_ops.rs resolves it with false default; session/acp_session_impl/updates.rs persists before suppressing live broadcast. Installed binary contains both capability spellings. Chromeria makeGrokAcpRuntime sends clientType extension but no userMessageEcho capability.

Upstream search: pingdotgg/t3code PR promptIndex finds only closed #7567; nativeTurnRef issue finds unrelated Pi #13507. Current main e536bfd inspected via source before implementation; no matching repair is being ported.

Base: current origin/main 6408f92. Exclusive branch fix/344-grok-root-prompt-index, workspace /home/luke/dev/toolboxmd/chromeria-worktrees/344-grok-root-prompt-index. Main remains read-only with user-owned scripts/pycache/.

Objective contribution: authoritative Grok input identities enable Observer evidence for Drafter work and judged Spectrum tests.

Requirements and who asked: User requests authoritative root promptIndex persistence for #344, a faithful failing-first test, exact-head Sol and Grok reviews, green CI and merge; no deployment.
Deleted: File-history scraping, ordinal guessing, Observer join changes, historical backfill, new component, version bump and deployment.
Bottleneck: Grok suppresses live input echoes because the client never declares its required capability.
Checked myself: Actual read-only native event and persisted turn, bare runtime wiring, exact transport decoding, passing old callback-only tests, Grok source persistence/broadcast gate and installed binary capability strings.

@lukemaj

lukemaj commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

What: PR #351 is frozen for independent Sol and Grok review at 1daaffe.
Why: Grok's missing live-echo opt-in caused the deployed synthetic reference; the existing root extractor works once the runtime requests those events.
So what: Both reviewers must publish findings before success statuses on this exact head; merge waits for both review/independent-sol and review/independent-grok and green CI. Deployment stays with the planner.

Base: 6408f92. Branch fix/344-grok-root-prompt-index; exclusive author workspace /home/luke/dev/toolboxmd/chromeria-worktrees/344-grok-root-prompt-index. Main remains read-only.

  • Initial baseline tests: 2 failed for weak native-root:turn:23 instead of strong prompt:0, normal and bare.
  • Focused regressions: 5 passed. Full selected ACP adapter and Grok server suites: 258 passed, 4 skipped, 9 files.
  • Grok package typecheck passed. Server package typecheck initially caught a branded driver type in the new assertion; correction is the only second-commit change. Server package typecheck and the five focused cases now pass on final source.
  • Targeted lint and diff checks passed; five existing test-file warnings. Missing local copied dependency links were repaired before these results.
  • First review dispatches were interrupted without a verdict when the test type error changed the candidate. Their old-head statuses are error; no old-head verdict is reused. The new rounds receive the complete brief, this correction, and no prior findings or unresolved objections.
  • Raw local proof: /home/luke/tmp/chromeria-344-grok/{red,green-final,tests,lint-final,typecheck,server-typecheck}.log. These are test/wire results, not deployed attribution acceptance.
  • No browser, server, proof-thread write, version bump or deployment. No feature-map part, user documentation or website impact. fix(providers): retain native Claude and Grok input identities for Observer #344 and Observer95 remain open for planner-owned deployment and actual user/agent acceptance.

Requirements and who asked: User requests a focused #344 Grok repair with exact-head independent Sol/Grok reviews and delegated merge after green CI.
Deleted: Scraping, ordinal inference, backfill, new component, version bump and deployment.
Bottleneck: Required exact-head reviews and CI admission.
Checked myself: Real native/persisted mismatch, Grok broadcast gate, old test gap, failing-first wire cases, focused and full selected suites, package typechecks and complete diff.

@lukemaj

lukemaj commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

What: Independent Sol review passes on 1daaffec10f0ba85c3937ed1130a87295d0e7f45; no blocking or actionable findings.
Why: The initialize capability activates Grok's existing authoritative root echo, which the unchanged extractor safely persists as prompt:N.
So what: This satisfies the Sol review gate only; merge still requires the Grok review and green CI, while deployment and real user/agent acceptance remain with the planner.

Reviewed exact base 6408f92bb2af98199567df08c904842733ad28ed to head 1daaffec10f0ba85c3937ed1130a87295d0e7f45, the complete two-file diff, #344 in full including comments 6184079398 and 6184271435, Observer95 comment 6184099576, and the final-head freeze/evidence on this PR. The change supports trustworthy attribution for Drafter work and judged Spectrum tests.

Checked independently:

  • Grok source 2bdd1d6a6369de0e8c68132ea4539e9abd9e14a8: session/user_echo.rs defines x.ai/userMessageEcho; agent/mvp_agent/agent_ops.rs resolves it from clientCapabilities._meta with default false; session/acp_session_impl/updates.rs persists the chunk before applying the live broadcast gate. Numeric promptIndex 0 is valid. An archived chunk therefore does not establish a live echo.
  • makeGrokAcpRuntime supplies the capability through the real ACP initialization serializer and preserves the existing clientType metadata and filesystem/terminal capability defaults. Both normal and bare adapters call this runtime; bare retains the normal extraction hook and does not override the echo capability.
  • Root-session routing precedes extraction. Child, synthetic, hidden, invalid, settled, continuation and wake inputs remain excluded at their existing boundaries. The provider-turn payload uses the accepted prompt identity while internal turn/item identities and ordinal remain separate. No contract, resume/fork/rollback, other harness or client-specific code changes.
  • The new fake sits at the external CLI wire boundary, gates echoes on the actual initialize capability, and uses the observed chunk metadata shape. It proves completed normal/user and bare/agent turns resolve to strong prompt:0 after earlier child/hidden/synthetic chunks, while retaining the internal turn ID.

Independent execution used my own archived source and copied dependencies in /home/luke/tmp/chromeria-351-sol-review-ydmal4l8, with TMPDIR=/home/luke/tmp:

  • node_modules/.bin/vp test run apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts -t 'capability-gated root echo|native promptIndex': 5 passed, 123 skipped, exit 0, on final candidate source.
  • The same final wire tests with only acpSupport.ts restored from the exact base: 2 failed, 126 skipped, specifically weak native-root:turn:23 instead of strong prompt:0, in both normal and bare cases. Restored candidate bytes were checked against the frozen Git objects before the final passing run.
  • tsc-rs --noEmit in packages/provider-grok and apps/server: passed, exit 0. My first server attempt lacked the copied scripts/node_modules; copying those dependencies resolved that setup failure without changing source.
  • Complete diff whitespace check passed. I inspected the author's red/green, lint, selected-suite and typecheck logs, including 258 passed, 4 skipped across the selected ACP/Grok suites; that broader run was not independently repeated.

Proof limit: these are adapter/wire and static checks, not deployed Grok or Observer attribution acceptance. Repository-wide checks remain CI-owned. No source, Git refs, live database, proof threads, installation or deployment were changed by this review.

Reviewed by gpt-6.1-sol at high effort through the Codex harness in T3 Code.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +7 B (+0.1%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +7 B (+0.6%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: 6408f92 · PR result: 1daaffe · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@lukemaj

lukemaj commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

What: Independent Grok review passes on 1daaffec10f0ba85c3937ed1130a87295d0e7f45; there are no blocking findings.
Why: Grok already persists the root promptIndex, and it broadcasts that chunk only after initialize advertises x.ai/userMessageEcho.
So what: This satisfies review/independent-grok on this exact head. The author can merge once this status is posted, because Sol's review and CI are already green. Deployment and real user/agent acceptance stay with the planner.

Reviewed base 6408f92bb2af98199567df08c904842733ad28ed through head 1daaffec10f0ba85c3937ed1130a87295d0e7f45: the two-file diff, #344 including comments 6184079398 and 6184271435, Observer95 comment 6184099576, and the freeze comment on this PR.

No required fix. Cleared checks:

  • Grok source 2bdd1d6a6369de0e8c68132ea4539e9abd9e14a8 names the capability in session/user_echo.rs. resolve_user_message_echo_capability defaults to false and lets session _meta.clientUserMessageEcho outrank initialize. emit_notification_direct persists the chunk, then suppresses the live send while the flag is off. Normal prompts use broadcast mode and carry modelId plus numeric promptIndex; prompt index 0 is a valid identity. The bestia agent input's archived chunk is that shape with no synthetic or hidden flag, so the missing broadcast is the capability gate.
  • makeGrokAcpRuntime sends the flag on clientCapabilities._meta. The session runtime keeps filesystem and terminal at their existing false defaults and leaves clientType: extension on initialize _meta. Normal and bare sessions both use this runtime. Bare session meta does not set clientUserMessageEcho, so it does not turn the echo off.
  • The new object replaces the adapter's previous elicitation: { form: {} } advertisement. This Grok source does not read client_capabilities.elicitation; MCP elicitation goes through its extension method. That drop does not change this build's behavior.
  • Root-session routing drops the child chunk before extraction. The extractor still accepts only a safe non-negative integer, skips synthetic and scrollback-hidden chunks, and keeps the first accepted id. nativePromptId is used only for nativeTurnRef. The provider turn id stays the orchestration id.
  • The wire peer withholds the observed root chunk until the capability is exactly true. Both normal/user and bare/agent turns then finish as strong prompt:0 after the child, synthetic, and hidden chunks, with the same turn id. The second commit only brands the expected driver string; its runtime value is still grok.

Evidence I inspected: author red log shows both new cases failing as weak native-root:turn:23; green-final shows 5 passed; the selected ACP/Grok log shows 258 passed and 4 skipped; package typecheck logs contain suggestions and no type errors. Live CI on this SHA is green for Lint, Typecheck, Build, Test, Test Web, Test Server 1-6, Rust, and Release Smoke. I did not re-run the suite. This is adapter, wire, and CI evidence. Deployed Grok and Observer attribution remain unproven by this review.

Reviewed by Grok through the Grok harness in T3 Code.

@lukemaj
lukemaj merged commit a123886 into main Oct 15, 2026
30 of 31 checks passed
@lukemaj
lukemaj deleted the fix/344-grok-root-prompt-index branch October 15, 2026 04:36
lukemaj added a commit that referenced this pull request Oct 29, 2026
* fix(grok): request native input echoes for attribution

* test(grok): use branded driver in native ref assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant