Repository navigation
Conversation
Persist TUI-compatible attachment counts for ACP and exec user events. Restore readable markers in live history, session replay and resumed prompts without storing or resending historical image data. Cover image-only and mixed prompts, restart recovery, malformed metadata and the aborted-turn boundary with regression tests. Fixes Twigpine#1135
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Thanks, this is the shape from the issue, and the tests hold up: taking out any one piece (the ACP event's attachments, the marker on load, the marker in live history, exec's attachments, the exec resume projection, the fractional-count check or the 64 bound) fails one of them.
One thing differs from the TUI, though. The TUI zeroes the image count when the model can't take images: model.go says "the sent user row must not claim the image was included", and the count it persists is that same value. Here ACP and exec take the count before the vision gate, so the ignored-by-model cases store images: 1 and resume as User: [1 image], for a turn where the model never got the image. In ACP the live turn at least carried the "ignoring 1 prompt image(s)" note, but that isn't persisted, so after a restart nothing says the image was dropped. The TUI reads the same field back through attachmentSummaryFromPayload, so it should mean the same thing whichever surface wrote it.
Could you take the count after the vision gate in both runTurn and runExec, and flip the two "ignored by model" cases to expect no marker? With exec's count moved below the gate, TestRunExecImageAttachmentHistory already fails on that case, so the test is in the right place.
The red Windows smoke job was TestACPSetModeUpdatesSession timing out at 5 s in set_config_option, which this PR doesn't touch. It passes 20 times in a row here and passed when I re-ran the job, so CI is green now. Otherwise internal/acp and internal/sessions pass under -race on Windows, internal/cli and internal/tui pass, and go vet is clean for linux, darwin and windows.
|
please rebase to main branch and fix conficts |
Summary
Image-only ACP and exec turns were saved as empty user messages, so loading or resuming a session erased any indication that the user had attached an image. This change records the existing TUI-compatible
attachments: {images, documents}counts and restores a short marker such as[1 image]beside the original text.session/loadtranscript replay.--imageinput and renders them in resumed context instead of exposing raw count values through the generic payload summary.For an image-only turn, resumed ACP context now contains
User: [1 image]instead ofUser:.Linked issue
Fixes #1135
Validation
Validated on Linux with the Go version declared in
go.mod:make fmt-checkmake build-all(go build ./...)go vet ./...go test ./...go test ./internal/acp ./internal/cli ./internal/sessions -race -count=1go run ./cmd/zero-release buildgo run ./cmd/zero-release smokemake vulncheck— no vulnerabilities foundgit diff HEAD --checkThe full test suite passed in an isolated network namespace with ordinary user permissions and temporary user directories. On the host, two existing OAuth tests cannot bind their fixed port 1455 because another service already holds it; the isolated run avoids that conflict without changing those tests or stopping the service.
make lint-staticreports four existing advisory findings in untouched files: QF1001 ininternal/installtest/workflow_permissions_test.go:20, and QF1008 ininternal/proxydial/proxydial.go:67,72andinternal/tools/web_fetch.go:315. No finding points to this change.Regression evidence
The regression tests were run before the fix. The ACP image-only case failed with:
The exec case also failed because its resumed prompt contained
message: userwith no image marker. Both paths pass with the fix. Coverage includes same-process follow-up, fresh-agent/store load and resume, text plus multiple images, non-vision model handling, combined stream/file input, absence of persisted or reattached image data, legacy events, malformed counts, and failed turns committing no history.Checklist
issue-approvedlabel.go build ./...,go vet ./..., andgo test ./...pass locally, with the test environment described above.gofmtclean.-racewhere relevant.Summary by CodeRabbit