port: read the session link from the container log, not the transcript

`sylph-port remote` never returned. Two bugs, one behind the other.

The glob `/sylph-home/port/.claude/**/*.jsonl` ran under `sh`, which has no
globstar, so it stayed literal and matched nothing -- the lookup could not have
succeeded however long it waited.

Fixing that exposed the real problem: the session transcript records every
command run inside the container, including this lookup, so grepping it matched
our own pattern string back and returned a truncated URL. The container log is
the right source and has no such feedback loop.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-08-28 20:35:22 +02:00
parent 58c6d3874c
commit b07381d443

View File

@@ -145,9 +145,12 @@ case "${1:-}" in
remote)
echo "waiting for the session to register" >&2
for _ in $(seq 60); do
url=$(docker exec "$NAME" sh -c \
'grep -ho "https://claude.ai/code/session_[A-Za-z0-9]*" \
/sylph-home/port/.claude/**/*.jsonl 2>/dev/null | tail -1' 2>/dev/null || true)
# Read the container LOG, not the session transcript. The transcript
# records every command run inside the container -- including this
# lookup -- so grepping it matched our own pattern string back.
url=$(docker logs "$NAME" 2>&1 \
| grep -aoE 'https://claude\.ai/code/session_[A-Za-z0-9]+' \
| tail -1 || true)
[ -n "$url" ] && { echo "$url"; exit 0; }
sleep 2
done