Skip to content

Add missing 'unset' in config flag vectorizing - #3043

Open
almuthanna-athamina wants to merge 1 commit into
google:mainfrom
almuthanna-athamina:fix-config-flag-unset-vectorizing
Open

Add missing 'unset' in config flag vectorizing#3043
almuthanna-athamina wants to merge 1 commit into
google:mainfrom
almuthanna-athamina:fix-config-flag-unset-vectorizing

Conversation

@almuthanna-athamina

Copy link
Copy Markdown

Fix multi-instance default flag resolution in config_flag.cpp by populating missing instance flags with "unset". This ensures that unspecified instance flags fall back to their per-instance defaults rather than inadvertently replicating the primary instance's settings.

Bug: 354927775, 543955575

@jmacnak jmacnak added the kokoro:run Run e2e tests. label Aug 18, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:run Run e2e tests. label Aug 18, 2026
@Databean
Databean force-pushed the fix-config-flag-unset-vectorizing branch from fbc40dd to 946e338 Compare August 19, 2026 14:39
@Databean Databean added the kokoro:run Run e2e tests. label Aug 19, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:run Run e2e tests. label Aug 19, 2026
@jmacnak

jmacnak commented Aug 19, 2026

Copy link
Copy Markdown
Member

Note: ag/41631463

@Databean
Databean force-pushed the fix-config-flag-unset-vectorizing branch from 946e338 to 1c2a64d Compare August 24, 2026 22:24
@Databean Databean added the kokoro:run Run e2e tests. label Aug 24, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:run Run e2e tests. label Aug 24, 2026
@Databean

Copy link
Copy Markdown
Member

There's a failure in GitSwCarDevSdv, which I was able to reproduce locally:

$ cat $HOME/sdv_config.json
{
  "instances": [
    {
      "name": "ins-1",
      "vm": {
        "cpus": 2,
        "memory_mb": 2048
      },
      "boot": {
        "extra_bootconfig_args": "androidboot.sdv.instance_name=instance1 androidboot.virt.address=3 androidboot.sdv.boot_mode=unlocked"
      },
      "security": {
        "guest_enforce_security": false
      },
      "disk": {
        "default_build": "@ab\/git_main-swcar-dev\/aosp_cf_x86_64_sdv_core-trunk_staging-userdebug"
      },
      "graphics": {
        "gpu_mode": "none"
      }
    },
    {
      "name": "ins-2",
      "vm": {
        "cpus": 4,
        "memory_mb": 4096
      },
      "boot": {
        "extra_bootconfig_args": "androidboot.sdv.instance_name=instance2 androidboot.virt.address=4 androidboot.sdv.boot_mode=unlocked"
      },
      "security": {
        "guest_enforce_security": false
      },
      "disk": {
        "default_build": "@ab\/git_main-swcar-dev\/aosp_cf_x86_64_sdv_media-trunk_staging-userdebug"
      },
      "graphics": {
        "displays": [
          {
            "width": 1920,
            "height": 1080
          }
        ],
        "gpu_mode": "gfxstream_guest_angle_host_swiftshader"
      }
    }
  ],
  "netsim_bt": false,
  "metrics": {
    "enable": true
  },
  "common": {
    "host_package": "@ab\/git_main-swcar-dev\/aosp_cf_x86_64_sdv_media-trunk_staging-userdebug"
  }
}
$ bazel run //cuttlefish/package:cvd -- load $HOME/sdv_config.json
/var/tmp/cvd/270178/1787611512682778/artifacts/host_tools/bin/assemble_cvd --helpxml returned unexpected response -1. Stderr was assemble_cvd failed:
7. assemble_cvd.cc:663 | AssembleCvdMain | Failed to parse flags.
6. feature.cpp:69 | ProcessFlags | Unable to parse flags.
5. feature.h:169 | TopologicalVisit |
4. feature.h:165 | operator() | Callback error on DisplaysConfigsFlagImpl
3. feature.cpp:65 | operator() |
2. display.cpp:84 | Process |
1. display.cpp:136 | ParseDisplayConfigsFromArgs |
 | cuttlefish/host/libs/config/display.cpp:56
 v Result<std::optional<CuttlefishConfig::DisplayConfig>> cuttlefish::ParseDisplayConfig(const std::string &)
Expected "keyvalue.size()" == "2" but was 1 vs 2. Invalid display flag key-value: "unset,width=1920,height=1080,dpi=140"

When launching multi-device or multi-VM cuttlefish instances with heterogeneous configuration presets (e.g. --config=sdv_core_instance1,phone or --config=wear,phone), instances that omit a specific flag are padded with "unset" so that per-instance flags are properly aligned across instances.

Previously, setting the gflags default with SET_FLAGS_DEFAULT when the value contained "unset" poisoned the gflags default table, causing GetFlag*ValueForInstances to parse "unset" as a boolean/integer and abort during assembly. Furthermore, non-vectorized flags (like display0..3, touchpad, custom_actions, extra_bootconfig_args, secure_hals, etc.) were incorrectly comma-vectorized with "unset", breaking their syntax.

This change:
1. Adds defensive checks in GetFlagBoolValueForInstances, GetFlagIntValueForInstances, and GetFlagStrValueForInstances to fall back safely to a non-unset default when an instance is marked "unset".
2. Handles "unset" in default_vvmtruststore_file_name gracefully in resolve_instance_files.
3. Skips "unset" padding in config_flag for non-vectorized flags (display0..3, custom_actions, touchpad, extra_bootconfig_args, secure_hals, extra_kernel_cmdline, gem5_debug_flags, group_id, straced_host_executables, and flags prefixed with webrtc_ or ap_).
4. Adds a fail-fast CF_EXPECTF check if any future unlisted flag contains commas in its preset value when being vectorized.

Bug: 354927775, 543955575
@almuthanna-athamina
almuthanna-athamina force-pushed the fix-config-flag-unset-vectorizing branch from 1c2a64d to f50a13b Compare August 28, 2026 10:28
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.

4 participants