Skip to content

Custom inference model settings from the inference Secret; VM restart fixes - #177

Open
sauagarwa wants to merge 3 commits into
validatedpatterns-sandbox:mainfrom
sauagarwa:custom-inference-model-settings
Open

sauagarwa wants to merge 3 commits into
validatedpatterns-sandbox:mainfrom
sauagarwa:custom-inference-model-settings

Conversation

@sauagarwa

Copy link
Copy Markdown
Collaborator

Summary

  • Custom inference model settings from the inference Secret. The custom-inference sandbox can set the model's default thinking level, reasoning flag, maxTokens and contextWindow (like NemoClaw's MODEL_REASONING, MODEL_MAX_TOKENS and MODEL_CONTEXT_WINDOW). The bundled profile reads them from optional Secret keys (thinking, reasoning, max_tokens, context_window); a missing or empty key is not applied, so OpenClaw keeps its default, and an invalid value fails the apply naming the setting. The RHDH form and catalogs list them as optional fields; values-secret.yaml.template shows them.
  • VM restart fixes. saw-restart-pending now also lists VMs whose template checksum annotations differ from the running instance (KubeVirt 1.8 does not set RestartRequired for annotation-only changes, so BOM updates were never listed). saw-restart queues the guest poweroff with --no-block, so an ssh disconnect during shutdown is no longer reported as a failed command.
  • Container installation guide refresh. 0.1.10 trace relay note, bootstrap window by its 0.1.10 setting, named e2e check, and two misplaced paragraphs moved.

Testing

  • Unit: custom endpoint, profiles, BOM, catalog, RHDH form, saw-users chart, restart scripts (402 passed).
  • Live on a VM workspace (OpenShell 0.1.10, OpenClaw 2026.11.8): settings changed in Vault reached the OpenClaw model entry after a restart (maxTokens 32768 → 16384 → 32768, thinking high → low); saw-restart-pending listed the VM after a BOM change and saw-restart completed through the guest poweroff.

Follow-up

Upgrading an existing VM workspace to OpenClaw 2026.11.8 needs openclaw doctor --fix --non-interactive (after backing up the state) before onboarding; otherwise config writes are refused and enabling saw-tool-gate fails. Not in this PR.

The custom-inference sandbox can now set the custom model's thinking
default, reasoning flag, maxTokens and contextWindow (like NemoClaw's
MODEL_REASONING, MODEL_MAX_TOKENS and MODEL_CONTEXT_WINDOW). An explicit
reasoning: false keeps a thinking default without sending
reasoning_effort.

Each setting is a literal or an input. The bundled profile reads them
from optional keys of the inference Secret (thinking, reasoning,
max_tokens, context_window): a key that is absent or empty is not
applied, so OpenClaw keeps its own default, and an invalid value fails
the apply naming the setting. The catalogs and RHDH forms list them as
optional fields, and values-secret.yaml.template shows them under the
custom-inference entry.

Assisted-By: Claude
saw-restart-pending only looked for RestartRequired, which KubeVirt 1.8
does not set when just the template's openshell.pattern/*-checksum
annotations change, so a BOM update left VMs on their old inputs with
nothing listed. It now also compares those checksums with the running
instance's.

saw-restart ran a blocking poweroff; the ssh tunnel dropped before it
returned and virtctl reported exit status 1, which the script treats as
a failed command. Queue the poweroff with --no-block so the command
returns before sshd stops.

Assisted-By: Claude
Drop the 0.1.6 note on agent traces (0.1.10 relays them; OpenClaw does
not send them yet), describe the driver's bootstrap window by its 0.1.10
setting, name the e2e check behind W6, and move the Kata pointer and the
portal Task recovery note to the sections they belong to.

Assisted-By: Claude
@sauagarwa
sauagarwa marked this pull request as ready for review November 30, 2026 19:29
@mtalvi
mtalvi self-requested a review November 30, 2026 21:09

@mtalvi mtalvi left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great PR. Left small comments, also addressed CI fails

Comment on lines +1020 to +1023
if isinstance(src, dict):
text = resolve_bom_input(src, read_value, f"{where}: inference {key}", forbidden)
if text:
out[key] = parse_model_setting(key, text, f"{where}: inference {key}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Severity: Warning
  • Issue: The new optional inputs break Kubernetes custom-inference compilation even when unset. Its read_model callback only permits url and model, so resolving thinking raises ContractError. This causes the four failures in both [CI jobs](https://github.com/validatedpatterns-sandbox/secure-agent-workspace/actions/runs/46495568485). Reproduced all four locally.
  • Fix: Update the Kubernetes adapter to recognize the four optional keys and return "" when absent, preserving credential restrictions. Since these settings are documented as VM-only, explicitly reject populated settings until Kubernetes startup supports them. An in-memory allowlist correction made all 29 tests in the two affected files pass.
  • Message: Found the cause of the red CI: these optional reads hit the Kubernetes adapter’s model/url-only allowlist. Can we handle absent settings there and explicitly gate unsupported values? Currently, even an unchanged custom-inference container profile fails compilation.

Comment on lines 4006 to 4010

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Severity: Warning
  • Issue: Clearing optional settings does not restore defaults on existing workspaces. Missing inputs skip reconciliation, leaving previously written maxTokens, contextWindow, and explicit reasoning overrides behind. Verified the configuration mutation and checked the pinned OpenClaw 2026.11.8 onboarding code: it preserves existing model metadata.
  • Fix: Track previously managed overrides and their original values. When an input disappears, restore its original value or remove the managed override. Add a set → clear → reapply regression test.
  • Message: Can we reconcile removed settings too? Clearing these fields currently leaves the old overrides in OpenClaw after restart, so users can’t return to the documented defaults.

Comment on lines +16 to +17
vmis="$(oc get vmi -A -l openshell.pattern/role=gateway -o json)"
pending="$(jq -r --argjson vmis "${vmis}" '

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Severity: Warning
  • Issue: The entire VMI list is passed as one argument, hitting Linux’s per-argument size limit. Reproduced with 40 chart-derived VMI objects (~200 KB): the script exits 126 with Argument list too long, listing no pending restarts.
  • Fix: Replace --argjson vmis "${vmis}" with --slurpfile vmis <(printf '%s' "${vmis}"), and change $vmis.items to $vmis[0].items. Verified this lists all 40 pending VMs successfully.
  • Message: Can we pass the VMI JSON through a file instead of argv? With 40 chart-derived VMIs, this fails before listing anything. --slurpfile fixes the same reproduction.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants