Skip to content

[Bug]: Clean-update no-op skips explicit --language changes #538

Description

Description

An explicit language change is ignored when the repository has no source changes since the last OpenWiki update. The no-op predicate considers only whether a user message is present; it does not consider options.language.

As a result, a command such as openwiki code --update --language fr --print can report that no repository changes were detected and return before the translation plan is created.

Affected code

  • src/agent/utils.ts:179-181: shouldCheckUpdateNoop(options) returns only !options.userMessage?.trim().
  • src/agent/index.ts:162-181: the clean-tree early return happens before provider/model setup and before runOpenWikiAgentCore().
  • src/agent/index.ts:310-319: the translation plan that honors a requested language is therefore never reached.
  • src/startup.ts:100-130: the pre-credential clean-update shortcut calls the same predicate and can also treat a language-changing command as skippable.

Steps to Reproduce

  1. Initialize an OpenWiki repository in English and commit the generated wiki and .last-update.json.
  2. Ensure the repository is clean and HEAD matches the saved metadata.
  3. Run:
    openwiki code --update --language fr --print
  4. Observe:
    No repository changes detected since the last OpenWiki update; skipping agent run.
  5. Inspect the wiki; existing pages remain in English and persisted language does not change to French.

Expected Behavior

An explicit request to change the wiki language should run the translation pass even when source code and documentation inputs are otherwise unchanged.

Actual Behavior

The clean-tree optimization returns before language comparison or translation occurs.

Why this matters

Changing language is a state transition, not a source-code update. The current optimization makes the documented --language option unreliable precisely on stable repositories, and scheduled/print runs can exit successfully while doing none of the requested work.

Suggested direction

Make the no-op decision aware of language intent:

  1. Read the persisted wiki language.
  2. Normalize the explicitly requested locale.
  3. Skip only when no user message exists and the requested language is absent or equivalent to the persisted language.

At minimum, any explicit options.language should bypass the no-op shortcut. Apply the same rule in both runOpenWikiAgent and the startup pre-credential optimization.

Missing regression coverage

test/update-noop.test.ts tests user-message behavior but does not pass a language option. An integration-level test should assert that a clean update with a differing language is not skipped, while the same-language case may still skip.

Environment

  • OS: macOS
  • Node.js: v24.14.1
  • Affected revision: 63c848c on main
  • OpenWiki version: current source checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions