gstack icon indicating copy to clipboard operation
gstack copied to clipboard

update_check: false gates the binary but not the preamble instruction text — upgrade-handling prose ships unconditionally

Open jc0d35 opened this issue 5 months ago • 3 comments

Summary

update_check: false correctly silences the gstack-update-check binary (it exits early and emits nothing), but the instruction text that tells the agent how to interpret update-check output still ships in every generated SKILL.md preamble. The runtime layer honors the opt-out; the instruction layer does not.

This is the same bug class as #1150 (preamble content not gated by a config opt-out), for a different flag (update_check) and different content (upgrade-handling prose).

Why it's a real opt-out, not a misconfig

update_check is a first-class config key:

  • bin/gstack-config:41 — documented: # update_check: true # false = suppress version check notifications
  • bin/gstack-config:120 — registered default true
  • Present in the active-values / known-keys lists (bin/gstack-config:347,363)

The layer disagreement

Binary (honors the flag): bin/gstack-update-check:32-34 reads update_check, and on false exits 0 with no output before any version logic.

Instruction text (ignores the flag): scripts/resolvers/preamble/generate-upgrade-check.ts:8,10 unconditionally emit:

If output shows `UPGRADE_AVAILABLE <old> <new>`: read .../gstack-upgrade/SKILL.md and follow the "Inline upgrade flow" ...
If output shows `JUST_UPGRADED <from> <to>`: print "Running gstack v{to} (just updated!)" ...

These render into every skill's preamble regardless of the flag.

Inconsistency with every other config flag

Every other runtime flag follows an echo-then-gate convention — generate-preamble-bash.ts echoes the value (PROACTIVE:, SKILL_PREFIX:, EXPLAIN_LEVEL:, QUESTION_TUNING:) and the instruction layer gates on it. update_check is the only flag with no echoed signal and no instruction-layer gate.

Impact

