Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR refactors the agent container entrypoint by extracting the duplicated background-launch, token-unset, signal-trap, and wait sequence into a shared helper. In the broader codebase, this keeps the security-sensitive startup/cleanup path for agent execution in one place instead of maintaining parallel chroot and non-chroot copies.
Changes:
- Added
run_agent_with_token_protection()to centralize background launch, token clearing, signal trapping, and exit-code propagation. - Replaced the inline chroot execution sequence with a single helper call.
- Replaced the inline non-chroot execution sequence with helper calls for both the
capshand directgosupaths.
Show a summary per file
| File | Description |
|---|---|
containers/agent/entrypoint.sh |
Extracts the shared agent-launch/token-protection/signal-handling flow and rewires both execution paths to call it. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
containers/agent/entrypoint.sh:413
- This handler is installed for both SIGTERM and SIGINT, but it always exits 143. That means a Ctrl+C / SIGINT delivered to the entrypoint is now reported as SIGTERM, so callers cannot distinguish an interrupt (expected 130 elsewhere in this repo) from an external termination.
exit 143 # Standard exit code for SIGTERM
}
trap cleanup_and_exit TERM INT
- Files reviewed: 1/1 changed files
- Comments generated: 2
| if [ -n "$AGENT_PID" ]; then | ||
| kill -TERM "$AGENT_PID" 2>/dev/null || true | ||
| wait "$AGENT_PID" 2>/dev/null || true | ||
| fi | ||
| exit 143 # Standard exit code for SIGTERM | ||
| } | ||
| trap cleanup_and_exit TERM INT |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot merge main and address the review feedback |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…-signal-handler-code Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Done. Merged main (commit bf595a5) and the signal-forwarding fix was already in place from the previous commit (1df6130): |
Smoke Test Results✅ GitHub MCP: Listed 2 merged PRs Status: PASS
|
🔥 Smoke Test: Copilot BYOK — PASS
Running in BYOK offline mode ( Author:
|
🧪 Smoke Test Results
PR: refactor(entrypoint): deduplicate signal-handler + token-cleanup into shared function Overall: PARTIAL — MCP ✅; pre-computed step outputs were not substituted (workflow template issue).
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke TestMerged PRs: api-proxy: inject X-Initiator: agent default on all Copilot-bound requests to prevent billing inflation; refactor: extract shared parameterised test factory for log sub-commands Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison — Smoke Test Results
Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test Results — FAIL
Overall: FAIL —
|
The signal-handler + token-cleanup sequence (
cleanup_and_exit,trap, background launch, polling loop,unset_sensitive_tokens,wait) was duplicated verbatim across both the chroot and non-chroot execution paths — meaning any future security fix to token-clearing or signal-handling had to be applied in two places.Changes
run_agent_with_token_protectionfunction — extracted the ~35-line shared sequence into a single function that accepts the launch command as$@and runs it in the background, then handles all signal/token/wait logicrun_agent_with_token_protection chroot /host /bin/bash -c "..."Net: −23 lines; security-sensitive signal and token logic now has a single source of truth.