Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions scripts/compare-standalone-to-monorepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,35 @@ while IFS= read -r relpath; do
fi
done < "$TMPFILE_MONO"

# ── Compare scripts/codegen/java.ts ───────────────────────────────────
JAVATS_STATUS=""
STANDALONE_JAVATS="${STANDALONE}/scripts/codegen/java.ts"
MONO_JAVATS="${MONO_JAVA}/scripts/codegen/java.ts"

if [ -f "$STANDALONE_JAVATS" ] && [ -f "$MONO_JAVATS" ]; then
if diff -q "$STANDALONE_JAVATS" "$MONO_JAVATS" >/dev/null 2>&1; then
JAVATS_STATUS="identical"
SAME_COUNT=$((SAME_COUNT + 1))
else
JAVATS_STATUS="differ"
DIFFER_COUNT=$((DIFFER_COUNT + 1))
DIFFER_LIST="${DIFFER_LIST}scripts/codegen/java.ts
"
fi
Comment thread
edburns marked this conversation as resolved.
elif [ -f "$STANDALONE_JAVATS" ] && [ ! -f "$MONO_JAVATS" ]; then
JAVATS_STATUS="only-standalone"
MISSING_FROM_MONO_COUNT=$((MISSING_FROM_MONO_COUNT + 1))
MISSING_FROM_MONO_LIST="${MISSING_FROM_MONO_LIST}scripts/codegen/java.ts
"
elif [ ! -f "$STANDALONE_JAVATS" ] && [ -f "$MONO_JAVATS" ]; then
JAVATS_STATUS="only-monorepo"
MISSING_FROM_STANDALONE_COUNT=$((MISSING_FROM_STANDALONE_COUNT + 1))
MISSING_FROM_STANDALONE_LIST="${MISSING_FROM_STANDALONE_LIST}scripts/codegen/java.ts
"
else
JAVATS_STATUS="missing-both"
fi

# ── Compare .lastmerge ────────────────────────────────────────────────
LASTMERGE_STATUS=""
STANDALONE_LASTMERGE="${STANDALONE}/.lastmerge"
Expand Down Expand Up @@ -172,6 +201,19 @@ elif [ "$LASTMERGE_STATUS" = "only-monorepo" ]; then
else
echo ".lastmerge: not found in either location"
fi

# scripts/codegen/java.ts status
if [ "$JAVATS_STATUS" = "identical" ]; then
echo "scripts/codegen/java.ts: identical"
elif [ "$JAVATS_STATUS" = "differ" ]; then
echo "scripts/codegen/java.ts: DIFFERS"
elif [ "$JAVATS_STATUS" = "only-standalone" ]; then
echo "scripts/codegen/java.ts: only in standalone"
elif [ "$JAVATS_STATUS" = "only-monorepo" ]; then
echo "scripts/codegen/java.ts: only in monorepo"
else
echo "scripts/codegen/java.ts: not found in either location"
fi
echo ""

if [ "$DIFFER_COUNT" -gt 0 ]; then
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/github/copilot/CopilotClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ public CompletableFuture<CopilotSession> createSession(SessionConfig config) {
});
}).exceptionally(ex -> {
sessions.remove(sessionId);
// Also remove the re-keyed entry if the server returned a different ID
String activeId = session.getSessionId();
if (!sessionId.equals(activeId)) {
sessions.remove(activeId);
}
Comment thread
edburns marked this conversation as resolved.
LoggingHelpers.logTiming(LOG, Level.WARNING, ex,
"CopilotClient.createSession failed. Elapsed={Elapsed}, SessionId=" + sessionId,
totalNanos);
Expand Down Expand Up @@ -622,6 +627,11 @@ public CompletableFuture<CopilotSession> resumeSession(String sessionId, ResumeS
});
}).exceptionally(ex -> {
sessions.remove(sessionId);
// Also remove the re-keyed entry if the server returned a different ID
String activeId = session.getSessionId();
if (!sessionId.equals(activeId)) {
sessions.remove(activeId);
}
LoggingHelpers.logTiming(LOG, Level.WARNING, ex,
"CopilotClient.resumeSession failed. Elapsed={Elapsed}, SessionId=" + sessionId,
totalNanos);
Expand Down Expand Up @@ -739,6 +749,7 @@ CompletableFuture<Void> updateSessionOptionsForMode(CopilotSession session, Bool
// Best-effort disconnect so we don't leak it (in empty mode it would
// otherwise stay alive with permissive defaults).
LOG.log(Level.WARNING, "session.options.update failed for session " + session.getSessionId(), ex);
sessions.remove(session.getSessionId());
try {
session.close();
} catch (Exception closeEx) {
Expand Down
Loading