Skip to content

check_config cannot tell an env-pinned connection from a blind scan — both report auto_discovered and both get the fallback warning #192

Description

@PYDuquesnoy

check_config reports connection_source: auto_discovered and emits the fallback warning for a connection that was pinned explicitly by IRIS_HOST/IRIS_WEB_PORT. An env-pinned connection and a blind port scan are indistinguishable in its output.

Measured

Same binary (0.18.0), same instance, two environments:

connection_source fallback_warning
IRIS_HOST=localhost IRIS_WEB_PORT=43080 … auto_discovered PRESENT
no IRIS_* at all auto_discovered PRESENT

Byte-identical on both fields. (The namespace differs only because the localhost scan reads IRIS_NAMESPACE for its own probe credentials — not a source distinction.)

Cause

crates/iris-agentic-dev-core/src/tools/mod.rs:4106-4110, at startup:

let (source, file) = if config_path.is_some() {
    (ConnectionSource::ConfigFile, config_path)
} else {
    (ConnectionSource::AutoDiscovered, None)   // env vars land here
};

The decision reads only whether a .iris-agentic-dev.toml was found. ConnectionSource::EnvVars is assigned in exactly one place — ConnectionState::new_disconnected(ConnectionSource::EnvVars) at :4114 — so no live connection can ever report it.

The information is not missing, it is discarded: discovery.rs step 2 sets DiscoverySource::EnvVar on the IrisConnection correctly. The mapping to ConnectionSource never asks.

Why this is worse than a wrong label

check_config's explicit-source test is:

let is_explicit = matches!(conn.source, ConnectionSource::ConfigFile | ConnectionSource::EnvVars);

so the fallback warning fires on an explicitly pinned connection and instructs the operator to pin what is already pinned:

No .iris-agentic-dev.toml config file found. Connection established via fallback discovery (Docker/port scan). Set OBJECTSCRIPT_WORKSPACE or create a .iris-agentic-dev.toml in your project root to pin the target instance.

That warning exists (#21) to flag the one genuinely dangerous case — fallback discovery can silently target the wrong instance. Firing it on every env-registered setup buries the case it was built for. Every workshop VM and every ~/.claude.json registration with an env block is in this state today.

0.18.0 widens it. A connection resolved from VS Code settings is explicit configuration too, and currently gets the same treatment.

This is the report-vs-mechanism split that #169 fixed for the write gate by routing reporting and enforcement through one function. Same shape, different pair.

Fix

Derive ConnectionSource from the connection's own DiscoverySource rather than from config_path alone, and let is_explicit follow it:

  • DiscoverySource::EnvVarEnvVars
  • DiscoverySource::VsCodeSettings → a VsCodeSettings variant, explicit
  • DiscoverySource::ExplicitFlag → explicit
  • LocalhostScan / DockerAutoDiscovered, which is the only case the warning should fire on

A config file still wins, since it is the narrowest statement of intent.

Activity

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

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