[Bug Bash] Guest operations (read/write/shell/MCP) on a deleted or non-existent environment fail with Unimplemented instead of NotFound
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
Direzione di ricerca
Start in internal/apiservice/wakeretry.go, especially ensureAwake around lines 80–92, and trace how the wake probe handles gRPC status codes and deleting actor state. Reproduce with a deleted or non-existent environment using read, write, shell, or MCP tools/call; finish when these requests report NotFound and deleting actors fail without waiting for the full wake budget.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary & Root Cause
Running read, write, shell, or MCP tools/call against a deleted or non-existent environment fails with gRPC code Unimplemented (ate-env: env: rpc error: code = Unimplemented desc = actor ate-env/<id> not found) instead of NotFound (ate-env: env: not found: ...).
Root Cause
- In
internal/apiservice/wakeretry.go:80-89,ensureAwakeprobes the guest viaatenet-routerand assumes any error code other thancodes.Unavailablecame from a live guest:_, err := probe.GetProcess(ctx, &ateenvv1alpha.GetProcessRequest{ProcessId: "ate-env-wake-probe"}) if status.Code(err) != codes.Unavailable { // Anything else, NotFound for the probe id included, came from // the guest itself. return nil } state, serr := s.actorState(ctx, atespace, id) - When an actor does not exist (or has finished deleting),
atenet-routerresponds with a plain HTTP404 Not Found(actor <atespace>/<id> not found) without agrpc-statustrailer. - Per the gRPC over HTTP/2 specification,
grpc-gomaps an HTTP404response withoutgrpc-statustocodes.Unimplemented(12), notcodes.Unavailableorcodes.NotFound. - Because
status.Code(err) == codes.Unimplemented != codes.Unavailable,ensureAwakereturnsnilimmediately without callings.actorState(ctx, atespace, id)(whose doc comment at:122-124explicitly notes: "A deleted environment surfaces here as NotFound (through toGRPCError), which is the right answer to a caller still holding its handle"). - The caller's subsequent RPC (
ReadFile,WriteFile,StartProcess) then hits the same HTTP404fromatenet-routerand surfaces rawcodes.Unimplementedto the client.
Versions
agent-substrate/env:40a6c63(also present onmain@d579fd0)agent-substrate/substrate:ddb46651
Steps to Reproduce
Test Case 1: Read from a deleted environment (Bug Bash Flow — Step 9: Delete)
ate-env create $USER
echo "hello $(date)" | ate-env $USER write /data/note.txt
# Step 9 from the bug bash doc:
ate-env delete $USER
ate-env $USER read /data/note.txt
- Expected: Fails with
NotFound:ate-env: env: not found: environment "chenyiwang" not found - Actual: Fails with
codes.Unimplemented(exit code 1):ate-env: env: rpc error: code = Unimplemented desc = actor ate-env/chenyiwang not found
Test Case 2: Run read, write, or shell on a non-existent environment (Bad Inputs)
ate-env does-not-exist read /data/note.txt
echo "hi" | ate-env does-not-exist write /data/note.txt
ate-env does-not-exist shell 'echo hi'
- Expected: All three commands fail with
NotFound(ate-env: env: not found: ...). - Actual: All three commands fail with
codes.Unimplemented(exit code 1):ate-env: env: rpc error: code = Unimplemented desc = actor ate-env/does-not-exist not found
Test Case 3: Call MCP tools/call on a deleted or non-existent environment
curl -s http://localhost:7777/v1alpha/envs/does-not-exist/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"shell","arguments":{"command":"echo hi"}}}'
- Expected: Error message indicates the environment was not found (
not found). - Actual: Tool result reports
code = Unimplemented:{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"env: rpc error: code = Unimplemented desc = actor ate-env/does-not-exist not found"}],"isError":true}}
Suggested Fix
- In
ensureAwake(internal/apiservice/wakeretry.go:80-89), do not treatcodes.Unimplementedfrom the wake probe as a live guest response (sinceatenet-routerreturns HTTP 404 ->codes.Unimplementedwhen the target actor is unknown, andGetProcessis implemented byate-env-guest), or fall through tos.actorState(ctx, atespace, id)so a missing/deleted actor surfaces ascodes.NotFound. - In
ensureAwake(internal/apiservice/wakeretry.go:90-92), also fail fast whenstate == ateapipb.ActorState_ACTOR_STATE_DELETINGinstead of polling untilDefaultWakeBudget(2m) expires.
- Lingua principale
- Go
- Stelle
- 71
- Fork
- 17
- Merge medio
- 21h 36m
- PR unite (30g)
- 19
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di agent-substrate/env
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
agent-substrate/env#123 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
agent-substrate/env#119 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
agent-substrate/env#118 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
agent-substrate/env#117 ·
I maintainer di solito rispondono entro 1 giorno
-
bug substrate
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
agent-substrate/env#115 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di agent-substrate/env
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
riverqueue/river#1576 ·
I maintainer di solito rispondono entro 1 giorno
-
NFS StorageProvider renders a missing nfsSubDir as "<no value>"Forse già presa @ldming l’ha presa oggi. Apertakind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apecloud/kubeblocks#11067 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
emersion/go-msgauth#87 ·
-
CLI: `describe <ns>.<table>` reports "namespace does not exist" when only the table is missingForse già presa @Shruthirdy l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
apache/iceberg-go#2423 ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
mafzalkalwardev/mailforge#21 ·