Skip to content

[Bug]: contract violation error #919

Closed

Description

@fengttt

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Version and environment (optional)

astra edge mac osx

Actual behavior

█ The screen died but the server process survived it (it re-parented). Killing it directly now.

● Ran Bash · 2.2s
├ $ kill -TERM 71968 2>/dev/null; sleep 2; if ps -p 71968 -o pid=,comm= 2>/dev/null | grep -q .; then echo …
├ --- final check ---
├ PID COMM
├ pid 71968: gone
├ PID USER COMM
├ pid 71966 (login wrapper): gone
└ … +6 lines (Ctrl+O to view transcript)

3m 2s total · ttft 24.9s · ≥20.2k tokens · 2 tools · (34.9k overall)

✖ Error · ✗ [contract_violation] Astra could not settle the tool-result callback because the server rejected its durable
lifecycle state. This client detached; that is not a cancellation of the server run. A timed-out acknowledgement does n
ot prove the server rejected the tool-result. Details: HTTP 405 Method Not Allowed: <!doctypehtml><meta http-equiv="X-UA-Compatible"content="IE=edge,chrome=1"><meta
name="data-spm"content="a3c0e"><title>405</title><style>a,body,div,h2,html,p{margin:0;padding:0}a{text-decoration:none;color:#3b6ea3}.container{width:1000px;margin:auto;color:#696969}.header{padding:110px
0}.header .message{height:36px;padding-left:120px;background:url(https://errors.aliyun.com/images/TB1TpamHpXXXXaJXXXXeB
7nYVXX-104-162.png) no-repeat 0 -128px;line-height:36px}.main{padding:50px 0;background:#f4f5f7}#block_image{position:r
elative;left:120px}</style>

<
/div>

</
div>
<script>function getRenderData(){var e=document.getElementById("renderData");return JSON.parse(e.innerH
TML)}function convertTimestampToString(e){e=parseInt(e,10),e=new Date(e);return e.getFullYear()+"-"+("0"+(e.getMonth()+
1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)+" "+("0"+e.getHours()).slice(-2)+":"+("0"+e.getMinutes()).slice(-2)+":"+(
"0"+e.getSeconds()).slice(-2)}var en_tips={block_message:"Sorry, your request has been blocked as it may cause potential
threats to the server's security.",block_url_tips:"Current URL: ",block_time_tips:"Request Time: ",block_traceid_tips:"
Your Request ID is: "},cn_tips={block_message:"很抱歉,由于您访问的URL有可能对网站造成安全威胁,您的访问被阻断。",block
url_tips:"当前网址: ",block_time_tips:"请求时间: ",block_traceid_tips:"您的请求ID是: "};window.onload=function(){var t
=getRenderData(),n="cn";try{navigator.language.startsWith("zh")||(n="en")}catch(e){t.lang&&(n=t.lang)}if(t){var e,i=cn

tips,r=document.getElementById("block_image");for(e in"en"===n?(i=en_tips,r.src="https://g.alicdn.com/sd-base/static/1.
0.5/image/405.png",r.id="en_block"):r.src="https://errors.aliyun.com/images/TB15QGaHpXXXXXOaXXXXia39XXX-660-117.png",i)
document.getElementById(e).innerText=i[e];n=t.traceid,r=n.slice(8,21);document.getElementById("traceid").innerText=n,do
cument.getElementById("url").innerText=location.href.split("?")[0],document.getElementById("time").innerText=convertTim
estampToString(r)}}</script><textarea id="renderData" style="display:none">{"traceid":"0a18ab6417907235305174261e4138",
"lang":"cn"}</textarea> The server run was not cancelled. Wait for it to finish, or stop it with astra session cancel 840f5a0e-598f-4bd1-acab-fad899548383, then run astra --resume 840f5a0e-598f-4bd1-acab-fad899548383 before sending an
other message.

Expected behavior

Follow my instruction, or at least, a readable and actionable message.

Steps to reproduce

I found a astra server process was left running on my local machine. I asked astra (client/edge session) to kill it.
Astra is not happy about this at all.

Additional information

No response

Activity

  1. added
    kind/bug
    on Sep 29, 2026
  2. loveRhythm1990 commented on Oct 9, 2026

    @loveRhythm1990
    Collaborator

    The WAF false positive has been identified, the narrowly scoped whitelist has been saved, and a controlled end-to-end CLI retest succeeded. The separate CLI diagnostics fix is proposed in PR #966. The issue remains open pending review and any investigation of the original detached session.

    Confirmed root cause

    The Alibaba Cloud WAF record for trace ID 0a18ab6417907235305174261e4138 shows that the request at 2026-09-30 07:12:10 UTC+8 was a POST /tools/result to the Astra API. This was a tool-result callback, not an OSS request.

    The Web Core Protection module blocked the callback because it interpreted Shell text inside postarg.output as a code-execution attack. The record showed two matching rules:

    Rule ID Rule
    113120 Echo remote command execution
    130019 Code execution

    The local Bash output indicates that both target PIDs were gone. The reported failure occurred when Edge submitted the tool result; it does not establish that the local command failed or that Astra rejected the run's durable lifecycle state.

    The callback received HTTP 405 with an Alibaba Cloud HTML block page rather than a structured Astra lifecycle error.

    WAF configuration fix completed

    A whitelist rule has been saved with all of the following matching conditions:

    • Host equals the affected Astra API hostname.
    • URI Path equals /tools/result.
    • HTTP method equals POST.

    It skips only Web Core Protection rule IDs 113120 and 130019. There is no source-IP restriction, so the fix applies to callbacks from other clients as well. Other protection modules remain enabled.

    End-to-end verification completed

    On 2026-10-10, Astra CLI 0.2.10 completed a fresh test turn that read inert shell-command text as fixture data (the shell text itself was not executed). The callback delivered the tool output successfully, the assistant returned the expected completion marker, and the CLI exited with code 0. Server audit confirmed a successful tool completion, the complete fixture output, and a successful final turn with no error.

    This verifies callback delivery and successful completion for a new session after the whitelist change. It does not establish recovery of the original detached session.

    Remaining client issues and follow-up

    The inspected client implementation still has misleading error handling:

    • edge_callback_error_kind falls back to ContractViolation for this HTTP 405.
    • mark_edge_callback_failure describes non-transport callback errors as a rejection of durable lifecycle state.
    • The error message includes the entire HTML response, making the terminal output difficult to read.

    These CLI diagnostics defects are addressed separately in PR #966, pending merge/release. The change distinguishes callback HTTP failures from structured lifecycle conflicts, suppresses HTML/markup pages, preserves bounded diagnostic IDs and HTTP status, and avoids treating an unacknowledged callback as proof of the server run's final state. Offline tests cover both tool-result and approval HTML 405 responses, structured conflicts, authentication refresh, transport failures, and existing interactive/headless recovery behavior.

    The remaining follow-up is review/release of the client fix and inspection of the original session if recovery is still required. The whitelist addresses the two rules observed in this incident; other code-bearing outputs may still match other rules.

  3. XuPeng-SH commented on Oct 20, 2026

    @XuPeng-SH
    Collaborator

    Cleanup: the reported HTTP 405 was confirmed as the WAF blocking POST /tools/result. The narrowly scoped WAF rule and successful end-to-end retest are documented above. PR #966 has now merged and fixes the misleading CLI error classification and unbounded HTML diagnostics. The callback path was verified on a fresh run, so this incident is resolved. Any separate requirement to recover the original detached session should be tracked independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions