Skip to content

nuitrcs/quest_ood_copilot_cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Copilot CLI — Quest OnDemand App

An Open OnDemand Batch Connect application that launches a browser-based terminal running the GitHub Copilot CLI on a Quest compute node. A Quest-specific MCP server starts automatically with every session, giving the agent read/write access to the user's home directory and Quest documentation.


Files

manifest.yml

App metadata consumed by the OOD portal: name, icon, category, and description shown on the app card and launch page.

form.yml.erb

Defines the web form a user fills in before launching a session. Fields:

Field Purpose
slurm_partition SLURM partition to submit to
slurm_account Allocation to charge
num_cores CPU cores (--ntasks-per-node)
memory_per_node RAM in GB (--mem)
bc_num_hours Walltime in hours (--time)
user_email Optional email on session start
job_name SLURM job name
raw_data / raw_group_data Hidden fields populated by OOD helpers; used by form.js to drive the dynamic dropdowns

form.js

JavaScript that powers the dynamic partition and account dropdowns. On page load and on partition change it reads raw_data and raw_group_data, filters the available partition/account combinations to those the user actually belongs to, and enforces the correct walltime and memory limits for the selected partition.

submit.yml.erb

Translates form values into sbatch flags passed to SLURM: --partition, --account, --time, --nodes, --ntasks-per-node, --mem, --job-name, and optionally --mail-user.

view.html.erb

The panel shown in the OOD dashboard while the session is running. Provides:

  • A Connect button that opens the browser terminal.
  • The SSH tunnel command for users who want to connect from outside Quest.
  • Quick-start example copilot commands.

template/before.sh.erb

Runs inside the SLURM job before the main script. It:

  1. Finds an available port for the ttyd web terminal.
  2. Sets COPILOT_PREFIX and COPILOT_CUSTOM_INSTRUCTIONS_DIRS to the shared install at /software/2025/copilot_cli.
  3. Writes the MCP config JSON (pointing to the Quest filesystem server at /software/2025/mcp) into the session's staged directory.
  4. Installs that config to ~/.copilot/mcp-config.json, backing up any pre-existing file so it can be restored on session end.
  5. Pre-approves all quest-filesystem MCP tools in ~/.copilot/permissions-config.json so Copilot CLI does not prompt for interactive confirmation inside the batch job.
  6. Ensures quest-filesystem is not listed in the user's disabledMcpServers setting.

template/script.sh.erb

The main SLURM job script (started in the background by OOD). It:

  1. Registers a cleanup trap that fires on EXIT and SIGTERM (e.g. when SLURM terminates the job at walltime). The trap restores the user's original ~/.copilot/mcp-config.json from the backup created in before.sh.erb, ensuring no session-specific config leaks into subsequent sessions.
  2. Launches ttyd — the browser-based terminal server — on the port chosen by before.sh.erb.
  3. Serves a small startup script that prints session info (binary path, version, active MCP config) and drops the user into an interactive bash shell with copilot on PATH.

template/after.sh

Waits (up to 120 seconds) for ttyd to open its port. Once the port is open, OOD marks the session as Running and enables the Connect button. Exits with an error and cleans up the SLURM job if the timeout is reached.


MCP Server

The quest-filesystem MCP server is managed by RCS staff and lives at /software/2025/mcp. Write access to that path is restricted to the rcs_staff group — regular users receive the server automatically with every session but cannot modify the server binary or its configuration.

The server gives Copilot read/write access to two directories:

Path Purpose
$HOME (resolved via realpath) The user's home directory
/software/2025/copilot_cli Quest guidelines and custom instructions

Quest-specific agent guidance is in /software/2025/copilot_cli/quest_guidelines.md. Copilot reads it automatically via the MCP server without a separate process.

The server is named quest-filesystem rather than filesystem so it is never silently skipped by a user-level disabledMcpServers setting that might contain the generic name.


Session Lifecycle

User submits form
       │
       ▼
SLURM allocates a compute node
       │
       ▼
before.sh  ── sets port, writes MCP config, pre-approves tools
       │
       ▼
script.sh  ── (background) registers cleanup trap, launches ttyd
       │
       ▼
after.sh   ── waits for ttyd port; OOD marks session "Running"
       │
       ▼
User connects via browser terminal
       │
       ▼
Session ends (user exits, walltime reached, or job cancelled)
       │
       ▼
script.sh EXIT/SIGTERM trap restores ~/.copilot/mcp-config.json
SLURM kills all remaining job processes

Deployment

Place this directory in a shared OOD app path readable by all cluster users. Write access should be restricted to rcs_staff so users cannot alter the app files. The SLURM job and the MCP server both run as the submitting user; no elevated privileges are required.

Required shared paths (managed by RCS staff, not part of this app):

Path Contents
/software/2025/copilot_cli/ Copilot CLI binary, quest_guidelines.md, *.instructions.md
/software/2025/mcp/ Node.js MCP filesystem server

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages