Repository navigation
fix: sweep round 9: --strict never repeats a write, captureInputVariables by ID, typed text for create-text, use project, session Next lines - #63
Open
Bradenream wants to merge 26 commits into
Conversation
… update --file doesn't ask for Content What testers saw: human-kb:F1 (R8 #4, major): `document update --document-id 6b0f095239d66675defd5bf2 --file faq/refunds.md --wait` in the home prompt skipped the Yes/No and went straight into each field: "3 optional field(s)", then Folder Id, then "Content: The whole new text of a text or markdown document. It replaces the stored text…", then Metadata. "I pressed Enter three times without knowing whether that would wipe out the file." Cause: The form decides what was given from the command's generated metadata alone (interactive.isValueResolved: the meta flag's own Changed, an env var, config). --file is a hand-written flag (document/contentfile.go) whose text becomes --content only after the form, in contentFromFile. So changesNothingYet saw an update that changed nothing, and fillOptional walked every field, Content first. The same blind spot hit a union given through one of its forms: `tool update --tool-id t1 --body-param.function '{…}'` at a terminal asked for "Body Param" as if nothing gave it, and the field left empty failed with "the JSON ends too soon", nothing sent. Change: - flagutil/standin.go: GivenAnotherWay(cmd, name) is whether flags on the line give name's value: one that stands in for it, or one of its forms or fields (--body-param.function for --body-param). - interactive.isValueResolved counts that (a one-line hook), so the form neither asks for such a field nor takes the update for an empty one. - document update's --file stands in for --content (flagutil.StandIn), as --csv does for --items. vf already refused the two together; cmdcheck now knows it too. - prompt/complete.go: a flag something stands in for stays optional in the menu when it is optional (--content isn't marked required and doesn't lead), and goes once its stand-in is typed. suggested_test.go takes only stand-ins for required flags as the way to give them. Now the replay of the tester's line asks one question, "Fill in 2 optional field(s)?" (Metadata, Folder Id), and No sends the file's text. Tests: TestDocumentUpdateByFileDoesNotAskForContent, TestAnUpdateGivenThroughAFormDoesNotAskForTheUnion, TestAnOptionalFlagStoodInForStaysOptional.
… and says where vf looked What testers saw: human-kb:F4 and dead end task 1 (R8 #5, major): `document create-text -e main --file faq --wait`, faq a folder, came up with "Fill in 12 optional field(s)?" first, then "✗ failed to read file for --file: read faq: is a directory", without the one-file-each hint vf has for --file given twice. human-newcomer:F2: the form's File field took northwind-faq.txt, asked "Fill in 12 optional field(s)?", and only then said "✗ failed to read file for --file: open northwind-faq.txt: no such file or directory", with Next only `vf document create-text --help`. "They don't know which folder the prompt is in." Cause: Nothing looked at the path until the request was built: flagutil.buildFileField opens it in BuildRequest, after the form (interactive.PromptAndSetFlags) and its optional-fields question. The hand-written file flags were read late too: document update --file after the form (contentFromFile). The errors were os.ReadFile's, with the path as typed, and the form's File field took any text. Change: - flagutil/filepaths.go: a flag that takes a file's path is marked (ReadsFile for --file on update and --csv; ValidateMeta marks the generated create-text --file). CheckFile says what is wrong with a path: no such file, naming the full path vf looked at; a folder; or unreadable. ReadTextFile (@file, --csv, update --file, --body @file) uses it, so its errors name the full path too. - cli/filecheck.go, hooked in root.go after the placeholder check: every marked flag on the line is checked as the command starts, before any picker, form or request, exit 2. A relative path's error names the folder vf runs in. A folder given to a create says it takes one file, with the line for each of the first three files in it when the file names the document (repeatedflags.go's hint, now shared); one given to an update names a file in it. - interactive/filefield.go: the form's field for such a flag refuses a path that names no file as it's typed, with the same words, before the optional fields are offered. The required fields now go through askField like the optional ones (a one-line change in interactive.go), so a test replays them too; AnswerForm runs each field's check. Tests: TestAFolderGivenAsFileIsRefusedBeforeTheForm, TestAMissingFileIsRefusedBeforeTheFormSayingWhereVFLooked, TestTheFormRefusesAPathThatNamesNoFile, TestAFileFlagsPathIsCheckedBeforeAnythingIsSent.
… and its form asks for the text Why: a newcomer with the FAQ in their head, not in a file, couldn't get it into the knowledge base. The menu called create-text "Upload a file as a document", the form's one field asked for a File, and the name they typed there failed after the form (round-8 sweep, R8 #3, human-newcomer:F2). Design: the API takes a document as an uploaded file, so vf makes the file. --text takes the text (@file and - as every text flag), --file - reads the file from stdin, and either is uploaded as a .txt named by --name or by the text's first words. --text stands in for --file, so the line needs one of them ("needs --text (or --file)"), and the form, given neither, asks for the text in a box that takes several lines, with the name among the optional fields. The Text field refuses an @path that names no file, and a file's name typed as the text: one that is there says to write @ before it. --text with --file, empty --text, and an empty pipe exit 2 with nothing sent. Change: document/createtextinput.go adds --text, --name and --file -, hooked into createtext.go by three one-line hooks; createtexthelp.go says "Add text or a file to the knowledge base"; flagutil/filepaths.go lets a file flag take - for stdin; interactive/filefield.go checks text fields. "/know", "/upload", "/faq" and "/text" still lead to it. Tests: createtextinput_test.go, interactive/createtext_test.go.
… line, and a -p makes the project current when none is What testers saw: in a second home prompt, which starts with nothing current, `use project 6b0f08fba7f5577610a3449f` said "use takes workspace, project, environment, organization or clear", naming the word they had typed. Both fell back to -p on every command, and the window's project stayed empty for six commands (round-8 sweep, R8 #2, human-newcomer:F1, human-kb:F5; open since round 3). Cause: `use` took a level's word alone, to open its picker; any second word fell to the default case, which printed the list of words. And only a create or a picker made anything current: a -p typed on a line is kept for that line (session.Unheld), even when nothing is current. Change: use.go. `use project` takes the project's ID (looked up, with its workspace) or name (the current workspace, then each of yours; two alike list a line for each), `use environment` an alias or name, `use workspace` and `use organization` an ID or name, and `use -p 6b0f…` as on a command line; a level alone still opens the picker. A line use can't take says what is wrong and gives a line that runs: `use projects 6b0f…` offers `use project 6b0f…`, a bare ID asks for a word before it, `use clear now` says clear takes nothing. A line that succeeds with -p while no project is current makes that project current, with its workspace and -e (both testers expected it; one already current is never moved, a dry run or a delete never adopts). The lines that say so add "in this window". Tests: use_test.go.
…al field(s)?", and deprecated fields aren't offered What testers saw: `agent update --instructions "…"` in the home prompt, with a current project, asked "Fill in 15 optional field(s)?" under three header lines that stayed above "✓ Agent updated."; every create given its required flags asked the same, six times for each tester, and they answered No each time. Five of create-text's twelve optional fields were deprecated (round-8 sweep, R8 #39, human-newcomer:F5, human-kb:F4). Cause: the form opens whenever a required flag isn't on the line, and the home prompt's current project and environment are filled in by the pickers inside it. Once they were, the form went on to offer the optional fields, by design ("a command given something on its line asks first"), though nothing had been asked; and it offered every optional field, deprecated ones too. Change: when the pickers took every required value without asking and the line gives something to send, the form returns before its header and the offer (optionalfields.go givesAll, one hook in interactive.go). An update given nothing still starts on its fields, and a form that asked something still offers the rest after it. A field whose help says Deprecated isn't offered (one hook in fieldsToAsk). The header is no longer printed in the case reported; one over a form that asked stays. Tests: optionalfields_test.go TestGivenAllItNeedsAWriteRunsWithoutAsking, TestAFormThatAskedOffersTheRest.
…again
What testers saw:
agent-builder:F2: `vf playbook create --name warranty --instructions
'… Use `check_warranty` to verify.' --strict` ended "Then run this command
again: a {token} binds when the field is written, not later". Run again,
it made a second playbook: "`vf playbook list` then showed
6b0f0a2ba7f5577610a34af4 warranty and 6b0f0a2be41a42d04c14dc2c
warranty". fix-verifier:N1: after `playbook patch-instructions … --strict`
and the `vf variable create` the hint offered, the same patch again said
"Replaced 1 occurrence at line 1. rc=0", and read-instructions showed the
inserted sentence twice. Both exited 0 (R8 #7).
Cause:
3c8217d gave output/strict.go's unboundNext one last line for every
--strict command, written for `agent update`: run again, an update writes
the same text over itself. A create or an add run again makes a second
one, and a patch inserts its new text again. What binds a {token} is a
write of its field: the API keeps a name that matches nothing as literal
text ("then write the field again with the same {token}"), and each patch
or update of a prompt or instructions resolves the whole text again (the
spec: "The WHOLE document is re-resolved on every patch"). A compile
builds from what was stored. A patch can't rewrite the text unchanged:
the API refuses one whose old and new strings are the same.
Change:
- After a create, Next names what it made and writes the text there
with an update, as it was typed: `vf playbook update --playbook-id 6b0f…
--project-id p1 --environment-alias main --instructions @returns.md
--strict`, then "Don't run this command again: it would make a second
playbook". Text a hint can't hold on one line (a backtick, a line
break, stdin, --body) gets the ID and the words instead. flagutil's
text flags keep what was typed (@returns.md) for this.
- After a patch: "Don't run this patch again: its new text is saved
already", that the next patch or update binds it, and the read that
shows the text.
- After another add, not to run it again, and to write it with an update.
An update keeps "Then run this command again".
- A /name kept as plain text (mentions.go) said "then save the text
again"; after a create or a patch it now says not to run it again.
Tests: TestStrictNeverOffersTheWriteAgain replays the create (from a
file and typed) and the patch against a fake API, runs every command Next
offers as written, and fails when the playbook is created or patched a
second time; TestStrictSlashNameAfterAPatchSaysNotToRunItAgain.
What testers saw: agent-migrator:F4 created a function tool with
`"captureInputVariables":{"orderId":{"variableOrEntityID":"<order_id>"}}`
and agent-builder:F1 updated one with `{"order_number":{…}}`. Both saved
with exit 0, and the tool ran with orderId "1234", but the variable stayed
0. `tool create --help` showed only `captureInputVariables?: { <key>: … }`,
and vf checked inputVariables and captureResponse but not this map.
Cause: the key is the input's ID, not its name. When the agent compiles,
a function tool's entry is looked up by the function input's ID
(compileAgentToolFunctionCaptureInputVariables) and an API tool's by the
API tool input's ID; any other key is skipped without a word. Only MCP
and integration tools key it by name. The API's own description ("a map
of tool input names") says otherwise, and help gave no key at all.
Change:
- Help says what each form keys it by: `<input ID>` for the function and
API forms, `<input name>` for MCP and integration, with a paragraph
after captureResponse's. Create's and update's examples send an entry
keyed by the same `<input-id>` as inputVariables.
- A function or API tool's entry keyed by an input's name is refused
before anything is sent, on create and update (exit 2, invalid_body).
The request's own inputVariables give the ID; otherwise a function
tool's key that is neither is checked against the function's inputs
(an update first reads which function the tool runs). The refusal gives
the line that sends the entry under the input's ID, or, for a key that
names no input, lists the inputs and the line that lists them. A dry
run, or a read that fails, checks the request alone.
- Not done: naming an unset `{variable}` in --strict or `vf context`.
`vf context` isn't on this branch, and what sets a variable (launch
variables, workflow set steps, state updates, entities, system
variables) is beyond what vf reads, so the check would misfire.
Tests: TestAnInputCaptureKeyedByNameIsRefusedBeforeItIsSent replays both
testers' requests (create, update, agent mode, dry run, an API tool), and
runs each fix through cmdcheck and then against the fake API;
TestAnInputCaptureOfNoInputNamesTheInputs, TestAnInputCaptureKeyedByIDIsSent,
TestToolHelpSaysWhatKeysInputCaptures.
…, so an empty update is refused
What testers saw: fix-verifier:N10 ran `vf agent update -p … -e main
--llm '{"temperature":0.3}'`, at a terminal and with --dry-run:
⚠ --llm has keys vf agent update doesn't take, so they weren't sent: temperature
✓ Agent updated.
--dry-run body: { "llm": {} }
Exit 0, and nothing changed. The key the API takes is
llm.defaults.temperature.
Cause: the SDK decodes --llm into an llm object and drops temperature,
which that object has no field for (flagutil/unknownkeys.go names it). The
object is still set, empty, so the body is {"llm":{}}. ff70cc5's check for
an update that sets nothing (client/emptyupdate.go) looks for `{}` only,
so it let this through. The same key in --body ({"llm":{"temperature":…}})
did the same.
Change:
- An object given with keys, every one of which was dropped, is left out
of the request as if it hadn't been given (flagutil/droppedkeys.go): a
JSON flag's own value, and an object at any depth of --body, stdin or a
JSON flag. An object given as {} is still sent. So this update is now
`{}` and refused before it is sent, dry run included: exit 2,
nothing_to_update.
- A dropped key that names one field one or two levels down is a near
match. The warning says where it goes: "temperature is a key of
defaults" and "--llm '{"defaults":{"temperature":0.3}}' sends it there".
- The refusal (output/droppedupdate.go) says "--llm set no field: vf agent
update doesn't take temperature." and "--llm takes temperature as
defaults.temperature.", and gives the line that sends it there:
`vf agent update --llm '{"defaults":{"temperature":0.3}}' --project-id
p1 --environment-alias main`. With no near match it says what the flag
takes instead. --body with no near match keeps ff70cc5's message.
- A key dropped beside keys that are taken: the rest is sent without it.
Tests: TestAnUpdateWhoseKeysWereAllDroppedIsNotSent replays N10 (--llm and
--body, human and agent, real and --dry-run), and runs each line given
through cmdcheck and then against the fake API, which gets
{"llm":{"defaults":{"temperature":0.3}}}. TestADroppedKeyBesideOthersIsLeftOut,
TestADroppedKeyWithNoMatchSaysWhatTheFlagTakes. Each fails with the hooks
reverted.
…hanged and the read that shows them
What testers saw: human-newcomer:F4 ran `vf agent patch-instructions -p …
--old-string "…" --new-string "…"` at a 70-column terminal and got the
answer as a record:
diff: |
@@ -1,1 +1,1 @@
-Greet the customer as Northwind Coffee support and ask how you can
...
message: Replaced 1 occurrence at line 1.
replacements: 1
totalLines: 1
No ✓ line and no Next. `@@ -1,1 +1,1 @@` and totalLines meant nothing to
them, and the message was in the middle.
Cause: an update's answer is only a message, which done.go prints as a ✓
line, and updated.go adds Next for "update" and "publish". A patch's
answer has a message, a diff and counts, so neither applied, and it went
to the generic record printer. `agent patch-prompt`, `playbook
patch-instructions` and `function patch-code` answer the same way.
Change:
- At a terminal with pretty output, those four patches print (patched.go):
✓ Replaced 1 occurrence at line 1 in the agent's instructions.
- Greet the customer as Northwind Coffee support and ask how you can help.
+ Greet the customer as Northwind Coffee support, by name, and ask how you can help.
Next:
vf agent read-instructions --project-id p1 --environment-alias main see the instructions now
The diff loses its hunk headers; several hunks each start "at line N:".
Next is the field's read, with -p, -e and --playbook-id as given, or
`vf function get --function-id …` for code, which has no read.
- JSON, YAML, TOON, --jq, agent mode and a pipe get the API's answer as
before. An answer naming a reference or mention that didn't bind prints
as before too, as an update's does.
Tests: TestAPatchAtATerminalSaysWhatChangedAndHowToReadIt replays F4 and
the other three patches, and runs each Next line through cmdcheck; it
fails with the hooks reverted. TestAPatchsAnswerIsUnchangedOffATerminalsPrettyOutput
covers -o json, -o yaml, --jq, agent mode and an unbound reference.
…nd end it What testers saw: fix-verifier N3 (R8 #13), a new user's first send in the home prompt: "Started session s-7gusfw6l (the current one)", the greeting and the reply, then "(no Next:)". "A person who started via send doesn't learn vf session end exists, or that the next send continues the same session." One-shot sends at a terminal printed none either. Cause: only start printed the two Next lines (sessionstart.go, when it doesn't go on to a chat). runSessionSend's person branch printed the turn and returned. Change: after a turn a person sent, Next gives `vf session send … "<message>"` and `vf session end …`, with -s when the session isn't the current one, and `vf session start …` when the turn ended the conversation. The send line is refused as written (placeholder.go), and the end line runs as written; the test runs both. JSON and agent output are unchanged: the answer's session field already says which session it was, and a step on every turn would cost an agent tokens on every turn.
… evaluation that exists What testers saw: human-newcomer F10 and fix-verifier N5 (R8 #51). /end printed "Next: vf evaluation run -e <evaluation-id> -t 6b0f0a4b… Run an evaluation on it". The newcomer had no evaluation and "didn't know what one is"; reading the transcript, the natural next step, wasn't offered. In a project with one evaluation and in one with none, the line run as written gave exit 4, "No evaluation exists with ID <evaluation-id>." Cause: sayEnded (sessionend.go) printed one fixed tip with an <evaluation-id> placeholder, which 841271c leaves for the API to refuse; vf never looked at which evaluations the project has. Change: Next leads with `vf transcript get -t <tid> -p …`. Then, for a person only, vf lists the project's evaluations (one GET) in the background as the end goes out, so the end takes no longer: with one, Next is `vf evaluation run -e <its id> -t <tid> -p …`, naming it; with several, `vf evaluation list -p …`; with none, `vf evaluation create --help`; if the list fails or takes over 1.5 s, `vf evaluation list -p …`. The same goes for /end in the chat and `run-script --end`. JSON, agent mode and dry runs print no Next and send no list. confirm.go reads its asked flag only for a change, so a read beside another request doesn't race it.
…ies can still steer What testers saw: human-newcomer F3 (R8 #12, dead end in task 5). After `agent patch-instructions` in a second window, the open chat's next reply still ended "Anything else I can help with?", and "nothing on screen told me". "I can't tell whether the old turns in the conversation steered the model or the old configuration was used." /new picked up the edit. Cause: the configuration wasn't old. Rule B reads the edit mark at every turn (compilesFirst → sessions.Edited reads sessions.json), so the next chat turn compiled first; the new test makes the edit from another process, through the API, and sees `compile` before that turn. What steered the reply was the conversation's own earlier replies, and the chat said nothing about either. Change: a turn that compiles an edit first, in a session already going, prints one muted line before its reply: "This turn runs your edit. Earlier replies in this session can still steer the agent: /new starts fresh." (a one-shot send names 'vf session start …' instead). Rule B compiles once per edit, so the line comes once. A turn that answers needsRecompile (an edit vf didn't make) ran the old build, so its existing warning after the reply says the same about earlier replies. Agent and JSON output are unchanged.
…t vf What testers saw: fix-verifier N2 (R8 #50). In `vf session send`'s chat at a terminal, Ctrl-C about 0.7 s into "What is your return window?": "✻ Waiting for the agent… 0s · ctrl-c stops waiting, not the turn^C" and "[vf exited with code -2] (killed by SIGINT; nothing more printed)", though `session get` showed the message and the agent's reply. The person left without knowing the session was still open, or how to return. Cause: while a turn is out the terminal is the shell's again, so Ctrl-C is a SIGINT, and nothing in a shell catches it: Go's default ends the process. sessionchat.go only handled a canceled cmd.Context(), which the home prompt's own catch (home.go) provides and a shell doesn't. Change: the chat catches SIGINT while a line runs (signal.NotifyContext around the turn, /end and /new), so a Ctrl-C cancels the turn's request: canceled.go then says "Canceled. Nothing was sent." (during the compile) or "Stopped waiting for the agent, but the message may have reached it" with the `vf session get …` that shows it, and the You line comes back armed (prompt.Options.Armed), so one more Ctrl-C, or Ctrl-D, leaves with the "is still going" line. In the home prompt the line ends as before. The test runs the chat in a child process that gets a real SIGINT during a compile and during a turn; without the change the child dies of it.
What testers saw: fix-verifier N7 and human-poweruser F7 (R8 #53). At 100 columns Ctrl-D's "Session … is still going: 'vf session send -p … -e main' at a terminal goes back to it." broke mid-word, "termin" / "al"; at 72 the footer under the chat's box was cut, "ctrl-d leaves it goi". Cause: the leave line and the chat's notes were printed as one muted string, whatever the width, so the terminal broke them where the column ran out; the footer was one fixed 72-column string, and the prompt's renderer truncates a line wider than the terminal. Change: the leave line, note() (the ran-edit and "Pressed" lines), the "N other traces" line and a send's You echo go through ui.Fit, so they break between words with a quoted command kept whole on its line; the footer is the longest of three that fits the width ("/end ends it · /new starts over · ctrl-d leaves it going" at 60 to 73 columns). The test runs a send and a chat under script(1) at 60, 72, 80 and 100 columns, with a 24-character project ID, and checks every line but a command fits.
…d "chat" finds widget What testers saw: fix-verifier N4 (R8 #49). In the home prompt, typing `chat` (also `talk`, `conversation`) listed "❯ session end End the session, and find its transcript" selected, then run-script, send, start: Enter ended a session instead of starting one. `chat` no longer listed `widget` ("Configure the web chat widget…"), which round 7 found for it. Cause: intents.go collected an intent's commands into a set, and matching sorted them by name, so "session end" came first. The summary search, which found `widget` by "chat" in its summary, runs only when nothing else matched, and the session intent now always matched. Change: an intent's commands come in the order it lists them (sessions: start, send, end, run-script; the document list is in name order, so its menus are as before), and "chat" lists `widget` after the session commands. The test types each word into the real command tree's menu and checks the rows in order.
…and the web chat takes a publish What testers saw: fix-verifier N6 (R8 #52). `vf link` said "Run 'vf environment compile' only for other clients (the web chat, the raw API) after edits made outside vf", while `vf widget get-snippet` said "⚠ The widget serves the published version… Nothing has been published since", and its snippet has versionVariant 'published'. An agent may compile to "update the web chat" and see no change; and vf's own edits reach a raw-API draft client only once something compiles. Cause: round 8's wording of the rule (the r7-1 patch for link.go and outline.go) lumped the widget in with draft clients. The widget snippet pins the published version unless made with --version-param draft (widget/getsnippet.go); only clients that run the draft, such as the Dialog Manager API with the draft's version ID, run it as last compiled. Neither send's help nor the README said what such clients need. Change: send's help (autocompile.go) and the README's compile bullet say that clients outside vf that run the draft need 'vf environment compile' after an edit unless a vf session has started or taken a turn since, and that the web chat widget serves the published version by default, so an edit reaches it with 'vf environment publish'. docs/vf_session_send.md is regenerated. The same correction for link.go and outline.go, which are on other branches, is in the round's r7-1.patch. The test reads send's help and the README for the rule.
…s clean as start's does What testers saw: fix-verifier N9 (R8 #89). `vf session run-script … --messages '[…]'` in agent mode answered `userID: script-6437ba49-…`, where start, send, get and end all say `session:`; an agent that parses .session got nothing. Its help: "-s … another name for --user-id" and "-u … A reused ID keeps the variables an earlier conversation with it left", but `session start -s`: "One used before starts over: vf ends its conversation and clears its state first." Cause: session run-script is conversation's run-script with -s and --end added (sessionscript.go). It printed the API's answer as it came, with userID and no session, and passed a reused ID straight to the API, which keeps the ID's variables and, with no end action before, its transcript (round-8 probe, facts 3 and 6); -u's help is conversation's, which says so. Change: in the session group, an ID given with -s or -u is cleared before the script as start clears one (state get; an end if a conversation is going; state delete): up to three requests, only when an ID is given. The answer for scripts and agents carries session beside userID, which stays for scripts that read it. -s, -u and the long help say a reused ID starts over; `conversation run-script` is unchanged. The generated runscript.go's hook line now calls startScript, which compiles and then clears. docs/vf_session_run-script.md is regenerated.
…ons.json What testers saw: fix-verifier N11 (R8 #91). After `project delete` for three projects, ~/.config/vf/sessions.json still held 6 scopes, `<id>/main` and `<id>/*` for each deleted project. Cause: nothing in internal/sessions ever dropped a scope, and editmark.go counted the project delete itself as an edit (a DELETE that names no environment), so the delete wrote a new `<id>/*` scope for a project that no longer existed. Change: sessions.ForgetProject drops a project's scopes in every environment, writing nothing when it has none. editmark.go calls it on a successful `StableProjectController_delete` (not a dry run), in place of the edit mark. A new SDK after-error hook, projectgone.go, calls it when a 404's message is the API's "No project exists with ID <id>." or "Project does not exist." for a request naming that project: a project deleted in Creator is forgotten when a session command, `project get` or any other is told so. It reads the body the error was going to read anyway, puts it back, and sends nothing. The tests replay the delete through vf, and 404s for a session send and a project get, against fake servers.
…mand named with the word What testers saw: nothing yet; found building round 9's integration build, where TestTheMenuSaysCreateTextAddsText failed: "/text" doesn't offer document create-text. human-newcomer wanted to add typed text to the knowledge base (R8 #3), and human-kb "one short plain-text note"; with PR #36's `vf context` in the tree, "/text" offered context alone. Cause: "/text" reached create-text only through byDescription, a word in its summary ("Add text or a file…"), which runs only when no command's name has the word. `context` contains "text", so the name match won and the summaries were never read. No intent named the word. Change: "text" and "note" are intents for document create-text, so the menu offers it after the name matches, whatever else is in the tree. TestTextFindsCreateTextBesideANameWithTheWord adds a `context` command to the test tree and fails without the intents.
…s skips it What testers saw: round-9 fix-verifier:N1. In create-text's form, they typed the text, said Yes to the optional fields and pressed Enter on Max Chunk Size, whose line says "enter skips". vf failed with "invalid value for --max-chunk-size: the JSON ends too soon" and the typed text was lost. Cause: applyBindings leaves out an empty answer only when the binding is optional, and the binding took m.Optional: whether the API's field is a pointer. A union's is false (its optionality is in m.Union.Optional), so the empty answer was set on --max-chunk-size and parsed as JSON. The field's line says "enter skips" for any field that isn't required. Change: an empty answer to any field that isn't required is left out, as its line says. Required fields can't be left empty. TestEnterOnAnOptionalFieldOfSeveralTypesSkipsIt replays the scenario and fails without the change.
…he word inside its name What testers saw: round-9 fix-verifier:N7. "/text" listed `vf context` first and `document create-text` second, so Enter on "/text" picked context, which only has "text" inside its name (con-text). Cause: the menu listed commands whose name starts with the word, then those whose name contains it anywhere, then the commands an intent names for the word. A name containing the word mid-word beat the command the word was registered for. Change: intents come right after the names that start with the word, and the mid-word matches after them. TestTextFindsCreateTextBesideANameWithTheWord now checks create-text is first and fails without the change.
…session store What testers saw: round-9 fix-verifier:N3. ~/.config/vf/sessions.json on the machine running the sweep held p1/main, a scope for the fake project the tests use, and its compile time moved during the run though no tester command named p1. Cause: sessions.Path() is under $HOME, and the tests in internal/cli/conversation that start sessions and compile against the fake project p1 ran with the real HOME. Running each package's tests with an empty HOME of its own showed this package is the only one that writes the file. Change: a TestMain runs the package's tests with HOME in a temporary folder, and stops the run if the session store is still under the real home. With it, the package's tests leave the outer HOME empty.
What testers saw: round-9 fix-verifier:N9. `vf knowledge-base --help` said to add documents with `create-text --file faq.md`, a file only, while create-text's own summary now says "Add text or a file". Cause: round 9 gave create-text --text, and this help wasn't updated. Change: the help's first way to add a document is `vf document create-text --text "Closed on December 25." -p <id> -e <alias>`, "text you type", before the file. TestKnowledgeBaseHelpSaysHowToAddDocuments wants the --text line, and checks it runs as written with the others.
What testers saw: round-9 fix-verifier:N2. Typing a file's name that
isn't there into create-text's Text field showed "* there is no file
/private/tmp/…/vf-cli", cut at the terminal's width: neither the folder vf
looked in nor the advice ("type the text itself, or @…") was on screen.
Cause: the form shows a field's error on one line and cuts it at the
terminal's width, and the message put the full path before the advice.
Change: "type the text itself, or @ and a file's path: there is no file
<path>", with a path under home shown as ~/…. The filecheck test wants the
advice first and fails without the change.
… workspace What testers saw: round-9 fix-verifier noted that `use project <id>`, and a -p that makes a project current, list every workspace of the account to print the project's workspace name. Cause: workspaceName listed the account's workspaces and picked the one with the project's workspace ID: a read of workspaces the line never named, and a bigger request than it needs. Change: workspaceName reads that one workspace by its ID. The fake API in use_test.go counts workspace lists; TestUseProjectTakesAnIDOrAName fails if `use project <id>` lists them, and fails without the change. A name that isn't in the current workspace still searches the account's workspaces, as before.
There was a problem hiding this comment.
🟡 Changes recommended
Session shutdown contains a critical command-context race, alongside unresolved regressions in response headers, evaluation lookups, interactive input, and file-path resolution.
6 open issues
Capture the command context before starting the lookup · New Keep the signal context alive until evaluation lookup completes · New Preserve response headers when augmenting script output · New Preserve path semantics across symlinks · New Treat escaped @ literals as text before filename detection · New Keep the edit form when only resource selectors are supplied · New
2 files not reviewed
internal/cli/conversation/runscript.go: Generated fileinternal/cli/document/createtext.go: Generated file
What changed in this PR
This PR improves the Voiceflow CLI’s write safeguards, document input, home prompt, and session workflows, building on the earlier usability fixes.
Changes:
- Makes write recovery safer and improves validation for tool captures, empty updates, and file inputs.
- Adds typed-text document uploads and streamlines interactive forms and project selection.
- Improves session guidance, cancellation, script reuse, terminal formatting, and deleted-project cleanup, with regression tests and updated documentation.
| File | Description |
|---|---|
| README.md | Clarifies compile versus publish behavior. |
| internal/ui/DESIGN.md | Clarifies window-local project selection. |
| internal/sessions/sessions.go | Adds project-wide session cleanup. |
| internal/sessions/sessions_test.go | Tests project cleanup isolation. |
| internal/sdk/sdkinternal/hooks/registration.go | Registers deleted-project detection. |
| internal/sdk/sdkinternal/hooks/projectgone.go | Forgets projects confirmed missing. |
| internal/sdk/sdkinternal/hooks/editmark.go | Cleans up successfully deleted projects. |
| internal/prompt/prompt.go | Supports an armed Ctrl-C state. |
| internal/prompt/prompt_test.go | Tests armed prompt exit behavior. |
| internal/prompt/intents.go | Orders task-based command suggestions. |
| internal/prompt/intents_test.go | Tests text-document discovery. |
| internal/prompt/complete.go | Prioritizes intents and handles alternative flags. |
| internal/prompt/complete_test.go | Tests optional alternative-flag completion. |
| internal/output/strictagain.go | Provides nonduplicating write-recovery guidance. |
| internal/output/strict.go | Integrates safer strict-mode guidance. |
| internal/output/patched.go | Formats patch results and next steps. |
| internal/output/patched_test.go | Tests terminal and structured patch output. |
| internal/output/output.go | Integrates patch-result formatting. |
| internal/output/emptyupdate.go | Explains updates emptied by dropped keys. |
| internal/output/droppedupdate.go | Suggests corrected JSON update commands. |
| internal/output/created.go | Adds patch next steps and window-local wording. |
| internal/interactive/optionalfields.go | Skips unnecessary optional-field prompts. |
| internal/interactive/optionalfields_test.go | Tests streamlined forms and deprecated fields. |
| internal/interactive/interactive.go | Handles alternative inputs and optional-field skipping. |
| internal/interactive/fileupdate_test.go | Tests file-backed and union-backed updates. |
| internal/interactive/filefield.go | Validates file references within forms. |
| internal/interactive/filecheck_test.go | Tests early file validation in forms. |
| internal/interactive/export_test.go | Adds validation to the form test helper. |
| internal/interactive/createtext_test.go | Tests typed-text forms and optional unions. |
| internal/flagutil/unknownkeys.go | Adds dropped-key recovery hints. |
| internal/flagutil/textfile.go | Tracks original inputs and improves file errors. |
| internal/flagutil/standin.go | Recognizes fields supplied through alternative flags. |
| internal/flagutil/metadata.go | Handles JSON flags emptied by dropped keys. |
| internal/flagutil/forms.go | Marks generated file flags for validation. |
| internal/flagutil/filepaths.go | Adds shared file-path validation and stdin support. |
| internal/client/confirm.go | Avoids confirmation-state reads for read requests. |
| internal/cli/use_test.go | Tests project selection and adoption. |
| internal/cli/toolinputcapture_test.go | Tests ID-keyed input-capture validation. |
| internal/cli/tool/wiring.go | Updates capture examples and help. |
| internal/cli/tool/update.go | Integrates update capture validation. |
| internal/cli/tool/create.go | Integrates create capture validation. |
| internal/cli/tablecsv_test.go | Adjusts missing-file error expectations. |
| internal/cli/suggested_test.go | Handles optional alternative flags in command checks. |
| internal/cli/strictagain_test.go | Tests recovery without duplicate writes. |
| internal/cli/sessionwidth_test.go | Tests chat output at multiple terminal widths. |
| internal/cli/sessionscript_test.go | Tests session output and clean script reuse. |
| internal/cli/sessionhide_test.go | Tests session-first menu suggestions. |
| internal/cli/session_test.go | Extends session mocks and next-step checks. |
| internal/cli/root.go | Registers early file validation. |
| internal/cli/repeatedflags.go | Reuses one-file-per-command guidance. |
| internal/cli/mentions.go | Avoids recommending repeated creates or patches. |
| internal/cli/knowledgebase/documents.go | Leads help with typed-text uploads. |
| internal/cli/kbdocuments_test.go | Tests expanded document help. |
| internal/cli/home.go | Integrates explicit project selection and adoption. |
| internal/cli/forgetproject_test.go | Tests deleted-project session cleanup. |
| internal/cli/filecheck.go | Validates file flags before forms and requests. |
| internal/cli/filecheck_test.go | Tests noninteractive file validation. |
| internal/cli/droppedupdate_test.go | Tests empty-update refusal and corrected commands. |
| internal/cli/document/tablecsv.go | Enables early CSV path validation. |
| internal/cli/document/createtextinput.go | Adds typed text, stdin, and document naming. |
| internal/cli/document/createtexthelp.go | Describes expanded document input options. |
| internal/cli/document/createtext.go | Integrates text inputs and revised forms. |
| internal/cli/document/contentfile.go | Marks file input as an alternative to content. |
| internal/cli/createtextinput_test.go | Tests typed and piped document uploads. |
| internal/cli/createtexthelp_test.go | Tests revised document help. |
| internal/cli/conversation/sessionstart.go | Identifies the command restarting a session. |
| internal/cli/conversation/sessionsend.go | Adds continuation guidance and edit notices. |
| internal/cli/conversation/sessionscript.go | Resets reused sessions and adds session output. |
| internal/cli/conversation/sessionend.go | Adds transcript and evaluation next steps. |
| internal/cli/conversation/sessionchat.go | Handles turn cancellation and adaptive footers. |
| internal/cli/conversation/session.go | Tracks applied edits and wraps notices. |
| internal/cli/conversation/runscript.go | Integrates session-aware script preparation. |
| internal/cli/conversation/reply.go | Wraps hidden-trace notices. |
| internal/cli/conversation/main_test.go | Isolates tests from the real session store. |
| internal/cli/conversation/canceled.go | Documents chat-specific cancellation handling. |
| internal/cli/conversation/autocompile.go | Clarifies compile rules and history effects. |
| internal/cli/compilerule_test.go | Tests compile guidance consistency. |
| docs/vf_session_send.md | Documents external-client compile requirements. |
| docs/vf_session_run-script.md | Documents clean reuse of session IDs. |
Review effort: Balanced
Comment on lines
+198
to
+200
| go func() { | ||
| ctx, cancel := context.WithTimeout(client.WithoutSpinner(cmd.Context()), evaluationsWait) | ||
| defer cancel() |
| stop := catchCtrlC(cmd) | ||
| evals := lookUpEvaluations(cmd, s, opts, scope.ProjectID) // sessionend.go: for the Next line | ||
| _, transcript, err := endSession(cmd, s, opts, scope, rec, "Ended with /end in vf session", "") | ||
| stop() |
Comment on lines
+134
to
+136
| if !output.ForAPerson(cmd) { | ||
| answer["session"] = id // as start, send, get and end name it; userID stays, for scripts that read it | ||
| return output.Result(cmd, answer) |
Comment on lines
+179
to
+191
| if rest, ok := strings.CutPrefix(path, "~/"); ok { | ||
| if home, err := os.UserHomeDir(); err == nil { | ||
| return filepath.Join(home, rest), "" | ||
| } | ||
| } | ||
| if filepath.IsAbs(path) { | ||
| return filepath.Clean(path), "" | ||
| } | ||
| wd, err := os.Getwd() | ||
| if err != nil { | ||
| return path, "" | ||
| } | ||
| return filepath.Join(wd, path), wd |
Comment on lines
+79
to
+80
| case at && !strings.HasPrefix(path, "@"): // @@ is a literal @ | ||
| return flagutil.CheckFile(strings.TrimSpace(path), "@ in --"+m.FlagName) |
| if err != nil { | ||
| return err | ||
| } | ||
| if !announced && len(required) == 0 && givesAll(cmd, meta) { // optionalfields.go: given all it needs, with nothing asked, it runs |
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.


Stacked on #62. Fixes the CLI-owned majors from round 8 of the usability sweep, and the gaps testers found in
vf session. Each fix is its own commit with a test that replays the tester's scenario and fails without the fix. Each message says what testers saw, the cause and the change. Numbers below are round-8 issue numbers.Writes and --strict
--strict's "Then run this command again" repeated the write: a second playbook with the same name, or a patch saved twice, both exit 0. A{token}binds when its field is written again, so after a create vf now offers anupdateof the item it made, by ID (only when the text came from a file, so the line runs as written), and says not to run the create again. After a patch it says the text is saved, with the read that shows it.captureInputVariablesis keyed by the input's ID: the compiler skips any other key without a word, so both testers' maps (keyed by name) never set their variable. vf refuses a name key before sending (exit 2), with the line that resends it keyed by ID; help says what the keys are for each kind of tool. The warning for a{variable}that nothing sets is left out: launch variables, workflow steps and system variables can set one, and vf doesn't read them, so it would warn about variables that are set.--llm '{"temperature":0.3}'sent{"llm":{}}and said "✓ Agent updated.") isn't sent:nothing_to_update, naming the field the key belongs in, with a line that works.Forms, the home prompt and documents
document update --fileno longer asks for Folder Id, Content and Metadata: a flag that gives a field another way counts as given.document create-text --text '…', or--file -from stdin, adds typed text: the API takes only a file, so vf sends the text as one. With neither, the form asks for the text.use project <id|name>anduse environment <alias>work in the home prompt, and a wronguseline says what's wrong with a line that works. With no current project, a command run with-pmakes that project current in that window.Sessions
session end's Next reads the transcript, then scores it with the evaluation that exists (or lists them, or says how to make one). One list request, sent alongside the end, for a person only./new(orvf session start) starts fresh. Round 8's rule already compiled before that turn; the old reply came from the conversation's history.chat,talkandconversationin the menu lead withsession start, andchatfindswidgetagain.vf environment compileunless a vf session started or took a turn since; the web chat serves the published version and takes a publish.session run-scriptanswers withsession, and a reused-sstarts clean, assession start -sdoes.~/.config/vf/sessions.json.After round 9's fix-verifier
The fix-verifier replayed each tester's scenario on this branch's build and found these. They're fixed here but haven't been replayed live yet.
/textleads withdocument create-text, notcontext, which only has the word inside its name. "/text" and "/note" find create-text even when a command's name contains the word.knowledge-base --helpleads withcreate-text --text.use project <id>reads the project's own workspace. Before, it listed every workspace on the account to print one name.internal/cli/conversation's tests run with HOME in a temporary folder. They wrote ap1/mainscope into the real~/.config/vf/sessions.json.Not in this PR
evaluation run -eis the evaluation ID;-thas eight meanings) are a breaking change for scripts, so they get their own PR.vf link(feat: pin a project and environment to a directory with vf link (COR-14197) #35) andvf context(feat: summarize a project for coding agents in one call with vf context (COR-14197) #36) need the corrected compile-rule text on their own branches.For the API team
captureInputVariables' keys "tool input names"; for function and API tools they're input IDs.Testing
scripts/vet.sh,go test ./...(includingTestEverySuggestedCommandRuns), the TS suite (181) and go.mod unchanged, on all 25 commits. Lint: 0 errors.project member/workspace member/workspace invitecommands.end's transcript scores withevaluation run --session.session sendhas a median of 1.38 s (round 8: 1.49 s).