Skip to content

fix: dx issues#1970

Open
sergiofilhowz wants to merge 3 commits into
mainfrom
fix/dx-issues
Open

fix: dx issues#1970
sergiofilhowz wants to merge 3 commits into
mainfrom
fix/dx-issues

Conversation

@sergiofilhowz

@sergiofilhowz sergiofilhowz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Several DX issues around iii startup and iii worker add made the worker workflow fragile unless everything ran from one directory, with the default file name, on the default port:

  • iii worker add edits config.yaml in the CLI's cwd. Run from any other folder it wrote to a file no engine was watching, then hung for 120s waiting for a worker that would never boot.
  • Worker ops hardcoded the name config.yaml — engines started with --config config.yml (or any custom path) silently split into two files.
  • add copied each worker's default config: block into config.yaml. Workers are configured live through the configuration worker, so those blocks only took effect after a full engine restart (legacy first-boot seeding).
  • The iii-worker-ops daemon hardcoded ws://127.0.0.1:49134; engines on any other port got a daemon stuck in a reconnect loop spamming connectivity warnings.
  • iii refused to start without a config.yaml, and the escape hatch --use-default-config ran file-less — which broke the config setup (worker add, reload watcher) entirely.

Solution

  • iii runs without a pre-existing config file. On a TTY it asks before creating (No config.yaml found in <dir>. Create it and start the engine? [Y/n]); non-interactive sessions (containers, CI) create it without asking. Works for --config <custom-name> too. The created file is deliberately minimal — no pre-listed workers, you opt in with iii worker add:

    # iii engine configuration.
    # Add workers with `iii worker add <name>`; a running engine reloads on save.
    # Configure workers at runtime through the configuration worker (configuration::set).
    workers: []
  • --use-default-config is removed (breaking). The created starter file replaces it, keeping the reload watcher and worker ops functional.

  • iii worker add --host <host[:port]> (and reinstall) installs through a running engine by invoking its worker::add trigger — the engine applies the change in its project directory, so the command works from any folder, machine, or port (iii worker add pdfkit --host localhost:49134). Unreachable hosts fail fast instead of hanging; the local-path timeout message now points at --host.

  • III_CONFIG_PATH handshake: the engine exports its absolutized config path to every process it spawns (worker-ops daemon, sandbox daemon, iii worker start children, and iii --config x.yml worker … dispatch). All worker-op reads/writes resolve through it, so custom config names work end to end.

  • Correct engine URL for daemons: the engine appends --engine ws://127.0.0.1:<actual-port> when spawning iii-worker-ops / iii-sandbox, ending the 49134 reconnect spam on non-default ports.

  • add writes bare - name: entries — no config: blocks (registry/binary/OCI/local/builtin alike). Hand-written blocks are preserved on re-add. Exception: iii-sandbox keeps its block, since its daemon is fail-closed on it and the image allowlist is an operator security surface.

Verification

Live e2e: engine started with --config config.yml on port 49177; iii worker add iii-queue --host localhost:49177 from an unrelated directory appended a bare entry to the engine's config.yml, the engine hot-reloaded and registered the worker, and nothing in the CLI's cwd was touched. Fresh-dir boot auto-created the empty starter file and a follow-up iii worker add iii-state populated it live. Docs + generated CLI reference updated.

