Skip to content

[Repo Assist] perf: pre-compile redaction and UI regexes (CommandCenterTextHelper, WizardPage, SchemaConfigEditor, QuickSendDialog)#286

Draft
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/perf-precompile-redaction-regexes-2026-05-06-1169651c7834ee5a
Draft

[Repo Assist] perf: pre-compile redaction and UI regexes (CommandCenterTextHelper, WizardPage, SchemaConfigEditor, QuickSendDialog)#286
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/perf-precompile-redaction-regexes-2026-05-06-1169651c7834ee5a

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 6, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Eleven Regex.Replace / Regex.Match calls across four files were invoking the .NET regex engine from a literal pattern string on every call — either recompiling or fetching from the small static cache. This PR replaces them with private static readonly Regex fields compiled once at startup using RegexOptions.Compiled.

Files changed

File Patterns pre-compiled Notes
CommandCenterTextHelper.cs 8 Called every time support/diagnostic text is built (status detail window)
WizardPage.cs 2 (URL + device-code) Called on every wizard-page render; URL pattern was duplicated at two call sites
SchemaConfigEditor.xaml.cs 1 (camelCase split) Called for every property label in the schema editor
QuickSendDialog.cs 1 (missing-scope) Error path only; minor but consistent with codebase style

No functional change

Pattern strings, replacement strings, and RegexOptions flags are unchanged. Match timeouts that were passed to Regex.Replace(..., TimeSpan) are now in the Regex constructor, which has identical effect — the timeout applies per match call either way.

Test Status

  • dotnet test OpenClaw.Tray.Tests392 passed, 1 skipped (same as baseline; skipped test is Windows-only DPAPI)
  • dotnet test OpenClaw.Shared.Tests1219 passed, 1 pre-existing failure, 20 skipped (unchanged)
  • build.ps1 requires Windows and was not run in this Linux CI environment; no Windows-specific code was changed

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

Replace 11 on-demand Regex.Replace/Match calls (in CommandCenterTextHelper,
WizardPage, SchemaConfigEditor, and QuickSendDialog) with static readonly
pre-compiled Regex fields using RegexOptions.Compiled.

Each field is compiled once at startup and reused on every invocation,
eliminating the overhead of per-call regex compilation or .NET cache
lookups.

Affected call sites:
- CommandCenterTextHelper.RedactSupportPath: 2 patterns
- CommandCenterTextHelper.RedactSupportValue: 6 patterns
- WizardPage.Render: 2 patterns (URL detection + device code)
- SchemaConfigEditor.GetLabel: 1 pattern (camelCase → label)
- QuickSendDialog.TryExtractMissingScope: 1 pattern

No behaviour change; all 393 Tray tests and 1219 Shared tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Leave QuickSendDialog to the dedicated titlebar/focus PR so this Repo Assist perf change can remain independent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant