Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Issue triage by rules: labels and one comment for known problems

Rafael Abud Ferreira64ea364b4652
diff --git a/.github/triage/rules.json b/.github/triage/rules.json
new file mode 100644
index 0000000..3d9d974
--- /dev/null
+++ b/.github/triage/rules.json
@@ -0,0 +1,104 @@
+{
+ "_comment": "Known problems, matched against the issue's title and text (case-insensitive regular expressions). label: added to the issue. fixed_in: the release that fixes it (the reply asks to update when the reporter's release is older). reply: one paragraph for the triage comment. Keep replies short and in English. where: the parts searched (\"title\", \"what\", \"log\"; all when absent) - words common in logs only in title/what.",
+ "rules": [
+ {
+ "id": "ca-unreadable",
+ "label": "area: certificates",
+ "patterns": [
+ "-15872",
+ "cacert\\.pem",
+ "secure connections could not be set up"
+ ],
+ "fixed_in": "0.9.6",
+ "reply": "**Certificates file unreadable** (`assets/cacert.pem`, error -15872): since v0.9.6 the app uses a copy built into it, so updating fixes this. On an older version, copy the whole `PPSA99810` folder again (an incomplete copy is the usual cause)."
+ },
+ {
+ "id": "tls-verify",
+ "label": "area: certificates",
+ "patterns": [
+ "-9984",
+ "certificate verification failed"
+ ],
+ "reply": "**Certificate verification failed** (-9984): the most common cause is the console's **date and time** being wrong (Settings > System > Date and Time: set it correctly, or set it from the internet). A DNS server or proxy that intercepts Microsoft's sites can cause it too: try without it."
+ },
+ {
+ "id": "region",
+ "label": "area: region",
+ "patterns": [
+ "refused the sign-in",
+ "not available in this region",
+ "xcloud login failed: http 403",
+ "unsupported ?market",
+ "sign in as another country"
+ ],
+ "fixed_in": "0.9.6",
+ "reply": "**xCloud refused the sign-in**: cloud gaming may not be offered in your country, or the account has no Game Pass plan with cloud gaming. Since v0.9.6 that error offers *Sign in as another country* (opt-in, at your own risk)."
+ },
+ {
+ "id": "xbox-wake",
+ "label": "area: remote play",
+ "patterns": [
+ "waitingforservertoregister",
+ "consoledidnotwake",
+ "cloud streaming service to be ready",
+ "didn't wake",
+ "did not wake"
+ ],
+ "reply": "**Your Xbox didn't answer**: on the Xbox, Settings > General > Power options: choose *Sleep* (not *Shutdown*), and Settings > Devices & connections > Remote features: turn them on. If it was asleep for long, turn it on by hand once and try again."
+ },
+ {
+ "id": "no-entitlement",
+ "label": "area: catalog",
+ "patterns": [
+ "noentitlement",
+ "not entitled"
+ ],
+ "reply": "**Not on your account / plan**: xCloud says the account can't stream that game. It may need another Game Pass plan, or buying it."
+ },
+ {
+ "id": "free-to-play",
+ "label": "area: catalog",
+ "patterns": [
+ "free[- ]to[- ]play",
+ "fortnite"
+ ],
+ "reply": "**Free-to-play games**: they appear in the *Free to play* row once they are on your Microsoft account (get them free on xbox.com or in the Xbox app first).",
+ "where": [
+ "title",
+ "what"
+ ]
+ },
+ {
+ "id": "controller",
+ "label": "area: controller",
+ "patterns": [
+ "button",
+ "mapping",
+ "remap",
+ "dualsense",
+ "controller",
+ "trigger",
+ "vibration",
+ "rumble",
+ "bot[aã]o",
+ "controle"
+ ],
+ "reply": "**Controller**: the DualSense's Create button is kept by the PS5 (screenshots) and can't be used by apps. Xbox *View* is a touchpad click, Xbox *Menu* is OPTIONS. Button remapping is on the roadmap.",
+ "where": [
+ "title",
+ "what"
+ ]
+ },
+ {
+ "id": "crash",
+ "label": "crash",
+ "patterns": [
+ "closed unexpectedly",
+ "\\bsigsegv\\b",
+ "signal 11\\b",
+ "\\bstalled\\b"
+ ],
+ "reply": "**The app closed unexpectedly**: thanks for the report. The log lines above show what it was doing; if you can, tell us what you did just before."
+ }
+ ]
+}
diff --git a/.github/triage/test_triage.py b/.github/triage/test_triage.py
new file mode 100644
index 0000000..d6bc09e
--- /dev/null
+++ b/.github/triage/test_triage.py
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Copyright (C) 2026 RafaelNGP
+# The issue triage's rules on made-up issues: python3 -m unittest discover .github/triage
+import json
+import os
+import unittest
+
+import triage
+
+RULES = json.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "rules.json")))["rules"]
+
+
+def form(what="", release="", firmware="", log=""):
+ def section(title, text):
+ return f"### {title}\n\n{text or '_No response_'}\n\n"
+ return (section("What happened?", what) + section("App release", release) + section("PS5 firmware", firmware) +
+ section("Game(s) affected", "") + section("Network", "Wired") +
+ section("xcloud.log", f"```text\n{log}\n```" if log else ""))
+
+
+LOG = "10:00:00 [I] === PSBox Cloud Gaming starting ===\n"
+
+
+class Triage(unittest.TestCase):
+ def run_triage(self, body, title="A problem", latest="0.9.6"):
+ return triage.triage({"title": title, "body": body}, RULES, latest)
+
+ def test_known_error_fixed_in_newer_release(self):
+ labels, comment = self.run_triage(form("It doesn't start", "v0.9.5", "13.00",
+ LOG + "10:00:01 [E] TLS setup: certificates cacert.pem: (-15872)"))
+ self.assertIn("area: certificates", labels)
+ self.assertIn("outdated-version", labels)
+ self.assertIn("fw: 13.00", labels)
+ self.assertNotIn("needs-info", labels)
+ self.assertIn("please update to v0.9.6", comment)
+ self.assertNotIn("Does it still happen there", comment) # already asked to update
+ self.assertTrue(comment.startswith(triage.MARKER))
+
+ def test_clock_error_and_missing_release(self):
+ labels, comment = self.run_triage(form("error at start", "any version", "5.50",
+ LOG + "10:00:01 [E] TLS handshake: Certificate verification failed (-9984)"))
+ self.assertIn("area: certificates", labels)
+ self.assertIn("needs-info", labels)
+ self.assertIn("date and time", comment)
+ self.assertIn("app release", comment)
+
+ def test_controller_words_only_in_the_description(self):
+ # "vibration" in the log alone isn't a controller problem.
+ labels, _ = self.run_triage(form("It froze", "0.9.6", "13.60", LOG + "10:00:02 [I] pad 0 vibration suppression"))
+ self.assertNotIn("area: controller", labels)
+ labels, comment = self.run_triage(form("The select button does nothing", "0.9.6", "13.60", LOG))
+ self.assertIn("area: controller", labels)
+ self.assertIn("touchpad click", comment)
+
+ def test_no_false_crash_from_installed(self):
+ labels, _ = self.run_triage(form("app installed without issue", "0.9.6", "13.60", LOG))
+ self.assertNotIn("crash", labels)
+ labels, _ = self.run_triage(form("Closed unexpectedly: signal 11 (SIGSEGV) while home", "0.9.6", "13.60", LOG))
+ self.assertIn("crash", labels)
+
+ def test_up_to_date_and_complete_says_nothing(self):
+ labels, comment = self.run_triage(form("Something odd", "v0.9.6", "13.60", LOG))
+ self.assertEqual(labels, ["fw: 13.60"])
+ self.assertIsNone(comment)
+
+ def test_app_version_typed_as_firmware_is_ignored(self):
+ labels, _ = self.run_triage(form("x", "0.9.5", "0.9.5", LOG))
+ self.assertFalse(any(label.startswith("fw: ") for label in labels))
+
+ def test_not_the_form_asks_for_nothing(self):
+ labels, comment = self.run_triage("Could you add favourites?", title="Idea: favourites")
+ self.assertEqual(labels, [])
+ self.assertIsNone(comment)
+
+ def test_region_and_wake(self):
+ labels, _ = self.run_triage(form("no login", "0.9.6", "", LOG + "10:00:03 [E] sign-in failed: xCloud login failed: HTTP 403"))
+ self.assertIn("area: region", labels)
+ labels, comment = self.run_triage(form("my xbox", "0.9.6", "", LOG + "10:00:03 [I] State WaitingForServerToRegister"))
+ self.assertIn("area: remote play", labels)
+ self.assertIn("Power options", comment)
+
+ def test_rules_are_valid(self):
+ import re
+ for rule in RULES:
+ self.assertTrue(rule["label"] and rule["reply"] and rule["patterns"], rule["id"])
+ for pattern in rule["patterns"]:
+ re.compile(pattern)
+ for where in rule.get("where", []):
+ self.assertIn(where, ("title", "what", "log"))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/triage/triage.py b/.github/triage/triage.py
new file mode 100644
index 0000000..f09855f
--- /dev/null
+++ b/.github/triage/triage.py
@@ -0,0 +1,218 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Copyright (C) 2026 RafaelNGP
+"""Triage of a new or edited issue, by rules (no AI, nothing to pay).
+
+Reads the bug form's fields (What happened?, App release, PS5 firmware,
+xcloud.log), matches rules.json's known problems, and then on the issue:
+adds labels (never removes one), and writes or updates ONE comment (marked
+with MARKER) saying what is known, asking to update when the release is
+older than the fix or the latest, and asking for what is missing.
+
+The issue's text is someone else's: it is only matched with regular
+expressions here, never run or put in a command.
+
+ GitHub Actions: triage.py (GITHUB_EVENT_PATH, GITHUB_TOKEN, GITHUB_REPOSITORY;
+ TRIAGE_ISSUE=<number> for one already there)
+ Locally: triage.py --dry-run issue.json --latest 0.9.6
+ (issue.json: {"title": ..., "body": ...}, e.g. from `gh issue view N --json title,body`)
+"""
+import json
+import os
+import re
+import sys
+import urllib.error
+import urllib.request
+
+MARKER = "<!-- psbox-triage -->"
+HERE = os.path.dirname(os.path.abspath(__file__))
+MAX_TEXT = 200_000 # characters of an issue looked at
+
+LABEL_COLOURS = {
+ "needs-info": "fbca04",
+ "outdated-version": "c5def5",
+ "crash": "b60205",
+}
+AREA_COLOUR = "1d76db"
+FIRMWARE_COLOUR = "ededed"
+
+
+def parse_form(body):
+ """The issue form's sections: '### Heading' -> text (without _No response_ or code fences)."""
+ fields = {}
+ current = None
+ lines = []
+ for line in (body or "")[:MAX_TEXT].splitlines():
+ m = re.match(r"^###\s+(.+?)\s*$", line)
+ if m:
+ if current is not None:
+ fields[current] = "\n".join(lines).strip()
+ current, lines = m.group(1).lower(), []
+ elif current is not None:
+ lines.append(line)
+ if current is not None:
+ fields[current] = "\n".join(lines).strip()
+ for key, value in fields.items():
+ value = re.sub(r"^```[a-z]*\s*$", "", value, flags=re.M).strip()
+ fields[key] = "" if value == "_No response_" else value
+ return fields
+
+
+def field(fields, *names):
+ for key, value in fields.items():
+ if any(key.startswith(n) for n in names):
+ return value
+ return ""
+
+
+def version_tuple(text):
+ m = re.search(r"(\d+)\.(\d+)\.(\d+)", text or "")
+ return tuple(int(x) for x in m.groups()) if m else None
+
+
+def firmware_of(text):
+ """'13.60', '5.50' ... or None (a version of the app typed there isn't a firmware)."""
+ m = re.search(r"\b(\d{1,2})\.(\d{2})\b", text or "")
+ if not m or version_tuple(text):
+ return None
+ major = int(m.group(1))
+ return f"{major}.{m.group(2)}" if 1 <= major <= 20 else None
+
+
+def looks_like_log(text):
+ return bool(re.search(r"\d\d:\d\d:\d\d \[[IWED]\]", text or ""))
+
+
+def triage(issue, rules, latest):
+ """-> (labels to add, comment text or None)."""
+ title = (issue.get("title") or "")[:1000]
+ body = (issue.get("body") or "")[:MAX_TEXT]
+ fields = parse_form(body)
+ what = field(fields, "what happened")
+ log = field(fields, "xcloud.log")
+ parts = {"title": title, "what": what, "log": log}
+ if not fields: # not the form: all of it is "what happened"
+ parts["what"] = body
+ release = version_tuple(field(fields, "app release"))
+ firmware = firmware_of(field(fields, "ps5 firmware"))
+ latest_t = version_tuple(latest) if latest else None
+
+ labels, notes = [], []
+ asked_update = False
+ for rule in rules:
+ where = rule.get("where", ["title", "what", "log"])
+ text = "\n".join(parts[w] for w in where)
+ if not any(re.search(p, text, re.I) for p in rule["patterns"]):
+ continue
+ if rule["label"] not in labels:
+ labels.append(rule["label"])
+ note = rule["reply"]
+ fixed = version_tuple(rule.get("fixed_in"))
+ if fixed and release and release < fixed:
+ note += f" You're on v{'.'.join(map(str, release))}: please update to v{rule['fixed_in']} or newer."
+ asked_update = True
+ notes.append(note)
+
+ asks = []
+ if not fields: # not the bug form (a question, an idea): nothing to ask for
+ pass
+ elif not release:
+ asks.append("the **app release** (Settings > Updates shows it, e.g. v0.9.6)")
+ if fields and not looks_like_log(log):
+ asks.append("the **xcloud.log** (in `/data/homebrew/PPSA99810/` over FTP, or use *Report a problem* "
+ "(△ in Settings or on the error) to fill this form from the app)")
+ if asks:
+ labels.append("needs-info")
+ outdated = release and latest_t and release < latest_t
+ if outdated:
+ labels.append("outdated-version")
+ if firmware:
+ labels.append(f"fw: {firmware}")
+
+ if not notes and not asks and not outdated:
+ return labels, None
+ out = [MARKER, "Automatic triage (rules, not a person; the maintainer will read this too):", ""]
+ for note in notes:
+ out.append(f"- {note}")
+ if outdated and not asked_update:
+ out.append(f"- This was reported on v{'.'.join(map(str, release))}; the latest is **v{latest}** "
+ "(the app offers it after sign-in, or Settings > Updates). Does it still happen there?")
+ if asks:
+ out.append("- To look into it, please add " + " and ".join(asks) + ".")
+ return labels, "\n".join(out)
+
+
+# --- GitHub ---------------------------------------------------------------------
+
+def api(method, path, token, data=None):
+ req = urllib.request.Request(
+ "https://api.github.com" + path,
+ method=method,
+ data=None if data is None else json.dumps(data).encode(),
+ headers={"Authorization": f"Bearer {token}", "Accept": "application/vnd.github+json",
+ "X-GitHub-Api-Version": "2022-11-28", "User-Agent": "psbox-triage"})
+ with urllib.request.urlopen(req, timeout=30) as r:
+ text = r.read().decode()
+ return json.loads(text) if text else None
+
+
+def label_colour(name):
+ if name.startswith("area: "):
+ return AREA_COLOUR
+ if name.startswith("fw: "):
+ return FIRMWARE_COLOUR
+ return LABEL_COLOURS.get(name, "ededed")
+
+
+def apply(repo, number, labels, comment, token):
+ for name in labels: # made the first time they're needed
+ try:
+ api("POST", f"/repos/{repo}/labels", token, {"name": name, "color": label_colour(name)})
+ except urllib.error.HTTPError as e:
+ if e.code != 422: # 422: it exists
+ raise
+ if labels:
+ api("POST", f"/repos/{repo}/issues/{number}/labels", token, {"labels": labels})
+ if comment is None:
+ return
+ mine = [c for c in api("GET", f"/repos/{repo}/issues/{number}/comments?per_page=100", token)
+ if MARKER in (c.get("body") or "") and c.get("user", {}).get("type") == "Bot"]
+ if mine:
+ if mine[0]["body"] != comment:
+ api("PATCH", f"/repos/{repo}/issues/comments/{mine[0]['id']}", token, {"body": comment})
+ else:
+ api("POST", f"/repos/{repo}/issues/{number}/comments", token, {"body": comment})
+
+
+def main(argv):
+ rules = json.load(open(os.path.join(HERE, "rules.json")))["rules"]
+ if len(argv) >= 3 and argv[1] == "--dry-run":
+ issue = json.load(open(argv[2]))
+ latest = argv[argv.index("--latest") + 1] if "--latest" in argv else None
+ labels, comment = triage(issue, rules, latest)
+ print("labels:", labels)
+ print(comment or "(no comment)")
+ return 0
+ repo, token = os.environ["GITHUB_REPOSITORY"], os.environ["GITHUB_TOKEN"]
+ number = os.environ.get("TRIAGE_ISSUE", "").strip()
+ if number: # by hand: an issue already there
+ if not number.isdigit():
+ print("TRIAGE_ISSUE must be a number")
+ return 1
+ issue = api("GET", f"/repos/{repo}/issues/{number}", token)
+ else:
+ issue = json.load(open(os.environ["GITHUB_EVENT_PATH"]))["issue"]
+ if issue.get("pull_request") or issue.get("user", {}).get("type") == "Bot":
+ return 0
+ try:
+ latest = api("GET", f"/repos/{repo}/releases/latest", token)["tag_name"].lstrip("v")
+ except urllib.error.HTTPError:
+ latest = None
+ labels, comment = triage(issue, rules, latest)
+ print(f"issue #{issue['number']}: labels {labels}, comment {'yes' if comment else 'no'}")
+ apply(repo, issue["number"], labels, comment, token)
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1087f3e..0fe5cd8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,6 +13,15 @@ permissions:
contents: read
jobs:
+ triage-rules:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ sparse-checkout: .github/triage
+ - name: Issue triage rules
+ run: cd .github/triage && python3 -m unittest -v test_triage
+
build:
runs-on: ubuntu-24.04
steps:
diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml
new file mode 100644
index 0000000..a49c394
--- /dev/null
+++ b/.github/workflows/issue-triage.yml
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+# A new or edited issue: labels and one comment from .github/triage/rules.json
+# (known problems, the release, what's missing). No AI, no secrets: only the
+# workflow's own token, allowed to label and comment, nothing else.
+name: Issue triage
+
+on:
+ issues:
+ types: [opened, edited, reopened]
+ # By hand, for an issue that was already there (Actions > Issue triage).
+ workflow_dispatch:
+ inputs:
+ issue:
+ description: Issue number
+ required: true
+
+permissions:
+ issues: write
+
+concurrency:
+ group: triage-${{ github.event.issue.number || inputs.issue }}
+ cancel-in-progress: true
+
+jobs:
+ triage:
+ runs-on: ubuntu-24.04
+ if: github.event_name == 'workflow_dispatch' || github.event.issue.pull_request == null
+ steps:
+ # The rules and the script as they are on the default branch (an
+ # issue can't change them).
+ - uses: actions/checkout@v7
+ with:
+ sparse-checkout: .github/triage
+ persist-credentials: false
+
+ # The issue's text reaches the script only through the event file,
+ # never through the command line.
+ - name: Triage
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ TRIAGE_ISSUE: ${{ inputs.issue }}
+ run: python3 .github/triage/triage.py
diff --git a/.gitignore b/.gitignore
index 42ed774..561bd84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ account.json
*.aus
*.h264
autoplay.txt
+__pycache__/