Skip to content

Pr ci fix clean#49816

Closed
ralyodio wants to merge 4 commits into
openclaw:mainfrom
ralyodio:pr-ci-fix-clean
Closed

Pr ci fix clean#49816
ralyodio wants to merge 4 commits into
openclaw:mainfrom
ralyodio:pr-ci-fix-clean

Conversation

@ralyodio

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: L labels Mar 18, 2026
@greptile-apps

greptile-apps Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a /alias and /unalias command system to the TUI, allowing users to save named prompt shortcuts that persist across sessions in a JSON file under the OpenClaw state directory. It also adds a missing vi.mock for dispatchReplyFromConfigWithSettledDispatcher to fix flaky CI runs in the Matrix extension tests.

Key changes:

  • src/tui/tui-aliases.ts (new): Alias store with shell-like tokeniser (parseTuiAliasArgs supporting single/double quotes and backslash escapes), name normaliser, JSON file I/O under <state-dir>/tui/aliases.json, and a round-trip sanitiser (normalizeAliasRecord).
  • src/tui/tui-command-handlers.ts: Handles /alias [name] [prompt] (list, run, or save) and /unalias <name> (remove). The persistAliases helper uses a correct write-then-update-state pattern so in-memory state is never mutated if the disk write fails.
  • src/tui/tui.ts: Loads aliases at startup with a graceful load-failure warning; wires refreshAutocompleteupdateAutocompleteProvider so autocomplete reflects alias changes immediately.
  • src/tui/commands.ts: Adds /alias and /unalias to getSlashCommands with prefix-filtered completions and to helpText.
  • src/tui/tui-types.ts: Extends TuiStateAccess with tuiAliases: Record<string, string>.
  • Test coverage is thorough, including rollback-on-disk-failure and autocomplete refresh assertions.

One minor UX concern: listAliases (invoked by /alias with no arguments) displays each alias as /${name} -> ${prompt}, which may lead users to believe they can invoke it by typing /<name> directly. In practice, unknown slash commands fall through to sendMessage and are sent verbatim to the agent; the correct invocation path is /alias <name>.

Confidence Score: 4/5

  • Safe to merge; the alias feature is well-tested and the error-handling pattern is correct. The one flag is a minor display UX issue, not a logic bug.
  • The implementation is clean and follows existing patterns in the codebase. The write-before-update state pattern in persistAliases is correct and tested. All new edge cases (empty prompts, reserved names, disk failures, parse errors) have corresponding tests. The only issue is a cosmetic display inconsistency in listAliases where the format /${name} may mislead users about the actual invocation syntax.
  • src/tui/tui-command-handlers.ts — the listAliases display format.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/tui/tui-command-handlers.ts
Line: 264-266

Comment:
**Misleading alias display format**

`listAliases` displays each alias as `/${name} -> ${prompt}`, which implies users can invoke it via `/<name>` (e.g. `/review`). However, the `default` branch of `handleCommand` forwards unknown slash commands straight to `sendMessage`, so typing `/review` would literally send the text `/review` to the agent rather than running the alias. The correct invocation is always `/alias <name>`.

Consider formatting the output so it matches the expected invocation, for example:

```suggestion
    chatLog.addSystem(`/alias ${name} (-> ${prompt})`);
```

Or at a minimum, add a header line clarifying how to invoke them (e.g. `"run with: /alias <name>"`).

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "Handle empty quoted ..."

Comment on lines +264 to +266
for (const [name, prompt] of entries) {
chatLog.addSystem(`/${name} -> ${prompt}`);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Misleading alias display format

listAliases displays each alias as /${name} -> ${prompt}, which implies users can invoke it via /<name> (e.g. /review). However, the default branch of handleCommand forwards unknown slash commands straight to sendMessage, so typing /review would literally send the text /review to the agent rather than running the alias. The correct invocation is always /alias <name>.

Consider formatting the output so it matches the expected invocation, for example:

Suggested change
for (const [name, prompt] of entries) {
chatLog.addSystem(`/${name} -> ${prompt}`);
}
chatLog.addSystem(`/alias ${name} (-> ${prompt})`);

Or at a minimum, add a header line clarifying how to invoke them (e.g. "run with: /alias <name>").

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/tui/tui-command-handlers.ts
Line: 264-266

Comment:
**Misleading alias display format**

`listAliases` displays each alias as `/${name} -> ${prompt}`, which implies users can invoke it via `/<name>` (e.g. `/review`). However, the `default` branch of `handleCommand` forwards unknown slash commands straight to `sendMessage`, so typing `/review` would literally send the text `/review` to the agent rather than running the alias. The correct invocation is always `/alias <name>`.

Consider formatting the output so it matches the expected invocation, for example:

```suggestion
    chatLog.addSystem(`/alias ${name} (-> ${prompt})`);
```

Or at a minimum, add a header line clarifying how to invoke them (e.g. `"run with: /alias <name>"`).

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55402bace6

ℹ️ 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".

Comment thread src/tui/tui-aliases.ts
Comment on lines +95 to +98
if (!inSingle && !inDouble && ch === "\\") {
tokenStarted = true;
escaped = true;
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve literal backslashes in alias prompts

When the alias prompt contains unquoted backslashes, this parser treats each \ outside quotes as an escape introducer and drops it. A command like /alias path summarize C:\Users\me\repo is therefore persisted as summarize C:Usersmerepo, so running the alias later sends the wrong prompt. This is a real regression for Windows paths, regexes, and other backslash-heavy prompts unless users remember to quote the entire prompt.

Useful? React with 👍 / 👎.

Comment on lines +563 to +568
const nextAliases = {
...state.tuiAliases,
[aliasName]: aliasPrompt,
};
try {
await persistAliases(nextAliases);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Merge the shared alias file before overwriting it

The TUI loads aliases once at startup, but /alias rewrites the entire aliases.json from the current in-memory map here. If two TUI windows are open, or the file changes externally after startup, saving from the older process will silently discard aliases added by the newer one because nextAliases starts from stale state. For example: window A saves review, window B saves shipit, and the second write leaves only shipit on disk.

Useful? React with 👍 / 👎.

@openclaw-barnacle

Copy link
Copy Markdown

Please don't make PRs for test failures on main.

The team is aware of those and will handle them directly on the codebase, not only fixing the tests but also investigating what the root cause is. Having to sift through test-fix-PRs (including some that have been out of date for weeks...) on top of that doesn't help. There are already way too many PRs for humans to manage; please don't make the flood worse.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix r: no-ci-pr Auto-close: PR only chasing known main CI/test failures. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants