Skip to content

fix(docs): prevent placeholder expansion from stalling translations - #134934

Merged
steipete merged 1 commit into
mainfrom
steipete/elated-kirch-c2b941
Sep 1, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/elated-kirch-c2b941

Conversation

@steipete

@steipete steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where docs translation workers repeatedly failed on prose containing masked precedence chains, leaving affected locale shards without publishable output. The Korean Telegram page in Translate Full run 33290320562, shard 0/7, reached the same 365-byte leaf and rejected a duplicated placeholder across ten executions within five outer attempts.

Why This Change Was Made

The translation contract was being prepended to ordinary user input, while Codex also loaded unrelated repository instructions. Send the shared rules/glossary through Codex's developer-instruction contract, disable project-document injection for these translation calls, and explicitly preserve each placeholder's occurrence count by expressing precedence chains as an inline priority order. The old duplicate user-level contract is removed rather than retained as a fallback.

Keep exact-count validation, normalization, model selection, timeouts, and retries unchanged. Extend the existing opt-in rejected-body diagnostic to capture the raw chunk's input/output and the previously discarded leaf-fallback error. No new public OpenClaw configuration option, generated docs/TM edit, workflow change, or locale-specific workaround is introduced.

User Impact

Translation rules now take the intended application-instruction role instead of competing with repository guidance. Invalid translations remain rejected, and operators can retain the facts needed to diagnose failures. Previously valid locale output remains current: promptVersion intentionally stays unchanged because its accepted-output contract is unchanged, avoiding a blanket locale refresh.

Release-note context: improve docs translation reliability for protected placeholders in comparisons/references and retain opt-in chunk/fallback diagnostics. This does not retroactively change the historical workflow's pinned core source or publish regenerated pages.

Evidence

Before and producer proof

  • Pinned core 4bc25d7a7001c67dadc80835619b200406fe5cb1; workflow scripts 6d2d18b111d84d0cfb90f3b01ba621d841add64e; publish input ff82b6d040ff1487e73c273538df00638e6ee8de.
  • Offline reconstruction matched 265 blocks, five groups, 55,852 masked bytes, every logged split size, and the 365-byte failing leaf. Source and Korean glossary Git blobs match the actual publish checkout.
  • Two bounded live baseline calls with Codex 0.146.1 / gpt-5.6 / xhigh returned each of 900021 and 900022 twice although every input marker appeared once. Exact output-last-message files establish that duplication precedes Go normalization/validation. The fallback received identical input and failed the same exact-count check.
  • Wording-only repair failed its first Korean canary. The producer-role/isolation repair passed two Korean calls but exposed remaining Japanese comparison expansion; the final shared rule explicitly requests inline priority order rather than repeated pairwise comparisons.
  • Actual Codex with a loopback-only Responses fixture captured the instruction boundary: before, the translation contract was user text alongside 33,636 bytes of repository-context user text; after, it is developer text and repository instructions are absent. This fixture used no real provider.
  • Personally inspected Codex 0.146.1 source at 79b4f03d35962b005b007a015113b38930711665: exec-policy flag handling, project-document zero-budget behavior, and developer-instruction message construction.

Final canary and validation

The final candidate passed all six fresh live calls in 295.58 seconds (2026-09-01 06:37:48–06:42:43 UTC), each with exactly one prompt invocation and no fallback. The operator-approved ten-call cap includes four intermediate-candidate calls; it was not exceeded.

Final candidate Calls Every protected marker exactly once Structure validation
Korean 3 pass pass
Japanese 2 pass pass
German 1 pass pass

Inspected all six response texts: precedence order, the default-account-only condition, the 24-hour bot-identity cache, skipped extra identity lookup on restart, and invalidation after token changes/removal remain present. Exact argv confirms developer-instruction delivery and disabled project docs. The masked source bytes are unchanged. This is evidence for the tested leaf—not a claim that every future model response is infallible.

Codex autoreview completed scoped-clean, with no accepted/actionable findings at the skill's default P0 threshold. Parent review additionally inspected the complete producer/callee boundary, exact upstream contracts, all six final translations, and the validation results.

  • Extended the existing shared prompt table across all supported locales. It failed before the new contract and passes afterward; this is a prompt-contract guard, not a substitute for live behavior proof.
  • Extended the existing fake-Codex process test to require developer-instruction delivery, disabled project docs, and no duplicate contract in stdin. It failed before the boundary repair and passes afterward.
  • Added opt-in diagnostic regression covering unset, disabled, and enabled capture while preserving the original failure and prompt count; it failed before instrumentation and passes afterward.
  • go -C scripts/docs-i18n test -count=1 ./...
  • node scripts/check-changed.mjs -- scripts/docs-i18n/prompt.go scripts/docs-i18n/prompt_test.go scripts/docs-i18n/translator.go scripts/docs-i18n/translator_test.go scripts/docs-i18n/doc_chunked_raw.go scripts/docs-i18n/doc_chunk_diagnostics_test.go docs/.i18n/README.md
  • git diff --check

