fix: move the intake dialogue into the main thread (0.3.4) - #4
Merged
Conversation
/first-run and /add-server could not onboard a server at all. The fleet-intake agent declared AskUserQuestion in its frontmatter, but subagents are not granted that tool -- the interaction channel belongs to the main thread -- so the agent aborted at its first question. /first-run did not list AskUserQuestion in allowed-tools either, so neither side could ask. The dialogue now runs in the command, where the user actually is. fleet-intake is dispatched non-interactively with every value in hand, re-validates them, and hands control back via NEEDS_KEY_DEPLOY / NEEDS_INPUT / FAILED rather than waiting for a confirmation it can never receive. The ssh-copy-id line is still presented as copy-paste and never executed. set_active becomes an input so /add-server stops silently stealing the active pointer; /first-run passes yes. frontmatter-check now rejects AskUserQuestion in any agent frontmatter. Verified it fails when the declaration is reintroduced, so the dead end cannot come back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #3, which GitHub auto-closed when its base branch was deleted on merging #2. Same branch, rebased onto
main; content is unchanged.The bug
/first-runcannot onboard a server. Dispatching the agent produces:plugin/agents/fleet-intake.mddeclared:Subagents are not granted
AskUserQuestion— the interaction channel belongs to the main thread. The declaration is accepted and then silently dropped, so the agent reaches step 2 ("Gather connection details, one at a time, via AskUserQuestion") and dies. Every path into onboarding is affected:/add-serverdispatches the same agent./first-rundid not listAskUserQuestionin its ownallowed-toolseither, so even the main thread could not have asked.The fix
The dialogue moves to where the user actually is.
/first-rungathers name, host, port, user, description and scopes viaAskUserQuestion, validates each answer, then dispatchesfleet-intakewith everything in hand./add-serverreuses that dialogue — its re-add branch already asked in the main thread, so this makes the command internally consistent.fleet-intakebecomes non-interactive and says so in its own instructions. It re-validates every input rather than trusting the caller, and hands control back instead of waiting:NEEDS_KEY_DEPLOY: <name>+ the exact! ssh-copy-id …line — the profile is already on disk, the caller presents the line and re-dispatches after the user confirmsNEEDS_INPUT: <reason>— missing or invalid inputFAILED: <cause>— SSH broken after key deploymentssh-copy-idis still never executed by the agent: it needs a TTY, hangs without one, and the user should see what they are authorizing.set_activebecomes an input. Previously the agent set the active pointer unconditionally, which is right for/first-runand wrong for/add-server— adding a second server silently redirected every subsequent unqualified command to it.Regression guard
tests/static/frontmatter-check.shnow rejectsAskUserQuestionin any agent frontmatter. Verified in both directions: it passes on this branch, and fails withFORBIDDEN AskUserQuestion in agent frontmatterwhen the declaration is reintroduced.Verification
All five static checks green locally —
shellcheckandmarkdownlintincluded, after installing both toolchains. markdownlint caught an MD040 in the new agent file, fixed here. Unit tests: 51/51, 14/14, 11/11, 3/3, plustest-compose-lib's usual 2 localdocker/jqfailures that pass in CI. CI was green on #3 before the rebase.Not verified: the end-to-end onboarding flow. It needs a real server.