Repository navigation
Bug sweep 5: plan run / plan x fixes - #380
Merged
Merged
Conversation
`plan run --attach` and `plan x logs -f` opened the live log stream once and discarded stream errors, so: - a stream requested before the execution was dispatched got a 404 and the run showed no logs at all; - after the server's 5 minute idle cut (a silent step), all later logs were lost (`x logs -f` ended with "log stream timed out"); - `--attach` cancelled the stream as soon as a terminal phase was seen, dropping trailing lines. Add planexec.FollowLiveLogs, which reconnects from the last cursor on 404-before-finish, 5xx and connection/SSE errors, and stops when the stream ends or the execution is finished. --attach now gives the stream up to 10s after the execution finishes to deliver the rest. Refs ENG-1248. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ort fails exportOutputs used the go-openapi default 30s request timeout, which bounds the whole streamed body, so large or slow outputs were truncated on disk, the remaining outputs skipped, and only a warning printed with exit 0. Downloads now have no request timeout (bounded by the command's context), are written atomically (no partial files), and a failed export makes `plan run` exit non-zero after reporting the result. Refs ENG-1248. Co-Authored-By: Claude Opus 5.5 <[email protected]>
compile and recompile used the go-openapi default 30s request timeout against a synchronous server-side LLM compile, so slower compiles failed with a deadline error and the server cancelled the compile (no plan created). Use a 5 minute timeout. Refs ENG-1248. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fers to collectAllOutputs keyed plan outputs by <step>/<plan output name>, but a plan output refers to <step>/<StepRef.OutputName>, which may differ. So a step output referenced under another name was listed twice by `plan x outputs` and `get-output --all`, and an unrelated step output sharing the plan output's name was hidden. Refs ENG-1248. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Numeric-looking --param values were sent as JSON numbers, so e.g. python_version=3.10 reached the plan as 3.1 (after the server's JSON round-trip). When the plan declares the param's JSON Schema type as "string", the value is now sent as given. Untyped params keep the existing JSON inference. Refs ENG-1248. Co-Authored-By: Claude Opus 5.5 <[email protected]>
davixcky
approved these changes
Sep 30, 2026
davixcky
left a comment
Contributor
There was a problem hiding this comment.
LGTM. I couldn't exercise plan run / plan x live because the staging plan-execution endpoints were hanging on both main and this branch. So this is based on review and the tests. Build, vet and -race all pass, and the dedup, string-param and export tests fail with their fixes reverted.
Non-blocking, but 1 and 2 are the same "logs lost" class this PR fixes, so they might be worth doing here:
FollowLiveLogsstops for good on a clean end-of-stream before the execution finishes (internal/command/planexec/livelogs.go:46). The server's stream handler returns without sending EOF when its context is cancelled on shutdown. So a control-plane rollout duringx logs -fexits 0 mid-run, and--attachdrops the rest. Maybe check the phase on a clean end, and reconnect if the execution isn't finished.- Non-
APIErrorerrors retry forever without checking the phase (livelogs.go:60). A 403 or 404 with an HTML body, from a proxy or a wrongapi_url, retries every 2s silently, even after the execution has finished. get-output --allcan overwrite files. Plan outputs that reference a step are written to<dir>/<step>/<name>, so a same-named step output overwrites them.- Quoted values for string-typed params now keep their quotes (
--param 'v="3.10"'is sent as"3.10", quotes included). Also,type: ["string","null"]isn't treated as a string. - The export error is printed twice, because cobra prints the returned error as well. Also,
writeFileAtomicuses a fixed 0644 that ignores the umask; #379 has the same.
Brings in origin/main via the updated base. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in the --attach and locald address fixes from #376's review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in origin/main via the updated base. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.


Fifth batch of CLI bug-sweep fixes (ENG-1248), for plans. Stacked on #376. It is independent of #377, #378 and #379, and merges cleanly with each. There is one commit per fix; review only the 5 commits here.
Commits
fix(plan): resume live plan logs:plan run --attachandplan x logs -fopened the live stream once and discarded its errors. That caused three problems:execution not yet dispatched to a runner) and the run showed no logs.planexecution/logproxy.go, e.g. a silent step), all later logs were lost.--attachcancelled the stream as soon as a terminal phase was seen, dropping trailing lines.The new
planexec.FollowLiveLogsreconnects from the last cursor on a 404 before the execution finishes, on 5xx, and on connection/SSE errors. It stops when the stream ends or the execution is finished (the runner no longer holds live logs).--attachnow gives the stream up to 10s after the execution finishes to deliver the rest.fix(plan): don't truncate --output-dir exports: the export used go-openapi's 30s default request timeout, which covers the whole streamed body. Large or slow outputs were truncated, the remaining outputs skipped, and the run still exited 0 with only a warning. Downloads now have no request timeout (the command's context bounds them) and are written atomically. A failed export makesplan runexit non-zero after the result is reported.fix(plan): allow compile/recompile to take longer than 30s: the server compiles synchronously with an LLM, bounded only by the request context. After 30s the CLI hit its deadline, the server cancelled the compile, and no plan was created. The timeout is now 5 minutes.fix(planexec): dedup step outputs: plan outputs were keyed by<step>/<plan output name>instead of<step>/<StepRef.OutputName>.plan x outputsandget-output --alllisted referenced step outputs twice when the names differed, and hid unrelated step outputs that happened to share the plan output's name.fix(plan): send --param values of string-typed params as strings:python_version=3.10was sent as a JSON number and reached the plan as3.1. If the plan declares the param's JSON Schematype: string, the value is now sent as given. Untyped params keep the existing JSON inference, so an untyped3.10is still sent as a number; plan authors can type the param to avoid that.Testing
FollowLiveLogsis tested against a fake server: 404 before dispatch, then a stream cut by an SSE error, then a resume, checking the output and the cursors sent. A separate test checks that it stops with the error once the execution is finished. There are also tests for export (partial failure, no leftover files), output dedup (fails without the fix) and string-schema params.go vet ./...andgo test ./...pass;-racepasses forplanandplanexec.Refs ENG-1248.
🤖 Generated with Claude Code