Breaking: --use-default-config no longer parses. Scripts using it should just run iii (the config file is created on first run).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added --host for iii worker add/reinstall to install via a running engine (supports ws:///wss:// and custom ports).
    • Improved configuration file selection with --config and III_CONFIG_PATH.
    • When the engine config is missing, it can be created automatically with an empty workers: [] list.
  • Changes

    • Worker installs now write bare - name: entries (using built-in defaults unless a seeded per-worker config: exists).
    • --reset-config now recreates the config entry fresh (dropping hand-written blocks) and applies with --force, with updated messaging/timeouts.
  • Documentation

    • Updated CLI and engine/worker docs for remote installs and the new config behavior.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
iii-website Skipped Skipped Jul 16, 2026 1:30am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 614a82df-29b9-496e-8df3-597ff0d248a6

📥 Commits

Reviewing files that changed from the base of the PR and between 54f5355 and ada8cee.

📒 Files selected for processing (6)
  • docs/next/tutorials/incremental-adoption/overview.mdx
  • docs/next/tutorials/incremental-adoption/overview.mdx.skill.md
  • docs/next/using-iii/engine.mdx
  • docs/next/using-iii/engine.mdx.skill.md
  • docs/next/using-iii/workers.mdx
  • docs/next/using-iii/workers.mdx.skill.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/next/using-iii/workers.mdx
  • docs/next/using-iii/engine.mdx
  • docs/next/tutorials/incremental-adoption/overview.mdx.skill.md
  • docs/next/using-iii/workers.mdx.skill.md
  • docs/next/using-iii/engine.mdx.skill.md

📝 Walkthrough

Walkthrough

The PR adds starter config creation, configurable worker config paths, bare worker entries, remote iii worker add --host and reinstall flows, environment propagation, and related tests and documentation.

Changes

Config and worker lifecycle

Layer / File(s) Summary
Engine config bootstrap and dispatch
engine/src/main.rs, engine/src/cli/*, engine/src/engine/mod.rs, engine/src/workers/config.rs, engine/tests/*
Missing configs are created with workers: []; explicit config paths are forwarded as absolute III_CONFIG_PATH; engine dispatch and worker execution accept environment pairs.
Worker config paths and bare entries
crates/iii-worker/src/cli/config_file.rs, crates/iii-worker/src/cli/local_worker.rs, crates/iii-worker/src/cli/managed.rs, crates/iii-worker/src/core/project.rs, crates/iii-worker/tests/*
Worker config operations honor III_CONFIG_PATH; most add paths write bare entries without copied defaults, while iii-sandbox retains seeded configuration.
Remote worker add and reinstall
crates/iii-worker/src/cli/app.rs, crates/iii-worker/src/cli/remote_ops.rs, crates/iii-worker/src/main.rs
--host normalizes engine endpoints, probes reachability, invokes worker::add, handles outcomes, and supports add and reinstall requests.
Engine worker environment propagation
engine/src/workers/config.rs, engine/src/workers/external.rs, engine/src/workers/registry_worker.rs, engine/tests/fixtures/*
External worker metadata and spawned processes receive configured environment values and the engine’s absolute config path.
CLI and engine documentation
docs/next/cli-reference/*, docs/next/tutorials/*, docs/next/using-iii/*
Documentation describes missing-config creation, bare worker entries, reset behavior, and remote installation through an engine.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • iii-hq/iii#1947: Modifies built-in worker configuration seeding in the same managed worker installation areas.

Suggested reviewers: guibeira

Sequence Diagram(s)

sequenceDiagram
  participant WorkerCLI
  participant remote_ops
  participant iii_worker_ops
  participant EngineConfig
  WorkerCLI->>remote_ops: Normalize --host and build AddOptions
  remote_ops->>remote_ops: Probe engine authority
  remote_ops->>iii_worker_ops: Trigger worker::add
  iii_worker_ops->>EngineConfig: Update engine project config
  EngineConfig-->>remote_ops: Return AddOutcome
  remote_ops-->>WorkerCLI: Report result and exit code
Loading

Poem

A rabbit hops where configs grow,
With empty lists in rows below.
Bare workers bloom, defaults stay near,
Remote engines now listen clear.
“Add by host!” the bunny sings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the PR, but 'dx issues' is too vague to clearly summarize the main change. Use a specific title such as 'support remote worker add via --host and custom config paths'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is detailed and covers what, why, and notes, though it uses Problem/Solution/Verification instead of the template headings.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dx-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

skill-check — docs

5 verified, 689 skipped.

1 warning across the verified workers.

File Approximate line Severity Violation
docs/next/tutorials/incremental-adoption/overview.mdx ~28 warning [Terminology.Hedges] Weak intensifier/hedge 'just' adds emphasis, not information. Cut it or state the claim directly. (warning)

@mintlify

mintlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
iii 🟢 Ready View Preview Jul 15, 2026, 9:39 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
iii 🟡 Building Jul 15, 2026, 9:38 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
crates/iii-worker/src/cli/managed.rs (1)

188-194: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inconsistent hardcoded config.yaml in CLI output.

This PR introduces support for dynamic config paths via III_CONFIG_PATH and correctly updates the handle_managed_add built-in flow to output super::config_file::config_display_name(). However, other add handlers and error messages still hardcode "config.yaml". To prevent user confusion when a custom config path is used, consider replacing these hardcoded strings with the dynamic display name.

  • crates/iii-worker/src/cli/managed.rs#L188-L194: update handle_binary_add to use super::config_file::config_display_name().dimmed().
  • crates/iii-worker/src/cli/managed.rs#L1990-L1996: update handle_oci_pull_and_add to use super::config_file::config_display_name().dimmed().
  • crates/iii-worker/src/cli/local_worker.rs#L724-L729: update the error message in handle_local_add to dynamically reference the config display name.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/iii-worker/src/cli/managed.rs` around lines 188 - 194, The CLI still
hardcodes config.yaml in multiple add flows. Update handle_binary_add in
crates/iii-worker/src/cli/managed.rs at lines 188-194 and
handle_oci_pull_and_add in crates/iii-worker/src/cli/managed.rs at lines
1990-1996 to use super::config_file::config_display_name().dimmed(), and update
the handle_local_add error message in crates/iii-worker/src/cli/local_worker.rs
at lines 724-729 to reference the same dynamic display name.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/iii-worker/src/cli/app.rs`:
- Around line 22-25: Update the shared --reset-config help text in
crates/iii-worker/src/cli/app.rs (lines 22-25) to use neutral wording that
states add requires --force while reinstall enables force automatically.
Regenerate the reinstall-specific documentation in
docs/next/cli-reference/index.mdx (line 268), removing the stale “registry
defaults” wording from its introduction.

In `@crates/iii-worker/src/cli/remote_ops.rs`:
- Around line 21-32: Update host_to_ws_url in
crates/iii-worker/src/cli/remote_ops.rs to add the default engine port 49134 to
full ws:// and wss:// URLs that lack an explicit port, while preserving URLs
with specified ports and updating the pass-through test. In
docs/next/cli-reference/index.mdx at lines 167 and 269, retain or align the
default-port and reinstall documentation with this normalized behavior.

In `@crates/iii-worker/src/main.rs`:
- Around line 687-698: Update remote_source_for_cli so --host does not convert
client-local WorkerSource::Local paths into absolute paths and send them to the
engine. Reject local sources for remote adds, or explicitly treat them as
engine-host paths; preserve supported non-local source handling and ensure
remote installation cannot dereference a client-machine path.

In `@docs/next/using-iii/engine.mdx`:
- Around line 95-96: Update the documentation sentence near the configuration
worker guidance so `config:` blocks are described only as first-boot or
reset-time seeds, not runtime customization. Direct users to the configuration
worker and persisted per-worker configuration for changes after boot, while
preserving the existing runtime customization examples for ports, adapters, and
credentials.

---

Nitpick comments:
In `@crates/iii-worker/src/cli/managed.rs`:
- Around line 188-194: The CLI still hardcodes config.yaml in multiple add
flows. Update handle_binary_add in crates/iii-worker/src/cli/managed.rs at lines
188-194 and handle_oci_pull_and_add in crates/iii-worker/src/cli/managed.rs at
lines 1990-1996 to use super::config_file::config_display_name().dimmed(), and
update the handle_local_add error message in
crates/iii-worker/src/cli/local_worker.rs at lines 724-729 to reference the same
dynamic display name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7894ad69-929a-4255-b87c-cfa794006783

📥 Commits

Reviewing files that changed from the base of the PR and between 15dc993 and 0c48215.

📒 Files selected for processing (30)
  • crates/iii-worker/src/cli/app.rs
  • crates/iii-worker/src/cli/config_file.rs
  • crates/iii-worker/src/cli/local_worker.rs
  • crates/iii-worker/src/cli/managed.rs
  • crates/iii-worker/src/cli/mod.rs
  • crates/iii-worker/src/cli/remote_ops.rs
  • crates/iii-worker/src/core/project.rs
  • crates/iii-worker/src/main.rs
  • crates/iii-worker/tests/config_force_integration.rs
  • crates/iii-worker/tests/config_managed_integration.rs
  • docs/next/cli-reference/index.mdx
  • docs/next/cli-reference/index.mdx.skill.md
  • docs/next/tutorials/incremental-adoption/overview.mdx
  • docs/next/tutorials/incremental-adoption/overview.mdx.skill.md
  • docs/next/using-iii/cli.mdx
  • docs/next/using-iii/cli.mdx.skill.md
  • docs/next/using-iii/engine.mdx
  • docs/next/using-iii/engine.mdx.skill.md
  • docs/next/using-iii/workers.mdx
  • docs/next/using-iii/workers.mdx.skill.md
  • engine/src/cli/exec.rs
  • engine/src/cli/mod.rs
  • engine/src/engine/mod.rs
  • engine/src/main.rs
  • engine/src/workers/config.rs
  • engine/src/workers/external.rs
  • engine/src/workers/registry_worker.rs
  • engine/src/workers/reload.rs
  • engine/tests/cli_args.rs
  • engine/tests/fixtures/argv_probe.sh

Comment thread crates/iii-worker/src/cli/app.rs Outdated
Comment thread crates/iii-worker/src/cli/remote_ops.rs
Comment thread crates/iii-worker/src/main.rs Outdated
Comment thread docs/next/using-iii/engine.mdx Outdated
- cli_integration: check for a 'create' SUBCOMMAND line instead of a raw
  substring — the --config help legitimately says iii offers to create
  the missing file (mirrors the existing 'start' check)
- --reset-config help: neutral wording valid for both add (requires
  --force) and reinstall (forces automatically)
- --host help: document that ws:// and wss:// URLs are used as-is and
  that local worker paths resolve on the engine host
- remote adds: absolutize local paths against the CLI cwd only for
  loopback hosts; non-loopback targets get the path verbatim per the
  WorkerSource::Local engine-host contract, plus a stderr note
- engine.mdx: describe config: blocks as first-boot seeds, not runtime
  customization (matches the configuration worker lifecycle)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/next/cli-reference/index.mdx.skill.md`:
- Line 165: Normalize the duplicated engine-directory wording in the host-option
descriptions: update the iii worker add entry at
docs/next/cli-reference/index.mdx.skill.md lines 165-165 and the iii worker
reinstall entry at lines 267-267 by replacing “ITS project directory” with “its
project directory” or “the engine's project directory.”
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 671f4244-ac1d-49fe-a02d-df3259896a84

📥 Commits

Reviewing files that changed from the base of the PR and between 0c48215 and 54f5355.

📒 Files selected for processing (8)
  • crates/iii-worker/src/cli/app.rs
  • crates/iii-worker/src/cli/remote_ops.rs
  • crates/iii-worker/src/main.rs
  • docs/next/cli-reference/index.mdx
  • docs/next/cli-reference/index.mdx.skill.md
  • docs/next/using-iii/engine.mdx
  • docs/next/using-iii/engine.mdx.skill.md
  • engine/tests/cli_integration.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/iii-worker/src/cli/app.rs
  • docs/next/using-iii/engine.mdx.skill.md
  • docs/next/using-iii/engine.mdx
  • crates/iii-worker/src/cli/remote_ops.rs
  • crates/iii-worker/src/main.rs

| ------ | ----------- |
| `--reset-config` | Discard the worker's config.yaml entry and recreate it from registry defaults. Plain `add --force` would otherwise keep the entry. Only takes effect together with `--force` on add |
| `--reset-config` | Discard the worker's config.yaml entry and recreate it fresh (dropping any hand-written config block), instead of keeping the existing entry. With `add`, takes effect only together with `--force`; `reinstall` applies force automatically |
| `--host <HOST[:PORT]>` | Install through a RUNNING iii engine instead of editing the config file in the current directory: connects to HOST[:PORT] (ex. `localhost:49134`; port defaults to 49134; ws:// and wss:// URLs are also accepted and used as-is) and invokes its worker::add. The engine applies the add in ITS project directory, so this works from any folder and with engines on non-default ports. Local worker PATHs resolve on the engine host |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Normalize the duplicated engine-directory wording. Replace ITS project directory with its project directory or the engine's project directory in both host-option descriptions.

  • docs/next/cli-reference/index.mdx.skill.md#L165-L165: update the iii worker add description.
  • docs/next/cli-reference/index.mdx.skill.md#L267-L267: apply the same correction to iii worker reinstall.
🧰 Tools
🪛 LanguageTool

[grammar] ~165-~165: Use a hyphen to join words.
Context: ... worker::add. The engine applies the add in ITS project directory, so this works ...

(QB_NEW_EN_HYPHEN)

📍 Affects 1 file
  • docs/next/cli-reference/index.mdx.skill.md#L165-L165 (this comment)
  • docs/next/cli-reference/index.mdx.skill.md#L267-L267
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/next/cli-reference/index.mdx.skill.md` at line 165, Normalize the
duplicated engine-directory wording in the host-option descriptions: update the
iii worker add entry at docs/next/cli-reference/index.mdx.skill.md lines 165-165
and the iii worker reinstall entry at lines 267-267 by replacing “ITS project
directory” with “its project directory” or “the engine's project directory.”

Source: Linters/SAST tools

The skill-check workflow's vale layer rejects em dashes and 'just' as a
hedge; rewrite the sentences this PR added with commas, parentheses,
semicolons, and colons instead. Skill artifacts re-rendered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
}
};

let spinner = super::spinner::Spinner::start(format!("Installing {label} via {url}..."));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice touch including this spinner

if info.accepts_engine_flag {
info.extra_args.push("--engine".to_string());
info.extra_args
.push(format!("ws://127.0.0.1:{}", engine.worker_manager_port()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this hard code be a problem? If we have this config:

  config:
    host: 10.0.0.5
    port: 5000

It's going to convert into ws://127.0.0.1:5000 instead ws://10.0.0.5:5000

Comment thread engine/src/main.rs
///
/// Missing file: on an interactive terminal, ask before writing (running
/// `iii` in the wrong directory shouldn't silently litter a config.yaml
/// there); headless sessions (containers, CI, service managers) create it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For a headless session, I don't think is good to auto create the file, since those environments are more used for deployment, create new file will potencially fail silently.

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