Proof scope: exact leaf and three locales, not a full-page/shard/Full rerun. Live capture ran on macOS arm64 with Go 1.27.0 rather than the original Ubuntu/Go 1.26 runner. The pinned Codex CLI warned that this model lacks catalog metadata and omitted its unadvertised priority tier; model/effort and CLI were kept identical across the live comparisons. No workflow was cancelled or dispatched, Incremental remained untouched, and no generated docs/TM were edited. Temporary provider credentials were removed and captures checked before use.

Production/tooling LOC: +13/-5 (net +8): six lines retain missing diagnostic facts, and net two lines establish the developer/project-document boundary. Tests and docs are counted separately; no provider, channel, or token IDs are hardcoded in production.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 1, 2026
@steipete
steipete marked this pull request as ready for review September 1, 2026 06:50
@steipete steipete self-assigned this Sep 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 2:59 AM ET / 06:59 UTC.

ClawSweeper review

What this changes

The PR isolates documentation translation rules as Codex developer instructions, disables project instruction loading, strengthens placeholder guidance, and adds opt-in rejected-chunk diagnostics.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer handling. The introduced change moves the translation contract to Codex’s supported developer-message configuration, preserves the existing validation/fallback owner, and has no actionable correctness finding; exact-head CI is still incomplete.

Priority: P2
Reviewed head: 5322da7104f142eaeab14bcf2207f1a3e75c40ef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-tested repair with direct current-Codex contract support and no identified correctness defect; remaining CI completion is a merge gate rather than a patch-quality deduction.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, maintainer-labeled PR is exempt from the external-contributor proof gate; its submitted body nevertheless reports six after-fix real Codex translation calls through the changed production boundary with exact marker and structure validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, maintainer-labeled PR is exempt from the external-contributor proof gate; its submitted body nevertheless reports six after-fix real Codex translation calls through the changed production boundary with exact marker and structure validation.
Evidence reviewed 6 items Introduced instruction boundary: The PR adds developer instructions and a zero project-document budget, while removing the translation contract from stdin user text.
Owner and validation flow: Document processing calls chunk translation; the chunk owner validates protected placeholder occurrence counts before taking its existing fallback path.
Codex configuration contract: The checked sibling Codex source defines developer_instructions as a developer-role message and stops loading project instructions when project_doc_max_bytes is zero; its exec CLI applies -c overrides before building the session configuration.
Findings None None.
Security None None.

How this fits together

The docs i18n tool sends masked documentation chunks to the Codex CLI, validates returned placeholders and document structure, then writes locale output in the separate publish repository. This change alters the instruction boundary before model execution while retaining the downstream validator and fallback flow.

flowchart LR
  A[English documentation chunk] --> B[Translation prompt boundary]
  B --> C[Codex CLI]
  C --> D[Placeholder and structure validation]
  D --> E[Localized publish output]
  D --> F[Opt-in rejected-body diagnostics]
Loading

Before merge

  • Resolve merge risk (P1) - Required exact-head CI is still in progress, so merge readiness is not yet established.
  • Complete next step (P2) - This maintainer-authored, maintainer-labeled PR needs normal exact-head CI completion and human merge handling, not a repair job.
Agent review details

Security

None.

PR surface

Docs +7, Other +82. Total +89 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 6 90 8 +82
Total 7 97 8 +89

Review metrics

Metric Value Why it matters
Production versus test delta production/tooling +13/-5; tests +77/-3; docs +7/-0 The small production increase is tied to the Codex instruction boundary and opt-in failure diagnostics; most added lines are focused regression coverage.

Stored data model

Persistent data-model change detected: vector/embedding metadata: scripts/docs-i18n/doc_chunk_diagnostics_test.go, vector/embedding metadata: scripts/docs-i18n/doc_chunked_raw.go. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the developer-instruction and zero-project-document boundary, retain exact-count validation as the acceptance authority, and merge only after the remaining exact-head checks complete successfully.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the developer-instruction and zero-project-document boundary, retain exact-count validation as the acceptance authority, and merge only after the remaining exact-head checks complete successfully.

Do we have a high-confidence way to reproduce the issue?

Yes, source reproducibly shows current main concatenating the translation contract into stdin user text while the PR moves it to the Codex developer-message configuration. The supplied PR evidence also records the affected placeholder duplication on real Codex calls.

Is this the best way to solve the issue?

Yes. Establishing instruction roles at the Codex invocation boundary and retaining the existing exact-count validator is cleaner than compensating with retries or downstream placeholder repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 437ef6160e16.

Labels

Label changes:

  • add P2: This is a bounded docs-publishing reliability repair that can leave affected locale output unavailable but does not affect the core runtime.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, maintainer-labeled PR is exempt from the external-contributor proof gate; its submitted body nevertheless reports six after-fix real Codex translation calls through the changed production boundary with exact marker and structure validation.

Label justifications:

  • P2: This is a bounded docs-publishing reliability repair that can leave affected locale output unavailable but does not affect the core runtime.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, maintainer-labeled PR is exempt from the external-contributor proof gate; its submitted body nevertheless reports six after-fix real Codex translation calls through the changed production boundary with exact marker and structure validation.

