Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

fix(mobile-apps): correct VS Code update instructions (#756)

Shubham Agarwal633974ae38c5
diff --git a/plugins/mobile-apps/scripts/check-version.js b/plugins/mobile-apps/scripts/check-version.js
index b3bcc6882..31228ece2 100644
--- a/plugins/mobile-apps/scripts/check-version.js
+++ b/plugins/mobile-apps/scripts/check-version.js
@@ -75,16 +75,27 @@ function formatUpdateMessage(
let message = `\nPlugin update available: ${pluginName} ${localVersion} -> ${remoteVersion}.\n`;
if (installation === 'checkout') {
+ const reloadInstruction =
+ host === 'vscode'
+ ? 'run **Developer: Reload Window** from the Command Palette'
+ : 'restart or reload the host';
return (
message +
- 'This plugin is loaded from a local checkout. Update that checkout, restart or reload the host, and rerun this skill.'
+ 'This plugin is loaded live from a local source, so Copilot cannot update it. Ask the person who configured the local marketplace or plugin directory to update its mobile-app files, then ' +
+ `${reloadInstruction} and rerun this skill.`
);
}
if (host === 'vscode') {
+ const qualifiedName = marketplaceName ? `${pluginName}@${marketplaceName}` : pluginName;
return (
message +
- `Update ${pluginName} in the Agent Plugins/Extensions view, reload VS Code, and rerun this skill.`
+ `To update a copied marketplace plugin in VS Code:\n` +
+ `1. Open the integrated terminal.\n` +
+ `2. Run \`copilot plugin marketplace update ${marketplaceName || DEFAULT_MARKETPLACE_NAME}\`.\n` +
+ `3. Run \`copilot plugin update ${qualifiedName}\`.\n` +
+ `4. Run **Developer: Reload Window** from the Command Palette.\n` +
+ `5. Rerun this skill.`
);
}
diff --git a/plugins/mobile-apps/scripts/lib/mobile-lifecycle.js b/plugins/mobile-apps/scripts/lib/mobile-lifecycle.js
index 9d5dbe8bc..d8fc4fea7 100644
--- a/plugins/mobile-apps/scripts/lib/mobile-lifecycle.js
+++ b/plugins/mobile-apps/scripts/lib/mobile-lifecycle.js
@@ -180,6 +180,10 @@ function tryRecoverRunLock(directory, options) {
fs.linkSync(lockPath, recoveryPath);
} catch (error) {
if (error.code === 'ENOENT') return true;
+ // Windows can deny the recovery link while another owner unlinks the lock.
+ // Retry within the acquisition deadline; a denied link never grants ownership.
+ // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilew#remarks
+ if (error.code === 'EPERM') return false;
if (error.code !== 'EEXIST') throw error;
const claimedOwner = readLockOwner(recoveryPath);
if (claimedOwner && !processIsAlive(claimedOwner.pid, options)) {
diff --git a/plugins/mobile-apps/scripts/tests/check-version.test.js b/plugins/mobile-apps/scripts/tests/check-version.test.js
index ed30ab0e2..b918baf3d 100644
--- a/plugins/mobile-apps/scripts/tests/check-version.test.js
+++ b/plugins/mobile-apps/scripts/tests/check-version.test.js
@@ -57,6 +57,15 @@ function normalizeLineEndings(content) {
return content.replace(/\r\n?/g, '\n');
}
+function assertVsCodeUpdatePath(content) {
+ assert.match(content, /Open the integrated terminal/);
+ assert.match(content, /`copilot plugin marketplace update power-platform-skills`/);
+ assert.match(content, /`copilot plugin update mobile-app@power-platform-skills`/);
+ assert.match(content, /\*\*Developer: Reload Window\*\*/);
+ assert.match(content, /Rerun this skill/);
+ assert.doesNotMatch(content, /Extensions view|select \*\*Update\*\*/i);
+}
+
test('normalizeLineEndings makes Windows skill frontmatter parseable', () => {
const content = '---\r\nuser-invocable: true\r\n---\r\n\r\n# Skill\r\n';
const normalized = normalizeLineEndings(content);
@@ -117,7 +126,7 @@ test('formatUpdateMessage uses the plain plugin name without a marketplace', ()
assert.doesNotMatch(message, /@/);
});
-test('formatUpdateMessage gives VS Code UI guidance without CLI commands', () => {
+test('formatUpdateMessage gives VS Code copied installs verified CLI guidance', () => {
const message = formatUpdateMessage(
'mobile-app',
'0.3.0',
@@ -126,9 +135,8 @@ test('formatUpdateMessage gives VS Code UI guidance without CLI commands', () =>
'vscode'
);
- assert.match(message, /Agent Plugins\/Extensions view/);
- assert.match(message, /reload VS Code/);
- assert.doesNotMatch(message, /claude plugin|copilot plugin/);
+ assertVsCodeUpdatePath(message);
+ assert.doesNotMatch(message, /claude plugin/);
});
test('formatUpdateMessage gives unknown hosts neutral UI guidance', () => {
@@ -144,18 +152,21 @@ test('formatUpdateMessage gives unknown hosts neutral UI guidance', () => {
assert.doesNotMatch(message, /claude plugin|copilot plugin/);
});
-test('formatUpdateMessage gives local checkouts source-specific guidance', () => {
+test('formatUpdateMessage gives local live sources administrator guidance', () => {
const message = formatUpdateMessage(
'mobile-app',
'0.3.0',
'0.4.0',
'power-platform-skills',
- 'claude',
+ 'vscode',
'checkout'
);
- assert.match(message, /loaded from a local checkout/);
- assert.match(message, /Update that checkout/);
+ assert.match(message, /loaded live from a local source/);
+ assert.match(message, /Copilot cannot update it/);
+ assert.match(message, /person who configured the local marketplace or plugin directory/);
+ assert.match(message, /\*\*Developer: Reload Window\*\*/);
+ assert.doesNotMatch(message, /\bGit\b|git pull|rebase/);
assert.doesNotMatch(message, /plugin marketplace update|plugin update mobile-app/);
});
@@ -230,11 +241,11 @@ test('checkForUpdate works for a standalone installed plugin without Git metadat
});
assert.match(message, /Plugin update available: mobile-app 0\.3\.0 -> 0\.4\.0/);
- assert.match(message, /Agent Plugins\/Extensions view/);
- assert.doesNotMatch(message, /claude plugin|copilot plugin/);
+ assertVsCodeUpdatePath(message);
+ assert.doesNotMatch(message, /claude plugin/);
});
-test('checkForUpdate gives source guidance for a local checkout', async (t) => {
+test('checkForUpdate gives administrator guidance for a local live marketplace', async (t) => {
const checkoutPluginRoot = createCheckoutPlugin(t, '0.3.0');
const message = await checkForUpdate({
pluginRoot: checkoutPluginRoot,
@@ -242,7 +253,9 @@ test('checkForUpdate gives source guidance for a local checkout', async (t) => {
fetchRemotePlugin: async () => ({ version: '0.4.0' }),
});
- assert.match(message, /loaded from a local checkout/);
+ assert.match(message, /loaded live from a local source/);
+ assert.match(message, /Copilot cannot update it/);
+ assert.doesNotMatch(message, /\bGit\b|git pull|rebase/);
assert.doesNotMatch(message, /claude plugin|copilot plugin/);
});
@@ -288,6 +301,12 @@ test('every public skill runs or owns the plugin check before its workflow', ()
const content = normalizeLineEndings(fs.readFileSync(skillPath, 'utf8'));
if (/^name: check-updates$/m.test(content)) {
assert.match(content, /^## Step 1: Check The Plugin$/m);
+ assert.match(content, /local marketplace directory/);
+ assert.match(content, /walking its ancestors for a `\.git` directory or gitfile/);
+ assert.match(content, /Copilot cannot update a plugin loaded live from a local source/);
+ assert.match(content, /do not recommend[\s\S]*Git commands/);
+ assert.match(content, /Do not modify that source automatically/);
+ assertVsCodeUpdatePath(content);
continue;
}
const allowedTools = content.match(/^allowed-tools:\s*(.+)$/m);
diff --git a/plugins/mobile-apps/scripts/tests/mobile-telemetry-lifecycle.test.js b/plugins/mobile-apps/scripts/tests/mobile-telemetry-lifecycle.test.js
index b98dea000..91b7748ce 100644
--- a/plugins/mobile-apps/scripts/tests/mobile-telemetry-lifecycle.test.js
+++ b/plugins/mobile-apps/scripts/tests/mobile-telemetry-lifecycle.test.js
@@ -936,6 +936,91 @@ test('lock publication treats transient EEXIST as contention after release', (co
assert.ok(pendingPaths.every((filename) => !fs.existsSync(filename)));
});
+test('run lock recovery retries transient EPERM after the owner releases', (context) => {
+ const projectRoot = tempProject(context);
+ const configDir = path.join(projectRoot, 'config');
+ const root = lifecycle.beginSpan({
+ projectRoot, configDir, skillName: 'create-mobile-app',
+ });
+ const runDirectory = lifecycle.runDirectory(configDir, root.runId);
+ const lockPath = path.join(runDirectory, '.lifecycle.lock');
+ const recoveryPath = path.join(runDirectory, '.lifecycle.lock.recovery');
+ fs.writeFileSync(lockPath, JSON.stringify({
+ pid: process.pid,
+ token: '11111111-1111-4111-8111-111111111111',
+ acquiredAtMs: Date.now(),
+ }));
+ const originalLink = fs.linkSync;
+ let recoveryAttempts = 0;
+ context.mock.method(fs, 'linkSync', (source, target) => {
+ if (target === recoveryPath) {
+ recoveryAttempts += 1;
+ // Windows can report EPERM as the other owner unlinks the source.
+ fs.rmSync(lockPath, { force: true });
+ throw Object.assign(new Error('lock release in progress'), { code: 'EPERM' });
+ }
+ return originalLink(source, target);
+ });
+
+ const child = lifecycle.beginSpan({
+ projectRoot,
+ configDir,
+ runId: root.runId,
+ parentSpanId: root.spanId,
+ skillName: 'create-mobile-app',
+ checkpointName: 'gather_app_requirements',
+ });
+ assert.equal(recoveryAttempts, 1);
+ assert.equal(child.parentSpanId, root.spanId);
+ assert.equal(fs.existsSync(lockPath), false);
+ assert.equal(fs.existsSync(recoveryPath), false);
+});
+
+for (const [code, expectedError] of [
+ ['EPERM', /lock_timeout/],
+ ['EIO', { code: 'EIO' }],
+]) {
+ test(`run lock recovery preserves the owner after persistent ${code}`, (context) => {
+ const projectRoot = tempProject(context);
+ const configDir = path.join(projectRoot, 'config');
+ const root = lifecycle.beginSpan({
+ projectRoot, configDir, skillName: 'create-mobile-app',
+ });
+ const runDirectory = lifecycle.runDirectory(configDir, root.runId);
+ const lockPath = path.join(runDirectory, '.lifecycle.lock');
+ const recoveryPath = path.join(runDirectory, '.lifecycle.lock.recovery');
+ const owner = JSON.stringify({
+ pid: process.pid,
+ token: '11111111-1111-4111-8111-111111111111',
+ acquiredAtMs: Date.now(),
+ });
+ fs.writeFileSync(lockPath, owner);
+ const filesBefore = fs.readdirSync(runDirectory).sort();
+ const originalLink = fs.linkSync;
+ let recoveryAttempts = 0;
+ context.mock.method(fs, 'linkSync', (source, target) => {
+ if (target === recoveryPath) {
+ recoveryAttempts += 1;
+ throw Object.assign(new Error('recovery link unavailable'), { code });
+ }
+ return originalLink(source, target);
+ });
+
+ assert.throws(() => lifecycle.beginSpan({
+ projectRoot,
+ configDir,
+ runId: root.runId,
+ parentSpanId: root.spanId,
+ skillName: 'create-mobile-app',
+ checkpointName: 'gather_app_requirements',
+ lockTimeoutMs: 0,
+ }), expectedError);
+ assert.equal(recoveryAttempts, 1);
+ assert.equal(fs.readFileSync(lockPath, 'utf8'), owner);
+ assert.deepEqual(fs.readdirSync(runDirectory).sort(), filesBefore);
+ });
+}
+
test('run lock recovers when its recorded owner process is dead', (context) => {
const projectRoot = tempProject(context);
const configDir = path.join(projectRoot, 'config');
diff --git a/plugins/mobile-apps/skills/check-updates/SKILL.md b/plugins/mobile-apps/skills/check-updates/SKILL.md
index 677b026e4..3a07c58e3 100644
--- a/plugins/mobile-apps/skills/check-updates/SKILL.md
+++ b/plugins/mobile-apps/skills/check-updates/SKILL.md
@@ -26,11 +26,15 @@ https://raw.githubusercontent.com/microsoft/power-platform-skills/main/plugins/m
Compare semantic versions. If the public version is newer, make no project changes, return `BLOCKED: mobile-app plugin update requires restart`, and show the matching update path:
+- First determine whether `${PLUGIN_ROOT}` is under a local source checkout by walking its ancestors for a `.git` directory or gitfile. This includes plugins loaded from a **local marketplace directory** as well as `--plugin-dir`. For this live-source mode, do not recommend marketplace/plugin update commands, a VS Code Update button, or Git commands. Explain that Copilot cannot update a plugin loaded live from a local source; ask the person who configured the local marketplace or plugin directory to update its mobile-app files, then restart/reload the host and rerun this skill. Do not modify that source automatically.
- GitHub Copilot CLI: `copilot plugin marketplace update power-platform-skills`, then `copilot plugin update mobile-app@power-platform-skills`, `/restart`, and rerun this skill.
- Claude Code: `claude plugin marketplace update power-platform-skills`, then `claude plugin update mobile-app@power-platform-skills`, restart, and rerun this skill.
-- VS Code Copilot Chat: update **mobile-app** in the Agent Plugins/Extensions view, reload VS Code, and rerun this skill.
-
-For a checkout loaded with `--plugin-dir`, tell the user to update that checkout and restart the host instead.
+- VS Code Copilot Chat, when the plugin is a copied marketplace install rather than a live local source:
+ 1. Open the integrated terminal.
+ 2. Run `copilot plugin marketplace update power-platform-skills`.
+ 3. Run `copilot plugin update mobile-app@power-platform-skills`.
+ 4. Run **Developer: Reload Window** from the Command Palette.
+ 5. Rerun this skill.
After the plugin is current, run this once from `<working_dir>`: