Skip to content

Close the Go fixture-scripting and chat-window e2e gaps - #92

Merged
devin-ai-integration[bot] merged 4 commits into
mainfrom
devin/1795461019-go-fixture-scripting
Nov 24, 2026
Merged

devin-ai-integration[bot] merged 4 commits into
mainfrom
devin/1795461019-go-fixture-scripting

Conversation

@Personed

@Personed Personed commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes the Go e2e gaps for the "fixture tool" and "chat window" groups in apps/web/test/go-gaps.ts. The specs were not blocked by missing fixture IPC; they hit three Go product gaps, fixed here to match the TypeScript service. Stacked on #88 (its commits show in this diff until it merges; I will rebase then).

Native send accepts attachments, skills and context (internal/agent/runtime.go, new materials.go)

  • Runtime.Submit no longer rejects them with 附件、技能和上下文暂不支持. It resolves skills and context like apps/api/src/materials.ts (prepareMaterials), stores materials on the native draft, and builds the engine input with materialText (same wording and JSON as packages/agent/src/materials.ts), uploaded file paths, and image attachments as engine.Prompt.Images.
  • Pi now runs in the Bot's work-computer workspace (RuntimeOptions.Workspace → SessionOptions.WorkDir). computers.ServiceConfig.FilesRoot makes the process computer use the same files root as agent uploads (persona-go.sqlite.files), so attach_file sees uploaded files.

Approval cards for non-automatic Pi requests (runtime.go, view.go)

  • Runtime.approve used to answer {"cancelled":true} to anything not automatic. It now calls approval.Service.Request and answers Pi through session.Answer. Runtime.View projects pending requests as assistant approval/takeover cards on the latest turn, and processing is false while an approval is pending, as in packages/agent/src/chat-view.ts.

200-message native pages (chatview.go, view.go)

  • Native View reads ReadEnginePage with the 200-message page packages/agent/src/runtime uses, instead of the fixed 50-entry ReadChat window.

Fixture (apps/api/test/fixtures/go-server.ts; web-server.ts untouched)

  • gate holds only the unscripted answer, as in web-server.ts.
  • A scripted bare tool name (attach_file) maps to Pi's declared mcp__persona__attach_file.
  • A faux error without a message returns 400, so Pi does not retry it.

Still excluded

  • file drafts, real tools, and published downloads survive Bot switches and restart: Pi runs one response's tool calls concurrently, so attach_file can read report.md before the edit beside it lands (# Draft instead of # Report). The TypeScript harness runs them in order.
  • typing follows the Bot and failures retain their error message: Pi's OpenAI-compatible provider always gives a failed reply an error message (400 {}), so the fixture cannot script web-server.ts's message-less failure (回复失败,原因待确认).

Testing

  • go build ./..., go vet ./..., go test ./..., gofmt -l ., golangci-lint run (0 issues), pnpm typecheck, pnpm lint (warnings only), pnpm contract:check.
  • PERSONA_WEB_SERVER=go pnpm test:e2e: 80 passed, 1 failed on a teardown ENOTEMPTY ... pi-agent race in working contacts retain green status...; that test passes 4/4 with --repeat-each=4 on this branch and on Shrink Go Playwright gaps: computer stubs, Pi model controls, fixture scripting #88.
  • Default TypeScript pnpm test:e2e: 98 passed.

Poke opened this PR for Stoltembergg
Implemented in session Close fixture-scripting web gaps vs Go serve
Review with Devin · Open in Devin Desktop


@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1795461019-go-fixture-scripting branch from 059b72b to b1a0994 Compare November 23, 2026 22:01

@devin-ai-integration devin-ai-integration 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.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 4 potential issues.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread internal/cli/serve.go
Comment on lines +200 to +205
Workspace: func(ctx context.Context, botID int64) (string, error) {
_, dir, err := catalog.Workspace(ctx, botID)
if err == nil {
err = os.MkdirAll(dir, 0o700)
}
return dir, err

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.

🔴 Chat de Bot isolado usa o computador errado

Ao enviar uma mensagem a um Bot vinculado ao Docker, o serviço tenta abrir o workspace do contêiner no servidor. O Pi não inicia no computador escolhido e não encontra ali os anexos enviados.

Learn more

Workspace retorna um cliente conectado ao computador do Bot e um caminho válido naquele computador. Para Docker, workDir retorna um caminho dentro do contêiner. A configuração descarta o cliente e cria o diretório no sistema de arquivos do servidor. O runtime então passa esse caminho ao processo local do Pi. Além disso, Upload grava o arquivo no workspace local, não no workspace do Docker.

Example: Crie um Bot com computador Docker dedicado e envie um arquivo. Se o servidor não puder criar /home/persona/bots/<id>, o turno falha antes do prompt. Mesmo que consiga criar o caminho, esse diretório no servidor não é o do contêiner.

Recommended fix: Use o computador vinculado tanto para iniciar e controlar o Pi quanto para gravar os arquivos no workspace. Até haver transporte nativo para o alvo, recuse o envio antes de admitir o turno em vez de usar um processo local.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread internal/agent/runtime.go
Comment on lines +165 to +172
files := make([]Attachment, 0, len(in.Attachments))
for _, id := range in.Attachments {
file, err := r.a.Files.Metadata(in.BotID, id)
if err != nil {
return 0, &WorkError{Code: "NOT_FOUND", Message: "Not Found"}
}
files = append(files, file)
}

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.

🟡 Envio aceito para modelos que não leem imagens

Ao anexar uma imagem com um modelo só de texto, o Go confirma o envio e limpa o rascunho. O contrato exige rejeitar o envio antes de registrá-lo, para que o usuário possa trocar de modelo.

Learn more

O envio no TypeScript retorna BAD_REQUEST quando o arquivo é uma imagem e o modelo selecionado não aceita imagens. No Go, send devolve sucesso depois da admissão do turno; o modelo só é usado no processamento assíncrono. Assim, a confirmação do envio não depende de o modelo aceitar o anexo.

Example: Selecione um modelo que declara apenas entrada de texto, anexe uma captura PNG e envie. O Go registra a mensagem como aceita; o TypeScript recusa e permite corrigir o rascunho.

Recommended fix: Antes de admitir uma nova submissão com imagens, consulte as capacidades do modelo efetivo. Retorne BAD_REQUEST quando o catálogo indicar que ele não aceita imagens. Preserve a resposta idempotente de submissões já admitidas.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +141 to +145
func (r *Runtime) prepareMaterials(ctx context.Context, in SendInput) (*Materials, error) {
chat, err := r.h.ReadEnginePage(ctx, in.BotID, "", pageEntries)
if err != nil {
return nil, err
}

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.

🟡 Mensagens antigas visíveis não podem ser citadas

O seletor oferece mensagens de páginas antigas já carregadas. Ao citar uma mensagem fora dos 500 registros mais recentes, o Go retorna NOT_FOUND e impede o envio.

Learn more

loadEarlier mantém no chat as mensagens das páginas anteriores. O seletor de mensagens oferece mensagens concluídas dessa lista, sem restringir a idade. O envio no TypeScript resolve as referências com o histórico completo. No Go, a busca usa apenas os 500 registros mais recentes, incluindo registros que não são mensagens.

Example: Em uma conversa longa, carregue uma página anterior, escolha no seletor uma mensagem anterior aos 500 registros mais recentes e envie. A mensagem está visível no chat, mas o servidor a trata como inexistente.

Recommended fix: Resolva os IDs selecionados no histórico do Bot, sem usar a janela de exibição como limite. Faça uma busca por ID ou percorra páginas até encontrar as referências, mantendo as verificações de autor, conclusão e tamanho.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread internal/agent/view.go Outdated
Comment on lines +124 to +130
func (r *Runtime) pendingApprovals(ctx context.Context, bot int64, chat *ChatView) error {
if r.approvals == nil {
return nil
}
pending, err := r.approvals.Pending(ctx, bot)
if err != nil || len(pending) == 0 {
return err

@devin-ai-integration devin-ai-integration Bot Nov 23, 2026 •

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.

🟡 Aprovações ficam sem resposta possível após reinício

Após reiniciar o serviço com uma aprovação pendente, o chat volta a exibir o cartão. Nenhum processo recebe a resposta, e o cartão continua pendente mesmo em turnos novos.

Learn more

Request grava a aprovação no banco e espera a resposta em memória. Recover retoma a fila de tarefas, mas não restaura essa espera. O chat projeta todas as solicitações do banco, enquanto Answer rejeita solicitações sem um processo aguardando. A aprovação órfã continua visível e impede que o chat sinalize processamento em turnos futuros.

Example: Deixe o Bot esperando confirmação para editar um arquivo e reinicie o serviço. Ao abrir o chat, o botão de aprovação aparece, mas clicar nele não resolve o cartão.

Recommended fix: Na recuperação, finalize como expiradas as solicitações de processos anteriores, de forma atômica: retire-as da lista de pendências e preserve o desfecho no histórico. Cubra a recuperação com um teste que reabre o banco sem o processo original.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Personed and others added 2 commits November 24, 2026 05:53
Native send accepts attachments, skills and context as apps/api prepares
them, Pi approval requests go through the shared approval flow and show as
chat approval cards, native chat pages hold 200 messages, and Pi runs in the
Bot's work computer workspace, where uploads land.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1795461019-go-fixture-scripting branch from b1a0994 to b5969e4 Compare November 24, 2026 05:59
devin-ai-integration[bot]

This comment was marked as resolved.

Personed and others added 2 commits November 24, 2026 06:55
ReadEnginePage already projects each pending request's card through projectChat, as chat-view.ts does. Appending pendingApprovals again produced two identical approval cards and broke the strict-mode region lookup in the web suite.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot merged commit a66ae9d into main Nov 24, 2026
42 of 43 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the devin/1795461019-go-fixture-scripting branch November 24, 2026 08:10
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.

1 participant