Evidence

What I checked:

  • Introduced instruction boundary: The PR adds developer instructions and a zero project-document budget, while removing the translation contract from stdin user text. (scripts/docs-i18n/translator.go:230, 5322da7104f1)
  • Owner and validation flow: Document processing calls chunk translation; the chunk owner validates protected placeholder occurrence counts before taking its existing fallback path. (scripts/docs-i18n/doc_chunked_raw.go:144, 5322da7104f1)
  • Codex configuration contract: The checked sibling Codex source defines developer_instructions as a developer-role message and stops loading project instructions when project_doc_max_bytes is zero; its exec CLI applies -c overrides before building the session configuration. (codex-rs/core/config.schema.json:5668, 78c290807ce7)
  • Current-main comparison: The fetched current-main translation runner still passes the combined system prompt through stdin and has neither introduced configuration override, so the central change is not already implemented on main. (scripts/docs-i18n/translator.go:243, 437ef6160e16)
  • Regression and live evidence supplied with this PR: The PR body reports two baseline duplicated-marker responses and six after-fix real Codex calls across Korean, Japanese, and German, each completing with one invocation and exact marker/structure validation. (5322da7104f1)
  • Feature history: History shows sustained maintenance of the docs-i18n translation boundary by Peter Steinberger, including earlier prompt-centralization and translation-safeguard work. (scripts/docs-i18n/translator.go:204, 1d4188138e95)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Mason Huang: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready review for head 5322da7104f142eaeab14bcf2207f1a3e75c40ef.

Exact-head CI run 33479396092 completed successfully with no failed jobs. This resolves the CI-completion item in ClawSweeper's review; the PR is proceeding through the maintainer-authorized native prepare/merge flow. ClawSweeper identified no actionable correctness or security finding, and fresh Codex autoreview was scoped-clean at its default P0 threshold.

The review's generic stored-data alert does not apply: these paths add conditional diagnostics and instruction delivery changes, not vector/embedding metadata, SQLite schema, migration, retention, or persistent-store behavior. Exact-count validation and promptVersion remain unchanged.

The final candidate passed six fresh live leaf calls—Korean 3/3, Japanese 2/2, German 1/1—with each protected marker present exactly once and structure validation passing. All six response texts were checked for precedence, default-account restriction, the 24-hour bot-identity cache, restart lookup, and token-change invalidation. The authorized ten-call canary cap included intermediate-candidate failures and was not exceeded. The original baseline had two separately authorized failing captures.

Local proof on the reviewed code:

go -C scripts/docs-i18n test -count=1 ./...
go -C scripts/docs-i18n build -o /tmp/docs-i18n-c2b941
node scripts/check-changed.mjs -- scripts/docs-i18n/prompt.go scripts/docs-i18n/prompt_test.go scripts/docs-i18n/translator.go scripts/docs-i18n/translator_test.go scripts/docs-i18n/doc_chunked_raw.go scripts/docs-i18n/doc_chunk_diagnostics_test.go docs/.i18n/README.md
git diff --check

The instruction-role and diagnostic regressions failed before the repair and pass after it. Actual pinned-Codex loopback payload capture independently verified developer-role delivery and removal of repository instructions. Production/tooling is net +8 lines: six for missing diagnostics and two for the corrected instruction boundary; tests are net +74, docs +7.

Proof limits remain explicit: the live run covered the exact leaf, not full-page/shard regeneration; it used macOS arm64/Go 1.27.0 and the original Codex 0.146.1/model/effort settings. No Full/Incremental workflow was dispatched or cancelled, no generated docs/TM were edited, and temporary provider credentials were removed. A stale local native-wrapper bootstrap was resolved by using current-main tooling; the PR head and its green CI were unchanged.

@steipete
steipete merged commit addb509 into main Sep 1, 2026
223 checks passed
@steipete
steipete deleted the steipete/elated-kirch-c2b941 branch September 1, 2026 08:18
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit to openclaw/clawsweeper that referenced this pull request Sep 1, 2026
…arnings (#1341)

Preserve dependency repository and full commit identity through review
evidence, saved reports, and public comments. Keep dependency docs and VISION
references pinned to their own repository; leave conflicting or unresolved
locations unlinked instead of guessing.

Stop treating generic diagnostic IDs and metadata as standalone vector-storage
evidence. Recognize Go test files through the shared role owner while retaining
real storage, migration, rename, and incomplete-evidence warnings.

Add pinned before/after production replay and regression coverage. Tighten the
Markdown destination assertions that CodeQL flagged, rather than suppressing
those alerts. Current-head CI and CodeQL are green; ClawSweeper rates the repair
5/6 with sufficient proof and no remaining findings.

Reproduction: openclaw/openclaw#134934 (comment)
Clarification: openclaw/openclaw#134934 (comment)
CI: https://github.com/openclaw/clawsweeper/actions/runs/33561412301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant