diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,17 @@
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
+## v11 - 2026-11-20
+
+### Added
+- #73: Support Agda-2.9.0. Releases include its native binaries; there is no 2.9.0 WASM build.
+
+### Removed
+- Agda-2.6.4.3 is no longer supported, and no 2.6.4.3 binaries are built.
+
+### Fixed
+- #78: Make the response checkpoint check atomic with completion, so a command can no longer hang without sending `ResponseEnd`.
+
 ## v10 - 2026-11-15
 
 ### Added
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@
 ## Supported versions of Agda
 
 These are the currently supported versions of Agda:
+* Agda-2.9.0
 * Agda-2.8.0
 * Agda-2.7.0.1
-* Agda-2.6.4.3
 
 All releases will come with binaries built with these versions of Agda.
 
diff --git a/agda-language-server.cabal b/agda-language-server.cabal
--- a/agda-language-server.cabal
+++ b/agda-language-server.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           agda-language-server
-version:        10
+version:        11
 synopsis:       An implementation of language server protocal (LSP) for Agda 2.
 description:    Please see the README on GitHub at <https://github.com/agda/agda-language-server#readme>
 category:       Development
@@ -22,19 +22,14 @@
     CHANGELOG.md
     package.yaml
     stack.yaml
-    stack-9.10.2-Agda-2.6.4.3.yaml
     stack-9.10.2-Agda-2.7.0.1.yaml
     stack-9.10.2-Agda-2.8.0.yaml
+    stack-9.10.2-Agda-2.9.0.yaml
 
 source-repository head
   type: git
   location: https://github.com/agda/agda-language-server
 
-flag Agda-2-6-4
-  description: Embed Agda-2.6.4.3
-  manual: True
-  default: False
-
 flag Agda-2-7-0
   description: Embed Agda-2.7.0.1
   manual: True
@@ -45,6 +40,11 @@
   manual: True
   default: False
 
+flag Agda-2-9-0
+  description: Embed Agda-2.9.0
+  manual: True
+  default: False
+
 flag reactor
   description: Build as a WASI reactor module
   manual: True
@@ -104,15 +104,15 @@
     , strict
     , text
   default-language: Haskell2010
-  if flag(Agda-2-6-4)
-    build-depends:
-        Agda ==2.6.4.3
   if flag(Agda-2-7-0)
     build-depends:
         Agda ==2.7.0.1
   if flag(Agda-2-8-0)
     build-depends:
         Agda ==2.8.0
+  if flag(Agda-2-9-0)
+    build-depends:
+        Agda ==2.9.0
   if arch(wasm32)
     build-depends:
         unix >=2.8.0.0 && <2.9
@@ -153,15 +153,15 @@
     , strict
     , text
   default-language: Haskell2010
-  if flag(Agda-2-6-4)
-    build-depends:
-        Agda ==2.6.4.3
   if flag(Agda-2-7-0)
     build-depends:
         Agda ==2.7.0.1
   if flag(Agda-2-8-0)
     build-depends:
         Agda ==2.8.0
+  if flag(Agda-2-9-0)
+    build-depends:
+        Agda ==2.9.0
   if arch(wasm32)
     build-depends:
         unix >=2.8.0.0 && <2.9
@@ -187,6 +187,8 @@
   other-modules:
       Test.Hover
       Test.LSP
+      Test.Render
+      Test.ResponseController
       Test.Smoke
       Test.SrcLoc
       Test.Version
@@ -248,15 +250,15 @@
     , tasty-quickcheck
     , text
   default-language: Haskell2010
-  if flag(Agda-2-6-4)
-    build-depends:
-        Agda ==2.6.4.3
   if flag(Agda-2-7-0)
     build-depends:
         Agda ==2.7.0.1
   if flag(Agda-2-8-0)
     build-depends:
         Agda ==2.8.0
+  if flag(Agda-2-9-0)
+    build-depends:
+        Agda ==2.9.0
   if arch(wasm32)
     build-depends:
         unix >=2.8.0.0 && <2.9
@@ -300,15 +302,15 @@
     , strict
     , text
   default-language: Haskell2010
-  if flag(Agda-2-6-4)
-    build-depends:
-        Agda ==2.6.4.3
   if flag(Agda-2-7-0)
     build-depends:
         Agda ==2.7.0.1
   if flag(Agda-2-8-0)
     build-depends:
         Agda ==2.8.0
+  if flag(Agda-2-9-0)
+    build-depends:
+        Agda ==2.9.0
   if arch(wasm32)
     build-depends:
         unix >=2.8.0.0 && <2.9
diff --git a/package.yaml b/package.yaml
--- a/package.yaml
+++ b/package.yaml
@@ -1,5 +1,5 @@
 name:                agda-language-server
-version:             10
+version:             11
 github:              "agda/agda-language-server"
 license:             MIT
 author:              "Ting-Gian LUA"
@@ -11,9 +11,9 @@
 - CHANGELOG.md
 - package.yaml
 - stack.yaml
-- stack-9.10.2-Agda-2.6.4.3.yaml
 - stack-9.10.2-Agda-2.7.0.1.yaml
 - stack-9.10.2-Agda-2.8.0.yaml
+- stack-9.10.2-Agda-2.9.0.yaml
 
 # Metadata used when publishing your package
 synopsis:            An implementation of language server protocal (LSP) for Agda 2.
@@ -25,10 +25,6 @@
 description:         Please see the README on GitHub at <https://github.com/agda/agda-language-server#readme>
 
 flags:
-  Agda-2-6-4:
-    description: Embed Agda-2.6.4.3
-    manual: true
-    default: false
   Agda-2-7-0:
     description: Embed Agda-2.7.0.1
     manual: true
@@ -37,20 +33,24 @@
     description: Embed Agda-2.8.0
     manual: true
     default: false
+  Agda-2-9-0:
+    description: Embed Agda-2.9.0
+    manual: true
+    default: false
   reactor:
     description: Build as a WASI reactor module
     manual: true
     default: false
 when:
-- condition: "flag(Agda-2-6-4)"
-  dependencies:
-    - Agda == 2.6.4.3
 - condition: "flag(Agda-2-7-0)"
   dependencies:
     - Agda == 2.7.0.1
 - condition: "flag(Agda-2-8-0)"
   dependencies:
     - Agda == 2.8.0
+- condition: "flag(Agda-2-9-0)"
+  dependencies:
+    - Agda == 2.9.0
 - condition: "arch(wasm32)"
   then:
     dependencies:
diff --git a/src/Agda.hs b/src/Agda.hs
--- a/src/Agda.hs
+++ b/src/Agda.hs
@@ -8,21 +8,24 @@
   , runAgda
   , sendCommand
   , getCommandLineOptions
+  , parseAgdaOptions
   , CommandReq(..)
   , CommandRes(..)
   ) where
 
 import           Prelude                        hiding ( null )
 
-import           Agda.Compiler.Backend          ( parseBackendOptions )
+import           Agda.Compiler.Backend          ( Backend, parseBackendOptions )
 import           Agda.Compiler.Builtin          ( builtinBackends )
 import           Agda.Convert                   ( fromResponse )
+#if MIN_VERSION_Agda(2,9,0)
+import           Agda.Interaction.Response      ( Response_boot
+                                                  ( Resp_HighlightingInfo
+                                                  )
+                                                )
+#endif
 import           Agda.Interaction.Base          ( Command
                                                 , Command'(Command, Done, Error)
-#if MIN_VERSION_Agda(2,7,0)
-#else
-                                                , CommandM
-#endif
                                                 , CommandState(optionsOnReload)
                                                 , IOTCM
                                                 , initCommandState
@@ -38,7 +41,7 @@
                                                 , maybeAbort
                                                 , runInteraction
 #if MIN_VERSION_Agda(2,8,0)
-#elif MIN_VERSION_Agda(2,7,0)
+#else
                                                 , CommandM
 #endif
                                                 )
@@ -57,8 +60,14 @@
                                                 , TCErr
                                                 , commandLineOptions
                                                 , runTCMTop'
+#if MIN_VERSION_Agda(2,9,0)
+                                                , ModifySession
+                                                , lensBackends
+                                                , setSession
+#else
                                                 , setTCLens
                                                 , stBackends
+#endif
                                                 )
 import           Agda.TypeChecking.Monad.Base   ( TCM )
 import qualified Agda.TypeChecking.Monad.Benchmark
@@ -111,14 +120,25 @@
   result <- runAgda $ do
     -- decides how to output Response
     lift $ setInteractionOutputCallback $ \response -> do
-      resp <- if optRawResponses (envOptions env)
-        then do
-          value <- (pure . encodeTCM) response
-          resp' <- fmap IR.ResponseJSONRaw value
-          return resp'
-        else fromResponse response
+#if MIN_VERSION_Agda(2,9,0)
+      -- highlighting for another file: the IR has no field for its file,
+      -- so it is dropped instead of being applied to the current one
+      let forOtherFile = case response of
+            Resp_HighlightingInfo _ _ _ _ (Just _) -> True
+            _ -> False
+#else
+      let forOtherFile = False
+#endif
+      let raw = optRawResponses (envOptions env)
+      unless (forOtherFile && not raw) $ do
+        resp <- if raw
+          then do
+            value <- (pure . encodeTCM) response
+            resp' <- fmap IR.ResponseJSONRaw value
+            return resp'
+          else fromResponse response
 
-      sendResponse env resp
+        sendResponse env resp
 
     -- keep reading command
     commands <- liftIO $ initialiseCommandQueue (readCommand env)
@@ -197,29 +217,45 @@
 --------------------------------------------------------------------------------
 
 getCommandLineOptions
+#if MIN_VERSION_Agda(2,9,0)
+  :: (HasOptions m, MonadTCState m, ModifySession m, MonadIO m)
+  => ServerM m CommandLineOptions
+#else
   :: (HasOptions m, MonadTCState m, MonadIO m) => ServerM m CommandLineOptions
+#endif
 getCommandLineOptions = do
-  -- command line options from ARGV
-  argv   <- asks (optRawAgdaOptions . envOptions)
-  -- command line options from agda-mode
-  config <- asks (configRawAgdaOptions . envConfig)
-  -- concatenate both
-  let merged = argv <> config
-
-  case parse merged of
+  parsed <- parseAgdaOptions
+  case parsed of
     -- something bad happened, use the default options instead,
     -- and register the backends with their default options
-    Left  _          -> do
-      forM_ (parse []) $ \(bs, _) -> register bs
+    Nothing          -> do
+      forM_ (parseAgdaArgs []) $ \(bs, _) -> register bs
       commandLineOptions
-    Right (bs, opts) -> do
+    Just (bs, opts) -> do
       register bs
       return opts
  where
-  parse args =
-    fst $ runOptM $ parseBackendOptions builtinBackends args defaultOptions
   -- every fresh TCM state starts with no backends
+#if MIN_VERSION_Agda(2,9,0)
+  register bs = lift $ setSession lensBackends bs
+#else
   register bs = lift $ setTCLens stBackends bs
+#endif
+
+-- | The Agda options from ARGV and from agda-mode, with the backends they
+-- set up, or Nothing if they do not parse
+parseAgdaOptions :: Monad m => ServerM m (Maybe ([Backend], CommandLineOptions))
+parseAgdaOptions = do
+  -- command line options from ARGV
+  argv   <- asks (optRawAgdaOptions . envOptions)
+  -- command line options from agda-mode
+  config <- asks (configRawAgdaOptions . envConfig)
+  -- concatenate both
+  return $ parseAgdaArgs (argv <> config)
+
+parseAgdaArgs :: [String] -> Maybe ([Backend], CommandLineOptions)
+parseAgdaArgs args = either (const Nothing) Just $
+  fst $ runOptM $ parseBackendOptions builtinBackends args defaultOptions
 
 -- | Run a TCM action in IO and throw away all of the errors
 -- TODO: handle the caught errors
diff --git a/src/Agda/Convert.hs b/src/Agda/Convert.hs
--- a/src/Agda/Convert.hs
+++ b/src/Agda/Convert.hs
@@ -6,7 +6,13 @@
 import qualified Agda.IR as IR
 import Agda.Interaction.Base
 import Agda.Interaction.BasicOps as B
+#if MIN_VERSION_Agda(2,9,0)
+import Agda.Interaction.Emacs.Lisp (Lisp)
+import Agda.Utils.DocTree (treeToTextNoAnn)
+import qualified Data.Text as Text
+#else
 import Agda.Interaction.EmacsCommand (Lisp)
+#endif
 import Agda.Interaction.EmacsTop (showInfoError)
 import Agda.Interaction.Highlighting.Common (chooseHighlightingMethod, toAtoms)
 import Agda.Interaction.Highlighting.Precise (Aspects (..), DefinitionSite (..), HighlightingInfo, TokenBased (..))
@@ -17,9 +23,7 @@
 #else
 import Agda.Interaction.InteractionTop (localStateCommandM)
 #endif
-#if MIN_VERSION_Agda(2,7,0)
 import Agda.Interaction.Output ( OutputConstraint )
-#endif
 import Agda.Interaction.Response as R
 import Agda.Syntax.Abstract as A
 import Agda.Syntax.Abstract.Pretty (prettyATop)
@@ -67,9 +71,7 @@
   Resp_GiveAction {} -> "Resp_GiveAction"
   Resp_MakeCase {} -> "Resp_MakeCase"
   Resp_SolveAll {} -> "Resp_SolveAll"
-#if MIN_VERSION_Agda(2,7,0)
   Resp_Mimer {} -> "Resp_Mimer"
-#endif
   Resp_DisplayInfo {} -> "Resp_DisplayInfo"
   Resp_RunningInfo {} -> "Resp_RunningInfo"
   Resp_ClearRunningInfo {} -> "Resp_ClearRunningInfo"
@@ -83,7 +85,11 @@
 serialize = show . pretty
 
 fromResponse :: Response -> TCM IR.Response
+#if MIN_VERSION_Agda(2,9,0)
+fromResponse (Resp_HighlightingInfo info remove method modFile _) =
+#else
 fromResponse (Resp_HighlightingInfo info remove method modFile) =
+#endif
   fromHighlightingInfo info remove method modFile
 fromResponse (Resp_DisplayInfo info) = IR.ResponseDisplayInfo <$> fromDisplayInfo info
 fromResponse (Resp_ClearHighlighting TokenBased) = return IR.ResponseClearHighlightingTokenBased
@@ -91,7 +97,11 @@
 fromResponse Resp_DoneAborting = return IR.ResponseDoneAborting
 fromResponse Resp_DoneExiting = return IR.ResponseDoneExiting
 fromResponse Resp_ClearRunningInfo = return IR.ResponseClearRunningInfo
+#if MIN_VERSION_Agda(2,9,0)
+fromResponse (Resp_RunningInfo n s) = return $ IR.ResponseRunningInfo n (Text.unpack (treeToTextNoAnn s))
+#else
 fromResponse (Resp_RunningInfo n s) = return $ IR.ResponseRunningInfo n s
+#endif
 fromResponse (Resp_Status s) = return $ IR.ResponseStatus (sChecked s) (sShowImplicitArguments s)
 fromResponse (Resp_JumpToError f p) = return $ IR.ResponseJumpToError f (fromIntegral p)
 fromResponse (Resp_InteractionPoints is) =
@@ -100,9 +110,7 @@
   return $ IR.ResponseGiveAction i (fromAgda giveAction)
 fromResponse (Resp_MakeCase _ Function pcs) = return $ IR.ResponseMakeCaseFunction pcs
 fromResponse (Resp_MakeCase _ ExtendedLambda pcs) = return $ IR.ResponseMakeCaseExtendedLambda pcs
-#if MIN_VERSION_Agda(2,7,0)
 fromResponse (Resp_Mimer (InteractionId i) s) = return $ IR.ResponseMimer i s
-#endif
 fromResponse (Resp_SolveAll ps) = return $ IR.ResponseSolveAll (fmap prn ps)
   where
     prn (InteractionId i, e) = (i, prettyShow e)
diff --git a/src/Agda/Parser.hs b/src/Agda/Parser.hs
--- a/src/Agda/Parser.hs
+++ b/src/Agda/Parser.hs
@@ -4,8 +4,12 @@
 
 --------------------------------------------------------------------------------
 
+#if MIN_VERSION_Agda(2,9,0)
+import Agda (parseAgdaOptions)
+import Agda.Interaction.Options (CommandLineOptions (optMdOnlyAgdaBlocks))
+#endif
 import Agda.Syntax.Parser (parseFile, runPMIO, tokensParser)
-import Agda.Syntax.Parser.Tokens (Token)
+import Agda.Syntax.Parser.Tokens (Token (TokMarkup, TokTeX))
 import Agda.Syntax.Position (Position' (posPos), PositionWithoutFile, Range, RangeFile (RangeFile), getRange, rEnd', rStart')
 import Agda.Utils.FileName (mkAbsolute)
 import Control.Monad.State
@@ -25,13 +29,24 @@
   Nothing -> return Nothing
   Just filepath -> do
     let file = RangeFile (mkAbsolute filepath) Nothing
+#if MIN_VERSION_Agda(2,9,0)
+    -- read literate Markdown and Typst files as Agda does, which only
+    -- treats '```agda' blocks as code with this option. When the options
+    -- do not parse, Agda's default (False) applies, as in
+    -- 'getCommandLineOptions'.
+    mdOnlyAgdaBlocks <- maybe False (optMdOnlyAgdaBlocks . snd) <$> parseAgdaOptions
+#endif
     (result, _warnings) <- liftIO $
       runPMIO $ do
         -- parse the file and get all tokens
+#if MIN_VERSION_Agda(2,9,0)
+        (r, _fileType) <- parseFile mdOnlyAgdaBlocks tokensParser file (unpack source)
+#else
         (r, _fileType) <- parseFile tokensParser file (unpack source)
+#endif
         let tokens = fst r
         -- find the token at the position
-        return $ find (pointedBy position) tokens
+        return $ find (pointedBy position) tokens >>= nonLiterate
     case result of
       Left _err -> return Nothing
       Right Nothing -> return Nothing
@@ -44,6 +59,13 @@
             let text = Text.drop (start - 1) (Text.take (end - 1) source)
             return $ Just (token, text)
   where
+    -- the text of a literate file (prose, and the fences of its code
+    -- blocks) is not code, so there is nothing to infer
+    nonLiterate :: Token -> Maybe Token
+    nonLiterate (TokTeX _) = Nothing
+    nonLiterate (TokMarkup _) = Nothing
+    nonLiterate token = Just token
+
     startAndEnd :: Range -> Maybe (PositionWithoutFile, PositionWithoutFile)
     startAndEnd range = do
       start <- rStart' range
diff --git a/src/Agda/Position.hs b/src/Agda/Position.hs
--- a/src/Agda/Position.hs
+++ b/src/Agda/Position.hs
@@ -37,7 +37,11 @@
 toAgdaRange table path (LSP.Range start end) =
   Range
     (Strict.Just $ mkRangeFile $ AbsolutePath path)
+#if MIN_VERSION_Agda(2,9,0)
+    (Seq.singleton (PackIWF interval))
+#else
     (Seq.singleton interval)
+#endif
   where
     interval :: IntervalWithoutFile
     interval =
diff --git a/src/Options.hs b/src/Options.hs
--- a/src/Options.hs
+++ b/src/Options.hs
@@ -102,14 +102,12 @@
 
 versionString :: String
 versionString =
-#if MIN_VERSION_Agda(2,8,0)
+#if MIN_VERSION_Agda(2,9,0)
+  "Agda v2.9.0 Language Server v" <> show versionNumber <> suffix
+#elif MIN_VERSION_Agda(2,8,0)
   "Agda v2.8.0 Language Server v" <> show versionNumber <> suffix
-#elif MIN_VERSION_Agda(2,7,0)
-  "Agda v2.7.0.1 Language Server v" <> show versionNumber <> suffix
-#elif MIN_VERSION_Agda(2,6,4)
-  "Agda v2.6.4.3 Language Server v" <> show versionNumber <> suffix
 #else
-  error "Unsupported Agda version"
+  "Agda v2.7.0.1 Language Server v" <> show versionNumber <> suffix
 #endif
   where
 #ifdef wasm32_HOST_ARCH
diff --git a/src/Render/Common.hs b/src/Render/Common.hs
--- a/src/Render/Common.hs
+++ b/src/Render/Common.hs
@@ -18,11 +18,11 @@
     MetaId (MetaId),
     NameId (..),
     Named (namedThing),
-#if MIN_VERSION_Agda(2,7,0)
     OverlapMode (..),
-#endif
 
     Quantity (..),
+    Q0Origin (..),
+    Q1Origin (..),
     QωOrigin (..),
     Relevance (..),
     RewriteEqn' (..),
@@ -34,6 +34,9 @@
     PolarityModality (..),
     ModalPolarity (..),
 #endif
+#if MIN_VERSION_Agda(2,9,0)
+    RewriteAnn (..),
+#endif
   )
 import Agda.Utils.Functor ((<&>))
 import Agda.Utils.List1 (toList)
@@ -91,18 +94,30 @@
 -- | Quantity
 instance Render Quantity where
   render = \case
-    Quantity0 o ->
-      let s = show o
-       in if Agda.null o
-            then "@0"
-            else text s
-    Quantity1 o ->
-      let s = show o
-       in if Agda.null o
-            then "@1"
-            else text s
+    Quantity0 o -> let d = render o in if Agda.null d then "@0" else d
+    Quantity1 o -> let d = render o in if Agda.null d then "@1" else d
     Quantityω o -> render o
 
+instance Render Q0Origin where
+  render = \case
+    Q0Inferred -> mempty
+    Q0 {} -> "@0"
+    Q0Erased {} -> "@erased"
+
+instance Render Q1Origin where
+  render = \case
+    Q1Inferred -> mempty
+    Q1 {} -> "@1"
+    Q1Linear {} -> "@linear"
+
+#if MIN_VERSION_Agda(2,9,0)
+-- | The @rewrite attribute of a binder
+instance Render RewriteAnn where
+  render = \case
+    IsRewrite _ -> "@rewrite"
+    IsNotRewrite -> mempty
+
+#endif
 instance Render QωOrigin where
   render = \case
     QωInferred -> mempty
@@ -112,6 +127,9 @@
 instance Render Cohesion where
   render Flat = "@♭"
   render Continuous = mempty
+#if MIN_VERSION_Agda(2,9,0)
+  render Sharp = "@♯"
+#endif
   render Squash = "@⊤"
 
 -- | Polarity
@@ -131,7 +149,6 @@
 
 --------------------------------------------------------------------------------
 
-#if MIN_VERSION_Agda(2,7,0)
 instance Render OverlapMode where
   render = \case
     Overlappable -> "OVERLAPPABLE"
@@ -140,7 +157,6 @@
     Overlaps -> "OVERLAPS"
     FieldOverlap -> "overlap"
     DefaultOverlap -> mempty
-#endif
 
 --------------------------------------------------------------------------------
 
@@ -169,10 +185,8 @@
     IsLock LockOTick -> "@tick"
     IsNotLock -> mempty
 
-#if MIN_VERSION_Agda(2,7,0)
 renderErased :: Erased -> Inlines -> Inlines
 renderErased = renderQuantity . asQuantity
-#endif
 
 renderCohesion :: (LensCohesion a) => a -> Inlines -> Inlines
 renderCohesion a d =
@@ -184,9 +198,7 @@
   render = \case
     Rewrite es -> prefixedThings (text "rewrite") (render . snd <$> toList es)
     Invert _ pes -> prefixedThings (text "invert") (toList pes <&> (\(p, e) -> render p <+> "<-" <+> render e) . namedThing)
-#if MIN_VERSION_Agda(2,7,0)
     LeftLet pes  -> prefixedThings (text "using") [render p <+> "<-" <+> render e | (p, e) <- List1.toList pes]
-#endif
 
 prefixedThings :: Inlines -> [Inlines] -> Inlines
 prefixedThings kw = \case
diff --git a/src/Render/Concrete.hs b/src/Render/Concrete.hs
--- a/src/Render/Concrete.hs
+++ b/src/Render/Concrete.hs
@@ -16,7 +16,7 @@
 import qualified Agda.Utils.List1 as List1
 import qualified Agda.Utils.List2 as List2
 import Agda.Utils.Null
-import Data.Maybe (isNothing, maybeToList)
+import Data.Maybe (fromMaybe, isNothing, maybeToList)
 import qualified Data.Strict.Maybe as Strict
 import qualified Data.Text as T
 import Render.Class
@@ -30,11 +30,9 @@
 
 --------------------------------------------------------------------------------
 
-#if MIN_VERSION_Agda(2,7,0)
 instance (Render a) => Render (TacticAttribute' a) where
   render (TacticAttribute t) =
     ifNull (render t) empty $ \d -> "@" <> parens ("tactic" <+> d)
-#endif
 
 instance (Render a) => Render (Ranged a) where
   render = render . rangedThing
@@ -48,6 +46,9 @@
       [ render (getRelevance mod),
         render (getQuantity mod),
         render (getCohesion mod)
+#if MIN_VERSION_Agda(2,8,0)
+      , render (getModalPolarity mod)
+#endif
       ]
 
 -- | OpApp
@@ -85,7 +86,13 @@
 #if MIN_VERSION_Agda(2,8,0)
     OpApp _ q _ es -> fsep $ renderOpApp280 (Asp.Name Nothing True) q es
     WithApp _ e es -> fsep $ render e : fmap (("|" <+>) . render) (toList es)
+#if MIN_VERSION_Agda(2,9,0)
+    KnownOpApp asp _ q _ es -> fsep $ renderOpApp280 (fromMaybe (Asp.Name Nothing True) (Asp.aspect asp)) q es
+    -- Agda only adds highlighting here
+    Highlighted _ e -> render e
+#else
     KnownOpApp nk _ q _ es -> fsep $ renderOpApp280 (Asp.Name (Just nk) True) q es
+#endif
 #else
     OpApp _ q _ es -> fsep $ renderOpApp q es
     WithApp _ e es -> fsep $ render e : fmap ((text' ["delimiter"] "|" <+>) . render) es
@@ -113,12 +120,20 @@
           maybe mempty (\e -> "in" <+> render e) me
         ]
     Paren _ e -> parens $ render e
+#if MIN_VERSION_Agda(2,9,0)
+    IdiomBrackets _ q exprs -> qualifier q $
+#else
     IdiomBrackets _ exprs ->
+#endif
       case exprs of
         [] -> emptyIdiomBrkt
         [e] -> leftIdiomBrkt <+> render e <+> rightIdiomBrkt
         e : es -> leftIdiomBrkt <+> render e <+> fsep (fmap (("|" <+>) . render) es) <+> rightIdiomBrkt
+#if MIN_VERSION_Agda(2,9,0)
+    DoBlock _ q ss -> qualifier q $ "do" <+> vcat (fmap render (toList ss))
+#else
     DoBlock _ ss -> "do" <+> vcat (fmap render (toList ss))
+#endif
     As _ x e -> render x <> "@" <> render e
     Dot _ e -> "." <> render e
     DoubleDot _ e -> ".." <> render e
@@ -192,7 +207,11 @@
 instance Render NamedBinding where
 #if MIN_VERSION_Agda(2,8,0)
   render (NamedBinding withH
+#if MIN_VERSION_Agda(2,9,0)
+           x@(Arg (ArgInfo h (Modality r q c p) _o _fv (Annotation lock rew))
+#else
            x@(Arg (ArgInfo h (Modality r q c p) _o _fv (Annotation lock))
+#endif
                (Named _mn xb@(Binder _mp _ (BName _y _fix t _fin))))) =
     applyWhen withH prH $
     applyWhenJust (isLabeled x) (\ l -> (text l <+>) . ("=" <+>)) (render xb)
@@ -204,6 +223,10 @@
         . (pol <+>)
         . (lck <+>)
         . (tac <+>)
+#if MIN_VERSION_Agda(2,9,0)
+        . (rw <+>)
+    rw = render rew
+#endif
     coh = render c
     qnt = render q
     pol = render p
@@ -211,7 +234,7 @@
     lck = render lock
     -- Parentheses are needed when an attribute @... is printed
     mparens = applyUnless (null coh && null qnt && null lck && null tac && null pol) parens
-#elif MIN_VERSION_Agda(2,7,0)
+#else
   render
     ( NamedBinding
         withH
@@ -237,39 +260,13 @@
         -- Parentheses are needed when an attribute @... is printed
         mparens = applyUnless (null coh && null qnt && null lck && null tac) parens
 
-#else
-  render (NamedBinding withH x) =
-    prH $
-      if
-        | Just l <- isLabeled x -> text l <> " = " <> render xb
-        | otherwise -> render xb
-    where
-      xb = namedArg x
-      bn = binderName xb
-      prH
-        | withH =
-            renderRelevance x
-              . renderHiding x mparens'
-              . renderCohesion x
-              . renderQuantity x
-              . renderTactic bn
-        | otherwise = id
-      -- Parentheses are needed when an attribute @... is present
-      mparens'
-        | noUserQuantity x, Nothing <- bnameTactic bn = id
-        | otherwise = parens
 #endif
 
 renderTactic :: BoundName -> Inlines -> Inlines
 renderTactic = renderTactic' . bnameTactic
 
 renderTactic' :: TacticAttribute -> Inlines -> Inlines
-#if MIN_VERSION_Agda(2,7,0)
 renderTactic' t = (render t <+>)
-#else
-renderTactic' Nothing d = d
-renderTactic' (Just t) d = "@" <> (parens ("tactic " <> render t) <+> d)
-#endif
 
 --------------------------------------------------------------------------------
 
@@ -290,6 +287,9 @@
             renderCohesion y $
               renderQuantity y $
                 renderTactic (binderName $ namedArg y) $
+#if MIN_VERSION_Agda(2,9,0)
+                  (render (getRewriteAnn y) <+>) $
+#endif
                   sep
                     [ fsep (fmap (render . NamedBinding False) ys),
                       ":" <+> render e
@@ -333,7 +333,6 @@
     | isNoName (unqualify x) =
         vcat ["where", vcat $ fmap render ds]
   render (AnyWhere _range ds) = vcat ["where", vcat $ fmap render ds]
-#if MIN_VERSION_Agda(2,7,0)
   render (SomeWhere _ erased m a ds) =
     vcat
       [ hsep $
@@ -347,18 +346,6 @@
         PrivateAccess _ UserWritten -> ("private" :)
         _ -> id
 
-#else
-  render (SomeWhere _range _er m a ds) =
-    vcat
-      [ hsep $
-          applyWhen
-            (a == PrivateAccess UserWritten)
-            ("private" :)
-            ["module", render m, "where"],
-        vcat $ fmap render ds
-      ]
-#endif
-
 instance Render LHS where
   render (LHS p eqs es) =
     sep
@@ -439,24 +426,32 @@
         where
           mkInst (InstanceDef _) f = sep ["instance", f]
           mkInst NotInstanceDef f = f
-#if MIN_VERSION_Agda(2,7,0)
           mkOverlap i d
             | isYesOverlap i = "overlap" <+> d
-#else
-          mkOverlap i d | isOverlappable i = "overlap" <+> d
-#endif
             | otherwise = d
       Field _ fs ->
         sep
           [ "field",
             vcat (fmap render fs)
           ]
+#if MIN_VERSION_Agda(2,9,0)
+      -- the modality comes first, as in Agda's printer; an empty one is
+      -- left out, so that 'sep' adds no space for it
+      FunClause ai lhs rhs wh _ ->
+        sep $
+          [render m | let m = getModality ai, not (null (render m))]
+            ++ [ render lhs,
+                 render rhs,
+                 render wh
+               ]
+#else
       FunClause lhs rhs wh _ ->
         sep
           [ render lhs,
             render rhs,
             render wh
           ]
+#endif
       DataSig _ _er x tel e ->
         fsep
           [ hsep
@@ -505,19 +500,8 @@
                 render e
               ]
           ]
-#if MIN_VERSION_Agda(2,7,0)
       Record _ erased x dir tel e cs -> pRecord erased x dir tel (Just e) cs
-#else
-      Record _ _er x dir tel e cs -> pRecord x dir tel (Just e) cs
-#endif
-#if MIN_VERSION_Agda(2,7,0)
       RecordDef _ x dir tel cs -> pRecord defaultErased x dir tel Nothing cs
-#else
-      RecordDef _ x dir tel cs -> pRecord x dir tel Nothing cs
-#endif
-#if !MIN_VERSION_Agda(2,7,0)
-      RecordDirective r -> pRecordDirective r
-#endif
       Infix f xs -> render f <+> fsep (punctuate "," $ fmap render (toList xs))
       Syntax n _ -> "syntax" <+> render n <+> "..."
       PatternSyn _ n as p ->
@@ -547,9 +531,13 @@
             vcat $ fmap render ds
           ]
 #if MIN_VERSION_Agda(2,8,0)
-      ModuleMacro _ NotErased{} x (SectionApp _ [] y es) DoOpen i
+#if MIN_VERSION_Agda(2,9,0)
+      ModuleMacro _ NotErased{} x (SectionApp _ [] y es) doOpen@(DoOpen _) i
+#else
+      ModuleMacro _ NotErased{} x (SectionApp _ [] y es) doOpen@DoOpen i
+#endif
         | isNoName x ->
-        sep [ render DoOpen
+        sep [ render doOpen
             , fsep $ render y : map render es
             , render i
             ]
@@ -584,11 +572,19 @@
             ]
 #endif
       Open _ x i -> hsep ["open", render x, render i]
+#if MIN_VERSION_Agda(2,9,0)
+      Import open _ x rn i ->
+        hsep [render open, "import", render x, as rn, render i]
+        where
+          as (Left y) = "as" <+> render (asName y)
+          as (Right args) = fsep (map render args)
+#else
       Import _ x rn open i ->
         hsep [render open, "import", render x, as rn, render i]
         where
           as Nothing = mempty
           as (Just y) = "as" <+> render (asName y)
+#endif
       UnquoteDecl _ xs t ->
         fsep ["unquoteDecl" <+> fsep (fmap render xs) <+> "=", render t]
       UnquoteDef _ xs t ->
@@ -629,7 +625,6 @@
   Eta eta -> pHasEta0 (rangedThing eta)
   PatternOrCopattern {} -> "pattern"
 
-#if MIN_VERSION_Agda(2,7,0)
 pRecord ::
   Erased ->
   Name ->
@@ -664,51 +659,18 @@
     pType Nothing =
       "where"
 
-#else
-pRecord ::
-  Name ->
-  RecordDirectives ->
-  [LamBinding] ->
-  Maybe Expr ->
-  [Declaration] ->
-  Inlines
-pRecord x (RecordDirectives ind eta pat con) tel me cs =
-  sep
-    [ hsep
-        [ "record",
-          render x,
-          fcat (fmap render tel)
-        ],
-      pType me,
-      vcat $
-        pInd
-          ++ pEta
-          ++ pCon
-          ++ fmap render cs
-    ]
-  where
-    pType (Just e) =
-      hsep
-        [ ":",
-          render e,
-          "where"
-        ]
-    pType Nothing =
-      "where"
-    pInd = maybeToList $ text . show . rangedThing <$> ind
-    pEta =
-      maybeToList $
-        eta <&> \case
-          YesEta -> "eta-equality"
-          NoEta _ -> "no-eta-equality"
-    pCon = maybeToList $ (("constructor" <+>) . render) . fst <$> con
-#endif
-
 instance Render OpenShortHand where
+#if MIN_VERSION_Agda(2,9,0)
+  render (DoOpen _) = "open"
+#else
   render DoOpen = "open"
+#endif
   render DontOpen = mempty
 
 instance Render Pragma where
+#if MIN_VERSION_Agda(2,9,0)
+  render (EtaEqualityPragma _) = "ETA_EQUALITY"
+#endif
   render (OptionsPragma _ opts) = fsep $ fmap text $ "OPTIONS" : opts
   render (BuiltinPragma _ b x) = hsep ["BUILTIN", text (rangedThing b), render x]
   render (RewritePragma _ _ xs) =
@@ -754,11 +716,9 @@
   render (NoUniverseCheckPragma _) = "NO_UNIVERSE_CHECK"
   render (NotProjectionLikePragma _ q) =
     hsep ["NOT_PROJECTION_LIKE", render q]
-#if MIN_VERSION_Agda(2,7,0)
   render (InjectiveForInferencePragma _ i) =
     hsep ["INJECTIVE_FOR_INFERENCE", render i]
   render (OverlapPragma _ x m) = hsep [render m, render x]
-#endif
 
 instance Render Fixity where
   render (Fixity _ Unrelated _) = __IMPOSSIBLE__
@@ -809,7 +769,9 @@
     ParenP _ p -> parens $ render p
     WildP _ -> "_"
     AsP _ x p -> render x <> "@" <> render p
-#if MIN_VERSION_Agda(2,8,0)
+#if MIN_VERSION_Agda(2,9,0)
+    DotP _ _ _ p    -> "." <> render p
+#elif MIN_VERSION_Agda(2,8,0)
     DotP _ _ p      -> "." <> render p
 #else
     DotP _ p -> "." <> render p
@@ -887,6 +849,14 @@
       [] -> (d, [])
       b : bs -> (b <> d, bs)
 
+#if MIN_VERSION_Agda(2,9,0)
+-- | Puts the module qualifier of a @do@ block or idiom brackets in
+-- front, as Agda's @qualifier@ does
+qualifier :: Maybe QName -> Inlines -> Inlines
+qualifier (Just x) k = render x <> "." <> k
+qualifier Nothing k = k
+
+#endif
 -- `prettyOpApp` for Agda 2.8.0 and above
 renderOpApp280 :: 
   forall a.
diff --git a/src/Render/Interaction.hs b/src/Render/Interaction.hs
--- a/src/Render/Interaction.hs
+++ b/src/Render/Interaction.hs
@@ -4,9 +4,7 @@
 module Render.Interaction where
 
 import Agda.Interaction.Base
-#if MIN_VERSION_Agda(2,7,0)
 import Agda.Interaction.Output (OutputConstraint, OutputForm)
-#endif
 import Agda.Syntax.Internal (Blocker (..))
 import Agda.TypeChecking.Monad
 import qualified Data.IntMap as IntMap
@@ -103,9 +101,7 @@
             "Candidate:",
             vcat exprs'
           ]
-#if MIN_VERSION_Agda(2,7,0)
   render (ResolveInstanceOF q) = "Resolve output type of instance" <?> render q
-#endif
   render (PTSInstance name1 name2) =
     "PTS instance for (" <> render name1 <> ", " <> render name2 <> ")"
   render (PostponedCheckFunDef name expr _err) =
diff --git a/src/Render/Internal.hs b/src/Render/Internal.hs
--- a/src/Render/Internal.hs
+++ b/src/Render/Internal.hs
@@ -57,7 +57,13 @@
       Level l -> renderPrec p l
       MetaV x els -> render x `pApp` els
       DontCare v -> renderPrec p v
+#if MIN_VERSION_Agda(2,9,0)
+      Dummy kind es -> case kind of
+        DummyNamed s -> parens (text s) `pApp` es
+        DummyBrave hd -> render hd `pApp` es
+#else
       Dummy s es -> parens (text s) `pApp` es
+#endif
     where
       pApp d els =
         mparens (not (null els) && p > 9) $
@@ -133,7 +139,11 @@
     LevelUniv -> "LevelUniv"
     SizeUniv -> "SizeUniv"
     LockUniv -> "LockUniv"
+#if MIN_VERSION_Agda(2,9,0)
+    PiSort _ a _s1 s2 ->
+#else
     PiSort a _s1 s2 ->
+#endif
       mparens (p > 9) $
         "piSort"
           <+> renderDom (domInfo a) (text (absName s2) <+> ":" <+> render (unDom a))
diff --git a/src/Render/RichText.hs b/src/Render/RichText.hs
--- a/src/Render/RichText.hs
+++ b/src/Render/RichText.hs
@@ -5,6 +5,7 @@
 module Render.RichText
   ( Block (..),
     Inlines (..),
+    toPlainText,
     -- LinkTarget (..),
     space,
     text,
@@ -185,6 +186,21 @@
 
 instance ToJSON Inline
 
+-- | The text of the inlines, as a client would show it. Unlike 'show',
+-- it puts no space between adjacent inlines: '<>' joins them with no
+-- space, and '<+>' adds its space as text.
+toPlainText :: Inlines -> String
+toPlainText = concatMap inline . toList . unInlines
+  where
+    inline (Icon s _) = s
+    inline (Text s _) = s
+    inline (Link _ xs _) = toPlainText xs
+    inline (Hole i) = "?" ++ show i
+    inline (Horz xs) = unwords (map toPlainText xs)
+    inline (Vert xs) = unlines (map toPlainText xs)
+    inline (Parn x) = "(" <> toPlainText x <> ")"
+    inline (PrHz xs) = "(" <> unwords (map toPlainText xs) <> ")"
+
 instance Show Inline where
   show (Icon s _) = s
   show (Text s _) = s
@@ -199,6 +215,11 @@
 
 -- | ToJSON instances for A.types
 instance {-# OVERLAPS #-} ToJSON Agda.Range
+
+#if MIN_VERSION_Agda(2,9,0)
+instance ToJSON Agda.IntervalWithoutFile' where
+  toJSON = toJSON . Agda.unpackIWF
+#endif
 
 instance ToJSON (Agda.Interval' ()) where
 #if MIN_VERSION_Agda(2,8,0)
diff --git a/src/Render/TypeChecking.hs b/src/Render/TypeChecking.hs
--- a/src/Render/TypeChecking.hs
+++ b/src/Render/TypeChecking.hs
@@ -23,7 +23,7 @@
       GuardPos -> "g+"
 
 instance Render ProblemId where
-  render (ProblemId n) = render n
+  render (ProblemId n) = text (show n)
 
 instance Render Comparison where
   render CmpEq = "="
diff --git a/src/Server/Handler.hs b/src/Server/Handler.hs
--- a/src/Server/Handler.hs
+++ b/src/Server/Handler.hs
@@ -9,10 +9,6 @@
 import qualified Agda.IR                       as IR
 
 import           Agda.Interaction.Base          ( CommandQueue(..)
-#if MIN_VERSION_Agda(2,7,0)
-#else
-                                                , CommandM
-#endif
                                                 , CommandState(optionsOnReload)
                                                 , Rewrite(AsIs)
                                                 , initCommandState
@@ -31,9 +27,8 @@
 #endif
 
 #if MIN_VERSION_Agda(2,8,0)
-#elif MIN_VERSION_Agda(2,7,0)
-                                                , CommandM
 #else
+                                                , CommandM
 #endif
                                                 )
 import           Agda.Interaction.Options       ( CommandLineOptions
@@ -62,6 +57,9 @@
 import           Agda.TypeChecking.Monad
 import           Agda.Utils.FileName            ( AbsolutePath, absolute, doesFileExistCaseSensitive, filePath )
 import           Agda.Utils.Hash                ( Hash, hashTextFile )
+#if MIN_VERSION_Agda(2,9,0)
+import           Agda.Utils.Atomic              ( newAtomic, readAtomic )
+#endif
 #if MIN_VERSION_Agda(2,8,0)
 import           Agda.Syntax.Parser             ( agdaFileExtensions )
 #else
@@ -235,13 +233,34 @@
 -- side on the disk as it is now. A change on the disk under the same
 -- include dirs then goes unseen: when A/M.agda is deleted and B/M.agda is
 -- added, Agda keeps the decoded M, and this function drops it.
+--
+-- On Agda 2.9, the module-to-file map is in the session state, which
+-- 'cmd_load'' does not reset, and the old persistent state still holds
+-- the session of the last load. So the state this function gives gets a
+-- new session. That session keeps the file dictionary of the old one,
+-- because it allocates the file IDs that the kept modules refer to. It
+-- has no module-to-file entries, so that each lookup runs against the
+-- disk again, as on the Agda versions before 2.9. Its other parts, such
+-- as the backends, come from the fresh state of this hover.
 persistentStateForReload :: TCState -> TCM (Maybe PersistentTCState)
 persistentStateForReload old = do
   fresh <- getTC
-  result <- (putTC old >> Just <$> keep) `orOnAnyException` return Nothing
+  result <- (putTC old >> Just <$> (keep >>= withNewSession fresh)) `orOnAnyException` return Nothing
   putTC fresh
   return result
   where
+#if MIN_VERSION_Agda(2,9,0)
+    withNewSession fresh kept = do
+      oldSession <- readAtomic (stPersistentSession kept)
+      freshSession <- readAtomic (stPersistentSession (stPersistentState fresh))
+      session <- newAtomic freshSession
+        { stSessionFileDict = stSessionFileDict oldSession
+        , stSessionModuleToSourceId = Map.empty
+        }
+      return kept { stPersistentSession = session }
+#else
+    withNewSession _ kept = return kept
+#endif
     persistent = stPersistentState old
     decoded = stDecodedModules persistent
     importsOf = map fst . iImportedModules . miInterface
@@ -275,23 +294,28 @@
 -- current module is loaded from its .agdai, none exist, so 'D' in
 -- @module M (A : Set)@ comes out as @(A₁ : Set) → Set@ instead of @Set@.
 -- The fix in Agda, agda/agda#8906, does the same as this function inside
--- 'atTopLevel', and is not merged.
+-- 'atTopLevel', and is merged for Agda 2.10. On Agda 2.9, this function
+-- registers each module at the checkpoint of the context that
+-- 'atTopLevel' builds ('eCurrentCheckpoint'), as the fix does with the
+-- checkpoint it passes to 'setAllModuleCheckpoints'.
 --
 -- When an Agda release has the fix, run this function only on the Agda
 -- versions before that release, with a CPP version check, and remove it
 -- once every supported Agda has the fix.
 --
--- #8906 leaves open whether submodules with their own parameters should
--- get the checkpoint (they do here, as after a load that checks the
--- module), and whether loading the .agdai should register it instead. If
--- Agda decides otherwise, this function differs from Agda's fix on the
--- versions it still runs on. No test covers a submodule with parameters.
+-- The merged fix also registers the submodules, so this function and the
+-- fix agree. No test covers a submodule with parameters.
 keepModuleParameters :: TCM ()
 keepModuleParameters = do
   current <- currentModule
   sections <- Map.union <$> useTC (stSignature . sigSections)
                         <*> useTC (stImports . sigSections)
+#if MIN_VERSION_Agda(2,9,0)
+  forM_ (filter (current `isLeParentModuleOf`) (Map.keys sections)) $ \m ->
+    setModuleCheckpoint m =<< viewTC eCurrentCheckpoint
+#else
   forM_ (filter (current `isLeParentModuleOf`) (Map.keys sections)) setModuleCheckpoint
+#endif
 
 inferTypeOfText
   :: FilePath -> Text -> ServerM (LspM Config) (Either String String)
@@ -302,7 +326,14 @@
   noCache <- asks (optNoHoverCache . envOptions)
   runCommandM $ do
     cached <- if noCache then return Nothing else liftIO $ readIORef cacheRef
-    -- ask Agda if it would still see the same inputs, and leave no trace of asking
+    -- ask Agda if it would still see the same inputs, and leave no trace of asking.
+    -- On Agda 2.9, 'putTC fresh' does not undo what the check writes into
+    -- the session state (the module-to-file map and the file dictionary),
+    -- because the session is shared. A cache hit replaces the whole state
+    -- with the cached one, and a reload starts from the new session that
+    -- 'persistentStateForReload' gives, so neither sees those writes. If
+    -- that function gives Nothing, the reload keeps this fresh session,
+    -- whose map the check can only have set from no decoded modules.
     reusable <- case cached of
       Just c | hcFilePath c == filepath -> lift $ do
         fresh <- getTC
diff --git a/src/Server/ResponseController.hs b/src/Server/ResponseController.hs
--- a/src/Server/ResponseController.hs
+++ b/src/Server/ResponseController.hs
@@ -1,6 +1,11 @@
 -- |
 -- Makes sure that all dispatched works are done.
 -- Notify when all dispatched works are done.
+--
+-- All of the state (both counts and the pending checkpoints) is guarded by one
+-- `MVar`, so checking whether a checkpoint is met and recording it happen in
+-- the same critical section as a completion. Otherwise a completion could land
+-- between the check and the write, and the checkpoint would never fire (#78).
 module Server.ResponseController
   ( ResponseController,
     new,
@@ -10,20 +15,18 @@
 where
 
 import Control.Concurrent
-import Control.Concurrent.SizedChan
-import Control.Monad
-  ( void,
-    when,
-  )
-import Data.IORef
+import Control.Monad (when)
+import Data.List (partition)
 
-data ResponseController = ResponseController
+newtype ResponseController = ResponseController (MVar State)
+
+data State = State
   { -- | The number of work dispatched
-    dispatchedCount :: IORef Int,
+    dispatched :: !Int,
     -- | The number of work completed
-    completedCount :: IORef Int,
-    -- | A channel of "Checkpoints" to be met
-    checkpointChan :: SizedChan Checkpoint
+    completed :: !Int,
+    -- | Checkpoints yet to be met
+    checkpoints :: [Checkpoint]
   }
 
 -- | An "Checkpoint" is just a number with a callback, the callback will be invoked once the number is "met"
@@ -31,46 +34,35 @@
 
 -- | Constructs a new ResponseController
 new :: IO ResponseController
-new = ResponseController <$> newIORef 0 <*> newIORef 0 <*> newSizedChan
+new = ResponseController <$> newMVar (State 0 0 [])
 
 -- | Returns a callback, invoked the callback to signal completion.
 -- This function and the returned callback are both non-blocking.
 dispatch :: ResponseController -> IO (() -> IO ())
-dispatch controller = do
-  -- bump `dispatchedCount`
-  modifyIORef' (dispatchedCount controller) succ
+dispatch (ResponseController var) = do
+  -- bump `dispatched`
+  modifyMVar_ var $ \s -> return s {dispatched = dispatched s + 1}
   return $ \() -> do
-    -- work completed, bump `completedCount`
-    modifyIORef' (completedCount controller) succ
-
-    -- see if there's any Checkpoint
-    result <- tryPeekSizedChan (checkpointChan controller)
-    case result of
-      -- no checkpoints, do nothing
-      Nothing -> return ()
-      -- a checkpoint is set!
-      Just (dispatched, callback) -> do
-        completed <- readIORef (completedCount controller)
-        -- see if the checkpoint is met
-        when (dispatched == completed) $ do
-          -- invoke the callback and remove the checkpoint
-          callback ()
-          void $ readSizedChan (checkpointChan controller)
+    -- work completed: bump `completed` and take every checkpoint it meets
+    met <- modifyMVar var $ \s -> do
+      let completed' = completed s + 1
+          (reached, pending) = partition (\(target, _) -> target <= completed') (checkpoints s)
+      return (s {completed = completed', checkpoints = pending}, reached)
+    -- invoke the callbacks outside the lock
+    mapM_ (\(_, callback) -> callback ()) met
 
 -- | Expects a callback, which will be invoked once all works dispatched BEFORE have been completed
 -- This function is non-blocking
 setCheckpoint :: ResponseController -> (() -> IO ()) -> IO ()
-setCheckpoint controller callback = do
-  dispatched <- readIORef (dispatchedCount controller)
-  completed <- readIORef (completedCount controller)
-  -- see if the previously dispatched works have been completed
-  if dispatched == completed
-    then callback ()
-    else do
-      -- constructs a Checkpoint from `dispatchedCount`
-      let checkpoint = (dispatched, callback)
-      -- write it to the channel
-      writeSizedChan (checkpointChan controller) checkpoint
+setCheckpoint (ResponseController var) callback = do
+  runNow <- modifyMVar var $ \s ->
+    -- see if the previously dispatched works have been completed
+    if dispatched s == completed s
+      then return (s, True)
+      else -- record a Checkpoint at the current `dispatched`
+        return (s {checkpoints = checkpoints s ++ [(dispatched s, callback)]}, False)
+  -- invoke the callback outside the lock
+  when runNow $ callback ()
 
 -- | The blocking version of `setCheckpoint`
 setCheckpointAndWait :: ResponseController -> IO ()
diff --git a/stack-9.10.2-Agda-2.6.4.3.yaml b/stack-9.10.2-Agda-2.6.4.3.yaml
deleted file mode 100644
--- a/stack-9.10.2-Agda-2.6.4.3.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-resolver: lts-24.1
-compiler: ghc-9.10.2
-# Allow a newer minor version of GHC than the snapshot specifies
-compiler-check: newer-minor
-# CI pins and installs GHC itself (haskell-actions/setup, via ghcup); use
-# that GHC directly instead of Stack downloading its own separate copy
-# into ~/.stack/programs. Without this, every job -- cold or warm alike
-# -- pays a redundant full GHC download+configure, since ~/.stack/programs
-# is untracked by the cache and Stack is otherwise unaware the
-# ghcup-installed GHC exists.
-system-ghc: true
-
-packages:
-- .
-
-extra-deps:
-- Agda-2.6.4.3           
-- hashable-1.4.7.0@sha256:573f3ab242f75465a0d67ce9d84202650a1606575e6dbd6d31ffcf4767a9a379,6629
-- network-simple-0.4.2@sha256:3614a0b7e51bcafb5643c3dc3a3a89d20a99671998c8814eb6fc55fa99e38444,1375
-
-flags:
-  agda-language-server:
-    Agda-2-6-4: true
-  Agda:
-    # optimise-heavily: true
-    enable-cluster-counting: true
diff --git a/stack-9.10.2-Agda-2.9.0.yaml b/stack-9.10.2-Agda-2.9.0.yaml
new file mode 100644
--- /dev/null
+++ b/stack-9.10.2-Agda-2.9.0.yaml
@@ -0,0 +1,25 @@
+resolver: lts-24.1
+compiler: ghc-9.10.2
+# Allow a newer minor version of GHC than the snapshot specifies
+compiler-check: newer-minor
+# CI pins and installs GHC itself (haskell-actions/setup, via ghcup); use
+# that GHC directly instead of Stack downloading its own separate copy
+# into ~/.stack/programs. Without this, every job -- cold or warm alike
+# -- pays a redundant full GHC download+configure, since ~/.stack/programs
+# is untracked by the cache and Stack is otherwise unaware the
+# ghcup-installed GHC exists.
+system-ghc: true
+
+packages:
+- .
+
+extra-deps:
+- Agda-2.9.0
+- network-simple-0.4.2@sha256:3614a0b7e51bcafb5643c3dc3a3a89d20a99671998c8814eb6fc55fa99e38444,1375
+
+flags:
+  agda-language-server:
+    Agda-2-9-0: true
+  Agda:
+    # optimise-heavily: true
+    enable-cluster-counting: true
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -4,6 +4,8 @@
 import Data.Typeable (Typeable)
 import qualified Test.Hover as Hover
 import qualified Test.LSP as LSP
+import qualified Test.Render as Render
+import qualified Test.ResponseController as ResponseController
 import qualified Test.Smoke as Smoke
 import qualified Test.SrcLoc as SrcLoc
 import qualified Test.Version as Version
@@ -34,7 +36,9 @@
   testGroup
     "Tests"
     [ SrcLoc.tests,
+      Render.tests,
       Version.tests,
+      ResponseController.tests,
       LSP.tests alsPath,
       Hover.tests alsPath,
       Smoke.tests alsPath
diff --git a/test/Test/Hover.hs b/test/Test/Hover.hs
--- a/test/Test/Hover.hs
+++ b/test/Test/Hover.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 
 -- | Hover tests (#68)
@@ -30,6 +31,7 @@
       hoverAfterImportGraphChanges alsPath,
       hoverAfterProjectChanges alsPath,
       hoverInSession alsPath,
+      literateBlocks alsPath,
       testCase "hover the same with or without a valid .agdai" (hoverWithInterface alsPath),
       testCase "module parameters with or without a valid .agdai" (hoverParamsWithInterface alsPath),
       testCase "a hover with no changes reuses the last load" (hoverReusesLoad alsPath),
@@ -367,6 +369,57 @@
     -- 'f' in the line 'h = f t' that the unsaved edit adds to Main.agda
     onUnsavedF = Position 8 4
 
+-- | Hovers in a literate Markdown file. The text of the file (prose, and
+-- the fences of its code blocks) is not code, so it has no hover.
+literateBlocks :: FilePath -> TestTree
+literateBlocks alsPath =
+  testGroup "literate blocks" $
+    [ testCase "literate text has no hover" $ withFixtures alsPath "Hover" "als-hover-prose" $ \dir -> do
+        writeText (dir </> "Blocks.lagda.md") blocksSource
+        doc <- openDoc "Blocks.lagda.md" "agda"
+        -- in 'Some prose.'
+        expectNoHover doc (Position 2 1)
+        -- in the fence '```agda'
+        expectNoHover doc (Position 4 1),
+      testCase "a bare Markdown block is Agda code by default" $ withFixtures alsPath "Hover" "als-hover-bare-default" $ \dir -> do
+        writeText (dir </> "Blocks.lagda.md") blocksSource
+        doc <- openDoc "Blocks.lagda.md" "agda"
+        expectHover doc onT "T"
+    ]
+#if MIN_VERSION_Agda(2,9,0)
+      -- the option is new in Agda 2.9.0
+      ++ [ testCase "with --literate-markdown-only-agda-blocks, a bare Markdown block is not code" $ withFixtures (alsPath ++ " +AGDA --literate-markdown-only-agda-blocks -AGDA") "Hover" "als-hover-bare-only-agda" $ \dir -> do
+             writeText (dir </> "Blocks.lagda.md") blocksSource
+             doc <- openDoc "Blocks.lagda.md" "agda"
+             expectNoHover doc onT
+         ]
+#endif
+  where
+    -- 't' in 'x = t', in the bare block
+    onT = Position 13 4
+
+-- | A literate Markdown file with prose, an '```agda' block and a bare
+-- '```' block
+blocksSource :: Text
+blocksSource =
+  Text.unlines
+    [ "# Blocks",
+      "",
+      "Some prose.",
+      "",
+      "```agda",
+      "module Blocks where",
+      "",
+      "data T : Set where",
+      "  t : T",
+      "```",
+      "",
+      "```",
+      "x : T",
+      "x = t",
+      "```"
+    ]
+
 -- | The first hover checks Main.agda and Dep.agda and writes their .agdai
 -- files. A new server then hovers at the same place, with those .agdai
 -- files valid. The hover text must not depend on whether a .agdai was
@@ -522,6 +575,12 @@
 expectHover doc pos typ = do
   actual <- hoverText doc pos
   liftIO $ actual @?= "\n```agda-language-server\n" <> typ <> "\n```\n"
+
+-- | Expects no hover at a position
+expectNoHover :: HasCallStack => TextDocumentIdentifier -> Position -> Session ()
+expectNoHover doc pos = do
+  TResponseMessage _ _ rsp <- request SMethod_TextDocumentHover (HoverParams doc pos Nothing)
+  liftIO $ rsp @?= Right (InR Null)
 
 -- | Expects the hover to be the same as that of a fresh server
 expectFreshHover :: HasCallStack => FilePath -> FilePath -> TextDocumentIdentifier -> Position -> Session ()
diff --git a/test/Test/LSP.hs b/test/Test/LSP.hs
--- a/test/Test/LSP.hs
+++ b/test/Test/LSP.hs
@@ -67,11 +67,7 @@
   where
     -- A.agda has no 'main', so the GHC backend warns about it
     noMainWarning :: String
-#if MIN_VERSION_Agda(2,7,0)
     noMainWarning = "warning: -W[no]NoMain\nNo main function defined in A.\nUse option --no-main to suppress this warning."
-#else
-    noMainWarning = "warning: -W[no]GenericWarning\nNo main function defined in A. Use --no-main to suppress this\nwarning."
-#endif
 
 -- | Like 'testCompile', but with an Agda option that fails to parse. als
 -- then falls back to the default options, and it must still register
diff --git a/test/Test/Render.hs b/test/Test/Render.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/Render.hs
@@ -0,0 +1,192 @@
+{-# LANGUAGE CPP #-}
+
+-- | Rendering tests (#73).
+--
+-- Each test checks one property: for a concrete syntax tree @t@, the
+-- plain text of ALS's @render t@ is the same as Agda's own @prettyShow t@,
+-- up to whitespace. The layout is the client's job; the text must match.
+--
+-- The coverage is partial: it has only the renderer cases that changed
+-- from Agda 2.8.0 to 2.9.0, and assumes that the rest renders correctly.
+-- Covering the rest of the renderer with the same property is planned.
+module Test.Render (tests) where
+
+import Test.Tasty
+
+#if MIN_VERSION_Agda(2,9,0)
+import Agda.Syntax.Abstract.Name (mkName_)
+import Agda.Syntax.Common (NameId (..), defaultNamedArg, noPlaceholder)
+import Agda.Syntax.Common.Aspect (Aspect, Aspects (..))
+import qualified Agda.Syntax.Common.Aspect as Asp
+import Agda.Syntax.Common.Pretty (Pretty, prettyShow)
+import Agda.Syntax.Concrete
+import Agda.Syntax.Concrete.Pretty ()
+import Agda.Syntax.Parser (exprParser, moduleParser, parse, parseFile, runPMIO)
+import Agda.Syntax.Position (RangeFile (RangeFile), noRange)
+import Agda.Syntax.TopLevelModuleName.Boot (noModuleNameHash)
+import Agda.Utils.FileName (absolute)
+import Data.List.NonEmpty (NonEmpty ((:|)))
+import Agda.Utils.Null (empty)
+import qualified Agda.Utils.Set1 as Set1
+import Render (Render, render, toPlainText)
+import Test.Tasty.HUnit
+#endif
+
+tests :: TestTree
+#if MIN_VERSION_Agda(2,9,0)
+tests =
+  testGroup
+    "Render"
+    [ testCase "open import with arguments" $ do
+        d <- importDecl
+        agrees d "open import M a",
+      testCase "open import with an as name" $ do
+        Import open kw x _ dir <- importDecl
+        n <- nameOf "N"
+        agrees (Import open kw x (Left (AsName n noRange)) dir) "open import M as N",
+      testCase "open with arguments" $ do
+        ds <- parseDecls "open M a"
+        case ds of
+          [Private _ _ [d@ModuleMacro {}]] -> agrees d "open M a"
+          _ -> assertFailure ("not one inserted module macro: " ++ show (length ds)),
+      testCase "open module" $ do
+        d <- oneDecl "open module X = M"
+        agrees d "open module X = M",
+      testCase "dot pattern" $ do
+        ds <- parseDecls "f : A → A\nf .x = x"
+        case ds of
+          [_, d] -> agrees d "f .x = x"
+          _ -> assertFailure ("not two declarations: " ++ show (length ds)),
+      testCase "ETA_EQUALITY pragma" $ do
+        d <- oneDecl "{-# ETA_EQUALITY #-}"
+        agrees d "{-# ETA_EQUALITY #-}",
+      testCase "sharp cohesion" $ do
+        e <- parseExpr "(@♯ x : A) → A"
+        agrees e "(@♯ x : A) → A",
+      testCase "highlighted expression" $ do
+        e <- parseExpr "f x"
+        agrees (Highlighted empty e) "f x",
+      testCase "known operator application with an aspect" $ do
+        e <- knownOpApp (Just (Asp.Name (Just Asp.Function) True))
+        agrees e "x + y",
+      testCase "known operator application without an aspect" $ do
+        e <- knownOpApp Nothing
+        agrees e "x + y",
+      testCase "do block" $ do
+        e <- parseExpr "do x"
+        agrees e "do x",
+      testCase "qualified do block" $ do
+        e <- parseExpr "M.do x"
+        agrees e "M.do x",
+      testCase "idiom brackets" $ do
+        e <- parseExpr "(| f x |)"
+        agrees e "⦇ f x ⦈",
+      testCase "qualified idiom brackets" $ do
+        e <- parseExpr "M.(| f x |)"
+        agrees e "M.⦇ f x ⦈",
+      testCase "quantity 0" $ do
+        e <- parseExpr "(@0 x : A) → A"
+        agrees e "(@0 x : A) → A",
+      testCase "erased quantity" $ do
+        e <- parseExpr "(@erased x : A) → A"
+        agrees e "(@erased x : A) → A",
+      testCase "function clause" $ do
+        d <- clauseOf "f : A → A\nf x = x"
+        agrees d "f x = x",
+      testCase "function clause with a modality" $ do
+        d <- clauseOf "@0 f : A → A\n@0 f x = x"
+        agrees d "@0 f x = x",
+      testCase "function clause with a polarity" $ do
+        d <- clauseOf "@++ f : A → A\n@++ f x = x"
+        agrees d "@++ f x = x",
+      testCase "rewrite in a typed binder" $ do
+        e <- parseExpr "(@rewrite p : x ≡ y) → A"
+        agrees e "(@rewrite p : x ≡ y) → A",
+      testCase "rewrite in a hidden domain-free binder" $ do
+        e <- parseExpr "λ {@rewrite p} → p"
+        agrees e "λ {@rewrite p} → p",
+      -- Agda adds no parentheses for @rewrite alone
+      testCase "rewrite in a visible domain-free binder" $ do
+        e <- parseExpr "λ (@rewrite p) → p"
+        agrees e "λ @rewrite p → p"
+    ]
+
+-- | Asserts Agda's text first, so a failure shows whether the snippet has
+-- the feature, then that ALS's text is the same.
+agrees :: (Render a, Pretty a) => a -> String -> Assertion
+agrees t expected = do
+  normalize (prettyShow t) @?= expected
+  normalize (toPlainText (render t)) @?= expected
+  where
+    normalize = unwords . words
+
+-- | The declarations inside @module M where@, followed by the lines of
+-- the snippet
+parseDecls :: String -> IO [Declaration]
+parseDecls src = do
+  path <- absolute "M.agda"
+  let file = RangeFile path Nothing
+  (result, _warnings) <- runPMIO $ parseFile False moduleParser file ("module M where\n\n" ++ src ++ "\n")
+  case result of
+    Left err -> assertFailure ("parse error: " ++ prettyShow err)
+    Right (((Mod _ _ [Module _ _ _ _ ds], _attrs), _fileType)) -> return ds
+    Right _ -> assertFailure "not one top-level module"
+
+oneDecl :: String -> IO Declaration
+oneDecl src = do
+  ds <- parseDecls src
+  case ds of
+    [d] -> return d
+    _ -> assertFailure ("not one declaration: " ++ show (length ds))
+
+parseExpr :: String -> IO Expr
+parseExpr src = do
+  (result, _warnings) <- runPMIO $ parse exprParser src
+  case result of
+    Left err -> assertFailure ("parse error: " ++ prettyShow err)
+    Right (e, _attrs) -> return e
+
+-- | The clause of a type signature followed by one clause
+clauseOf :: String -> IO Declaration
+clauseOf src = do
+  ds <- parseDecls src
+  case ds of
+    [_, d@FunClause {}] -> return d
+    _ -> assertFailure ("not a signature and a clause: " ++ show (length ds))
+
+importDecl :: IO Declaration
+importDecl = do
+  d <- oneDecl "open import M a"
+  case d of
+    Import _ _ _ (Right _) _ -> return d
+    _ -> assertFailure "not an import with arguments"
+
+nameOf :: String -> IO Name
+nameOf s = do
+  e <- parseExpr s
+  case e of
+    Ident (QName n) -> return n
+    _ -> assertFailure ("not an unqualified name: " ++ s)
+
+-- | @x + y@ as the type checker gives it back: 'KnownOpApp' is built only
+-- when abstract syntax is turned back into concrete syntax
+knownOpApp :: Maybe Aspect -> IO Expr
+knownOpApp asp = do
+  op <- parseExpr "_+_"
+  x <- parseExpr "x"
+  y <- parseExpr "y"
+  case op of
+    Ident q@(QName n) ->
+      return $
+        KnownOpApp
+          empty {aspect = asp}
+          noRange
+          q
+          (Set1.singleton (mkName_ (NameId 0 noModuleNameHash) (prettyShow n)))
+          (arg x :| [arg y])
+    _ -> assertFailure "not an unqualified operator"
+  where
+    arg = defaultNamedArg . noPlaceholder . Ordinary
+#else
+tests = testGroup "Render" []
+#endif
diff --git a/test/Test/ResponseController.hs b/test/Test/ResponseController.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/ResponseController.hs
@@ -0,0 +1,63 @@
+module Test.ResponseController (tests) where
+
+import Control.Concurrent
+import Server.ResponseController (dispatch, new, setCheckpointAndWait)
+import System.Timeout (timeout)
+import Test.Tasty
+import Test.Tasty.HUnit
+
+tests :: TestTree
+tests =
+  testGroup
+    "ResponseController"
+    [ testCase "checkpoint fires when the last answer races setCheckpointAndWait" raceTest,
+      testCase "checkpoint fires when the answer comes before setCheckpointAndWait" $ do
+        c <- new
+        done <- dispatch c
+        done ()
+        result <- timeout oneSecond (setCheckpointAndWait c)
+        result @?= Just (),
+      testCase "checkpoint fires when the answer comes after the checkpoint is set" $ do
+        c <- new
+        done <- dispatch c
+        finished <- newEmptyMVar
+        _ <- forkIO (setCheckpointAndWait c >> putMVar finished ())
+        threadDelay 10000
+        done ()
+        result <- timeout oneSecond (takeMVar finished)
+        result @?= Just ()
+    ]
+
+oneSecond :: Int
+oneSecond = 1000000
+
+-- | Issue #78: the only response's answer races the checkpoint. Once the answer
+-- is in, the waiter must return; if it stays blocked, the hang has reproduced.
+raceTest :: Assertion
+raceTest = go 0
+  where
+    iterations :: Int
+    iterations = 200000
+
+    go :: Int -> Assertion
+    go i
+      | i >= iterations = return ()
+      | otherwise = do
+          c <- new
+          done <- dispatch c
+          finished <- newEmptyMVar
+          waiter <- forkIO (setCheckpointAndWait c >> putMVar finished ())
+          case i `mod` 3 of
+            0 -> return ()
+            1 -> yield
+            _ -> threadDelay 1
+          done ()
+          result <- timeout oneSecond (takeMVar finished)
+          case result of
+            Just () -> go (i + 1)
+            Nothing -> do
+              killThread waiter
+              assertFailure $
+                "iteration "
+                  <> show i
+                  <> ": the only response was answered, but setCheckpointAndWait is still blocked"