Functionally the upgrade check is suppressed — the binary emits nothing, so the conditional is vacuously false and the agent takes no upgrade action. The residual cost is:

  • ~13 lines of dead upgrade-handling instructions in every preamble for users who opted out.
  • The model still reads and visibly "considers" upgrade state, which reads to the user as the check still firing.
  • Convention drift: opt-out should mean opt-out at both layers (the principle #1150 is built on).

Suggested fix (surgical — ~4 lines)

generateUpgradeCheck() is misnamed: it bundles four concerns (PROACTIVE, SKILL_PREFIX, upgrade-availability/just-upgraded, feature discovery), so gating the whole function would wrongly disable the proactive/skill-prefix prose. Instead:

  1. Echo UPDATE_CHECK: $_UPDATE_CHECK in generate-preamble-bash.ts alongside the other flags.
  2. Gate only lines 8 and 10 of generate-upgrade-check.ts on UPDATE_CHECK == "true".
  3. Regenerate via bun run gen:skill-docs.

Secondary note

update_check: false also suppresses the post-upgrade JUST_UPGRADED "just updated!" confirmation (the binary exits before :119). That arguably differs from a "version check notification" — maintainer may want to scope whether the just-upgraded message should survive the opt-out.

jc0d35 avatar Jun 14 '26 12:06 jc0d35

Picking this up. Fixed via the echo-then-gate convention the other flags use: generate-preamble-bash.ts now reads update_check and echoes UPDATE_CHECK, and generate-upgrade-check.ts gates the UPGRADE_AVAILABLE / JUST_UPGRADED prose on UPDATE_CHECK == false. The gstack-upgrade skill's own inline-flow doc is left alone (a user in that skill is explicitly upgrading). PR incoming with a regression test that pins the gate across all 49 preamble-bearing SKILL.md.

0xDevNinja avatar Jun 16 '26 06:06 0xDevNinja

This is a configuration-to-preamble consistency problem.

If update_check: false disables the binary/update behavior, the always-loaded preamble should not still ship unconditional upgrade-handling prose.

Otherwise the model receives instructions for behavior the config explicitly disabled.

A standard AISP-style config contract could be:

[
  {
    "role": "system",
    "content": {
      "protocol": "AISP V1.0.0",
      "axiom_0": "Human_Sovereignty_and_Wellbeing",
      "id": "gstack_update_check_preamble_contract_aisp",
      "name": "gstack Update Check Preamble Contract",
      "version": "1.0.0",
      "license": "MIT",
      "summary": "Machine-checkable contract ensuring update_check config gates both binary behavior and preamble instructions.",
      "flow_format": "mermaid",
      "loading_mode": "node",
      "tools": ["filesystem"],
      "params": {
        "config_path": "string",
        "preamble_path": "string"
      },
      "system_prompt": ""
    }
  },
  {
    "role": "user",
    "content": {
      "instruction": "STRICTLY OBEY aisp_contract; its non_negotiable rules are inviolable; then RUN aisop.main",
      "user_input": "{user_input}",
      "aisp_contract": {
        "profile": "aisp.skill.v1",
        "invocation": {
          "mode": "config_preamble_sync",
          "when_to_use": [
            "when update_check config changes",
            "before generating always-loaded gstack preamble",
            "before emitting upgrade-handling prose"
          ],
          "when_not_to_use": [
            "manual docs page unrelated to runtime preamble"
          ]
        },
        "non_negotiable": [
          {
            "rule": "If update_check is false, always-loaded preamble must not instruct automatic update handling.",
            "enforced_by": "validate.step2:sys.assert"
          },
          {
            "rule": "Config gates should affect both runtime behavior and model-visible guidance.",
            "enforced_by": "validate.step3:sys.assert"
          }
        ],
        "discovery": {
          "category": "config_sync",
          "tags": ["gstack", "update_check", "preamble", "config", "aisp"]
        },
        "risk_level": "medium",
        "resources": [
          {
            "id": "config",
            "path": "{config_path}",
            "kind": "config",
            "mode": "read_only",
            "when": "Read before preamble generation.",
            "scope": "skill"
          },
          {
            "id": "preamble",
            "path": "{preamble_path}",
            "kind": "template",
            "mode": "read_only",
            "when": "Read before preamble validation.",
            "scope": "skill"
          }
        ]
      },
      "aisop": {
        "main": "graph TD\n    load[Load config and preamble] --> generate[Generate gated preamble] --> validate[Validate config consistency] --> report[Emit result] --> end_node((End))"
      },
      "functions": {
        "load": {
          "step1": "sys.io.read(config_path) -> config",
          "step2": "sys.io.read(preamble_path) -> preamble",
          "output_mapping": "inputs"
        },
        "generate": {
          "step1": "Generate preamble sections according to config.update_check.",
          "output_mapping": "generated_preamble"
        },
        "validate": {
          "step1": "Check whether update prose appears when update_check is false.",
          "step2": "sys.assert('no auto-update prose when update_check false', 'Disabled update check should remove model-visible update instructions')",
          "step3": "sys.assert('runtime and preamble behavior agree', 'Config gate must affect runtime and model guidance')",
          "output_mapping": "preamble_config_validation"
        },
        "report": {
          "step1": "Return validation status and suggested diff.",
          "output_mapping": "config_sync_report"
        },
        "end_node": {
          "step1": "Return config_sync_report."
        }
      }
    }
  }
]

The minimal fix:

1. Gate upgrade-handling prose behind the same update_check flag.
2. Add a generated-preamble test for update_check=false.
3. Ensure model-visible instructions match runtime behavior.

optimization2026 avatar Jun 30 '26 06:06 optimization2026

@16francej — recommend closing this issue only after #2022 lands. The generated preamble currently includes upgrade-result instructions even when update checks are disabled, while #2022 fixes that mismatch. Keep installed-preamble acceptance coverage for both disabled and enabled update checks.

time-attack avatar Jul 15 '26 12:07 time-attack